Merge "linux_net: use new exception for ovs-vsctl failures"
This commit is contained in:
commit
7b00eddb32
@ -832,6 +832,10 @@ class VifDetailsMissingMacvtapParameters(Invalid):
|
||||
" correct.")
|
||||
|
||||
|
||||
class OvsConfigurationFailure(NovaException):
|
||||
msg_fmt = _("OVS configuration failed with: %(inner_exception)s.")
|
||||
|
||||
|
||||
class DatastoreNotFound(NotFound):
|
||||
msg_fmt = _("Could not find the datastore reference(s) which the VM uses.")
|
||||
|
||||
|
@ -1362,7 +1362,7 @@ def _ovs_vsctl(args):
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
{'cmd': full_args, 'exception': e})
|
||||
raise exception.AgentError(method=full_args)
|
||||
raise exception.OvsConfigurationFailure(inner_exception=e)
|
||||
|
||||
|
||||
def create_ovs_vif_port(bridge, dev, iface_id, mac, instance_id, mtu=None):
|
||||
|
@ -16,6 +16,7 @@
|
||||
import calendar
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
|
||||
import mock
|
||||
@ -655,7 +656,7 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
|
||||
self.flags(fake_network=False)
|
||||
|
||||
def fake_execute(*args, **kwargs):
|
||||
raise processutils.ProcessExecutionError('error')
|
||||
raise processutils.ProcessExecutionError('specific_error')
|
||||
|
||||
def fake_device_exists(*args, **kwargs):
|
||||
return False
|
||||
@ -663,9 +664,16 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
|
||||
self.stubs.Set(utils, 'execute', fake_execute)
|
||||
self.stubs.Set(linux_net, 'device_exists', fake_device_exists)
|
||||
driver = linux_net.LinuxOVSInterfaceDriver()
|
||||
self.assertRaises(exception.AgentError,
|
||||
driver.plug, {'uuid': 'fake_network_uuid'},
|
||||
'fake_mac')
|
||||
|
||||
exc = self.assertRaises(exception.OvsConfigurationFailure,
|
||||
driver.plug,
|
||||
{'uuid': 'fake_network_uuid'}, 'fake_mac')
|
||||
self.assertRegex(
|
||||
str(exc),
|
||||
re.compile("OVS configuration failed with: .*specific_error.*",
|
||||
re.DOTALL))
|
||||
self.assertIsInstance(exc.kwargs['inner_exception'],
|
||||
processutils.ProcessExecutionError)
|
||||
|
||||
def test_vlan_override(self):
|
||||
"""Makes sure vlan_interface flag overrides network bridge_interface.
|
||||
|
Loading…
x
Reference in New Issue
Block a user