summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-15 04:39:06 +0000
committerGerrit Code Review <review@openstack.org>2017-06-15 04:39:06 +0000
commit76d95b8b9cce8fdf6676f346d64ec6d98c62caa6 (patch)
tree04f03fdc83e7427cc32ed2522884537c034e5c32
parent4853229fead92b586e3d0dcf6bffb2a4e974e643 (diff)
parentfe3a2139a872f432a5c4a509bc403ea5b6ac429e (diff)
Merge "Macvtap: Check for no original port in is_live_migration" into stable/newton
-rw-r--r--neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py3
-rw-r--r--neutron/tests/unit/plugins/ml2/_test_mech_agent.py2
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/macvtap/mech_driver/test_mech_macvtap.py3
3 files changed, 7 insertions, 1 deletions
diff --git a/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py b/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py
index 0d54090..f578e8b 100644
--- a/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py
+++ b/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py
@@ -64,6 +64,9 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
64 # The only safe way to detect a migration is to look into the binding 64 # The only safe way to detect a migration is to look into the binding
65 # profiles 'migrating_to' attribute, which is set by Nova since patch 65 # profiles 'migrating_to' attribute, which is set by Nova since patch
66 # https://review.openstack.org/#/c/275073/. 66 # https://review.openstack.org/#/c/275073/.
67 if not context.original:
68 # new port
69 return False
67 port_profile = context.original.get(portbindings.PROFILE) 70 port_profile = context.original.get(portbindings.PROFILE)
68 if port_profile and port_profile.get('migrating_to', None): 71 if port_profile and port_profile.get('migrating_to', None):
69 LOG.debug("Live migration with profile %s detected.", port_profile) 72 LOG.debug("Live migration with profile %s detected.", port_profile)
diff --git a/neutron/tests/unit/plugins/ml2/_test_mech_agent.py b/neutron/tests/unit/plugins/ml2/_test_mech_agent.py
index 3e4efdc..addfb67 100644
--- a/neutron/tests/unit/plugins/ml2/_test_mech_agent.py
+++ b/neutron/tests/unit/plugins/ml2/_test_mech_agent.py
@@ -59,7 +59,7 @@ class FakePortContext(api.PortContext):
59 59
60 @property 60 @property
61 def original(self): 61 def original(self):
62 return self._original or {} 62 return self._original
63 63
64 @property 64 @property
65 def status(self): 65 def status(self):
diff --git a/neutron/tests/unit/plugins/ml2/drivers/macvtap/mech_driver/test_mech_macvtap.py b/neutron/tests/unit/plugins/ml2/drivers/macvtap/mech_driver/test_mech_macvtap.py
index 5d145a1..0c5c30c 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/macvtap/mech_driver/test_mech_macvtap.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/macvtap/mech_driver/test_mech_macvtap.py
@@ -71,6 +71,9 @@ class MacvtapMechanismMigrationTestCase(object):
71 def test__is_live_migration_false(self): 71 def test__is_live_migration_false(self):
72 self._test__is_live_migration(False, {}) 72 self._test__is_live_migration(False, {})
73 73
74 def test__is_live_migration_false_None_original(self):
75 self._test__is_live_migration(False, None)
76
74 def _test__is_live_migration(self, expected, original): 77 def _test__is_live_migration(self, expected, original):
75 context = base.FakePortContext(self.AGENT_TYPE, 78 context = base.FakePortContext(self.AGENT_TYPE,
76 self.AGENTS, 79 self.AGENTS,