FakeDriver: adding and removing instances on live migration.
There was no code in FakeDriver that updated the internal dict `self.instances` when a FakeInstance was live migrated. This commit fills this gap. As a result, a couple of versioned notification samples get updated since we are now properly tracking a live migrated instance on the destination host as running vs pending power state. Closes-Bug: 1426433 Change-Id: I9562e1bcbb18c7d543d5a6b36011fa28c13dfa79
This commit is contained in:
committed by
Stephen Finucane
parent
bbda16f634
commit
14342d629b
@@ -5,7 +5,6 @@
|
|||||||
"nova_object.data": {
|
"nova_object.data": {
|
||||||
"host": "host2",
|
"host": "host2",
|
||||||
"node": "host2",
|
"node": "host2",
|
||||||
"power_state": "pending",
|
|
||||||
"task_state": "rebuilding",
|
"task_state": "rebuilding",
|
||||||
"action_initiator_user": "admin"
|
"action_initiator_user": "admin"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
"nova_object.data":{
|
"nova_object.data":{
|
||||||
"host": "host2",
|
"host": "host2",
|
||||||
"node": "host2",
|
"node": "host2",
|
||||||
"power_state": "pending",
|
|
||||||
"action_initiator_user": "admin"
|
"action_initiator_user": "admin"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -262,7 +262,11 @@ class FakeDriver(driver.ComputeDriver):
|
|||||||
network_info,
|
network_info,
|
||||||
block_migration=False,
|
block_migration=False,
|
||||||
block_device_info=None):
|
block_device_info=None):
|
||||||
pass
|
# Called from the destination host after a successful live migration
|
||||||
|
# so spawn the instance on this host to track it properly.
|
||||||
|
image_meta = injected_files = admin_password = allocations = None
|
||||||
|
self.spawn(context, instance, image_meta, injected_files,
|
||||||
|
admin_password, allocations)
|
||||||
|
|
||||||
def power_off(self, instance, timeout=0, retry_interval=0):
|
def power_off(self, instance, timeout=0, retry_interval=0):
|
||||||
if instance.uuid in self.instances:
|
if instance.uuid in self.instances:
|
||||||
@@ -882,8 +886,11 @@ class FakeLiveMigrateDriver(FakeDriver):
|
|||||||
|
|
||||||
def post_live_migration(self, context, instance, block_device_info,
|
def post_live_migration(self, context, instance, block_device_info,
|
||||||
migrate_data=None):
|
migrate_data=None):
|
||||||
if instance.uuid in self.instances:
|
# Runs on the source host, called from
|
||||||
del self.instances[instance.uuid]
|
# ComputeManager._post_live_migration so just delete the instance
|
||||||
|
# from being tracked on the source host.
|
||||||
|
self.destroy(context, instance, network_info=None,
|
||||||
|
block_device_info=block_device_info)
|
||||||
|
|
||||||
|
|
||||||
class FakeLiveMigrateDriverWithNestedCustomResources(
|
class FakeLiveMigrateDriverWithNestedCustomResources(
|
||||||
|
|||||||
Reference in New Issue
Block a user