ml2: fix update_device_up to send lm events with linux bridge
In case of a live migration and with linux bridge the events are not sent to Nova, because the port UUID returned by _device_to_port_id may be a truncated UUID and the current plugin._get_port() can't find it. Related-Bug: #1414559 Change-Id: Icb039ae2d465e3822ab07ae4f9bc405c1362afba Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
This commit is contained in:
parent
fc73306daa
commit
38b3d4e16a
@ -17,7 +17,6 @@ from neutron_lib.api.definitions import port_security as psec
|
|||||||
from neutron_lib.api.definitions import portbindings
|
from neutron_lib.api.definitions import portbindings
|
||||||
from neutron_lib.callbacks import resources
|
from neutron_lib.callbacks import resources
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
from neutron_lib import exceptions
|
|
||||||
from neutron_lib.plugins import directory
|
from neutron_lib.plugins import directory
|
||||||
from neutron_lib.plugins.ml2 import api
|
from neutron_lib.plugins.ml2 import api
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
@ -253,9 +252,10 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
|||||||
# this might mean that a VM is in the process of live migration
|
# this might mean that a VM is in the process of live migration
|
||||||
# and vif was plugged on the destination compute node;
|
# and vif was plugged on the destination compute node;
|
||||||
# need to notify nova explicitly
|
# need to notify nova explicitly
|
||||||
try:
|
port = ml2_db.get_port(rpc_context, port_id)
|
||||||
port = plugin._get_port(rpc_context, port_id)
|
# _device_to_port_id may have returned a truncated UUID if the
|
||||||
except exceptions.PortNotFound:
|
# agent did not provide a full one (e.g. Linux Bridge case).
|
||||||
|
if not port:
|
||||||
LOG.debug("Port %s not found, will not notify nova.", port_id)
|
LOG.debug("Port %s not found, will not notify nova.", port_id)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -31,6 +31,7 @@ from sqlalchemy.orm import exc
|
|||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.db import provisioning_blocks
|
from neutron.db import provisioning_blocks
|
||||||
|
from neutron.plugins.ml2 import db as ml2_db
|
||||||
from neutron.plugins.ml2.drivers import type_tunnel
|
from neutron.plugins.ml2.drivers import type_tunnel
|
||||||
from neutron.plugins.ml2 import managers
|
from neutron.plugins.ml2 import managers
|
||||||
from neutron.plugins.ml2 import rpc as plugin_rpc
|
from neutron.plugins.ml2 import rpc as plugin_rpc
|
||||||
@ -222,11 +223,12 @@ class RpcCallbacksTestCase(base.BaseTestCase):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def test_update_device_up_with_device_not_bound_to_host(self):
|
def test_update_device_up_with_device_not_bound_to_host(self):
|
||||||
self.assertIsNone(self._test_update_device_not_bound_to_host(
|
with mock.patch.object(ml2_db, 'get_port') as ml2_db_get_port:
|
||||||
self.callbacks.update_device_up))
|
self.assertIsNone(self._test_update_device_not_bound_to_host(
|
||||||
port = self.plugin._get_port.return_value
|
self.callbacks.update_device_up))
|
||||||
(self.plugin.nova_notifier.notify_port_active_direct.
|
port = ml2_db_get_port.return_value
|
||||||
assert_called_once_with(port))
|
(self.plugin.nova_notifier.notify_port_active_direct.
|
||||||
|
assert_called_once_with(port))
|
||||||
|
|
||||||
def test_update_device_down_with_device_not_bound_to_host(self):
|
def test_update_device_down_with_device_not_bound_to_host(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
Loading…
Reference in New Issue
Block a user