Merge "Macvtap: Check for no original port in is_live_migration" into stable/newton
This commit is contained in:
commit
76d95b8b9c
|
@ -64,6 +64,9 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
|||
# The only safe way to detect a migration is to look into the binding
|
||||
# profiles 'migrating_to' attribute, which is set by Nova since patch
|
||||
# https://review.openstack.org/#/c/275073/.
|
||||
if not context.original:
|
||||
# new port
|
||||
return False
|
||||
port_profile = context.original.get(portbindings.PROFILE)
|
||||
if port_profile and port_profile.get('migrating_to', None):
|
||||
LOG.debug("Live migration with profile %s detected.", port_profile)
|
||||
|
|
|
@ -59,7 +59,7 @@ class FakePortContext(api.PortContext):
|
|||
|
||||
@property
|
||||
def original(self):
|
||||
return self._original or {}
|
||||
return self._original
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
|
|
|
@ -71,6 +71,9 @@ class MacvtapMechanismMigrationTestCase(object):
|
|||
def test__is_live_migration_false(self):
|
||||
self._test__is_live_migration(False, {})
|
||||
|
||||
def test__is_live_migration_false_None_original(self):
|
||||
self._test__is_live_migration(False, None)
|
||||
|
||||
def _test__is_live_migration(self, expected, original):
|
||||
context = base.FakePortContext(self.AGENT_TYPE,
|
||||
self.AGENTS,
|
||||
|
|
Loading…
Reference in New Issue