linux_net: use new exception for ovs-vsctl failures
Failures of ovs-vsctl calls were wrapped into AgentError exception by mistake - the latter has nothing to do with OVS and is solely a xenapi thing. Add a new exception specific for ovs-vsctl failures. TrivialFix Change-Id: I74bbfe614917f6bd0b18bd45db5d844dbb8c0437
This commit is contained in:
parent
dae13c5153
commit
069be6e158
@ -832,6 +832,10 @@ class VifDetailsMissingMacvtapParameters(Invalid):
|
|||||||
" correct.")
|
" correct.")
|
||||||
|
|
||||||
|
|
||||||
|
class OvsConfigurationFailure(NovaException):
|
||||||
|
msg_fmt = _("OVS configuration failed with: %(inner_exception)s.")
|
||||||
|
|
||||||
|
|
||||||
class DatastoreNotFound(NotFound):
|
class DatastoreNotFound(NotFound):
|
||||||
msg_fmt = _("Could not find the datastore reference(s) which the VM uses.")
|
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:
|
except Exception as e:
|
||||||
LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||||
{'cmd': full_args, 'exception': e})
|
{'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):
|
def create_ovs_vif_port(bridge, dev, iface_id, mac, instance_id, mtu=None):
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import calendar
|
import calendar
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
@ -655,7 +656,7 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
|
|||||||
self.flags(fake_network=False)
|
self.flags(fake_network=False)
|
||||||
|
|
||||||
def fake_execute(*args, **kwargs):
|
def fake_execute(*args, **kwargs):
|
||||||
raise processutils.ProcessExecutionError('error')
|
raise processutils.ProcessExecutionError('specific_error')
|
||||||
|
|
||||||
def fake_device_exists(*args, **kwargs):
|
def fake_device_exists(*args, **kwargs):
|
||||||
return False
|
return False
|
||||||
@ -663,9 +664,16 @@ class LinuxNetworkTestCase(test.NoDBTestCase):
|
|||||||
self.stubs.Set(utils, 'execute', fake_execute)
|
self.stubs.Set(utils, 'execute', fake_execute)
|
||||||
self.stubs.Set(linux_net, 'device_exists', fake_device_exists)
|
self.stubs.Set(linux_net, 'device_exists', fake_device_exists)
|
||||||
driver = linux_net.LinuxOVSInterfaceDriver()
|
driver = linux_net.LinuxOVSInterfaceDriver()
|
||||||
self.assertRaises(exception.AgentError,
|
|
||||||
driver.plug, {'uuid': 'fake_network_uuid'},
|
exc = self.assertRaises(exception.OvsConfigurationFailure,
|
||||||
'fake_mac')
|
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):
|
def test_vlan_override(self):
|
||||||
"""Makes sure vlan_interface flag overrides network bridge_interface.
|
"""Makes sure vlan_interface flag overrides network bridge_interface.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user