summaryrefslogtreecommitdiff
path: root/nova/compute/resource_tracker.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/compute/resource_tracker.py')
-rw-r--r--nova/compute/resource_tracker.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py
index 33926e0d47..5b9e64e219 100644
--- a/nova/compute/resource_tracker.py
+++ b/nova/compute/resource_tracker.py
@@ -1970,3 +1970,21 @@ class ResourceTracker(object):
"""
self.pci_tracker.free_instance_claims(context, instance)
self.pci_tracker.save(context)
+
+ @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, fair=True)
+ def finish_evacuation(self, instance, node, migration):
+ instance.apply_migration_context()
+ # NOTE (ndipanov): This save will now update the host and node
+ # attributes making sure that next RT pass is consistent since
+ # it will be based on the instance and not the migration DB
+ # entry.
+ instance.host = self.host
+ instance.node = node
+ instance.save()
+ instance.drop_migration_context()
+
+ # NOTE (ndipanov): Mark the migration as done only after we
+ # mark the instance as belonging to this host.
+ if migration:
+ migration.status = 'done'
+ migration.save()