Skip to content

Instantly share code, notes, and snippets.

@vishvananda
Created March 6, 2012 20:00
Show Gist options
  • Save vishvananda/1988671 to your computer and use it in GitHub Desktop.
Save vishvananda/1988671 to your computer and use it in GitHub Desktop.
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 0accb91..5cb34f8 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -2024,15 +2024,6 @@ class ComputeManager(manager.SchedulerDependentManager):
"args": {'instance_id': instance_ref['id'],
'block_migration': block_migration}})
- # Restore instance state
- current_power_state = self._get_power_state(ctxt, instance_ref)
- self._instance_update(ctxt,
- instance_ref["id"],
- host=dest,
- power_state=current_power_state,
- vm_state=vm_states.ACTIVE,
- task_state=None)
-
# Restore volume state
for volume_ref in instance_ref['volumes']:
self.volume_api.update(ctxt, volume_ref, {'status': 'in-use'})
@@ -2073,6 +2064,19 @@ class ComputeManager(manager.SchedulerDependentManager):
self.driver.post_live_migration_at_destination(context, instance_ref,
self._legacy_nw_info(network_info),
block_migration)
+ # Restore instance state
+ current_power_state = self._get_power_state(context, instance_ref)
+ self._instance_update(context,
+ instance_ref['id'],
+ host=self.host,
+ power_state=current_power_state,
+ vm_state=vm_states.ACTIVE,
+ task_state=None)
+ # NOTE(vish): this is necessary to update dhcp if necessary
+ self.network_api.setup_networks_on_host(context, instance_ref,
+ self.host)
+
+
def rollback_live_migration(self, context, instance_ref,
dest, block_migration):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment