Commit 15821cba by Bach Dániel

vm: migration with zero downtime

parent 9d49beaf
...@@ -822,7 +822,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -822,7 +822,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
def migrate_vm(self, to_node, timeout=120): def migrate_vm(self, to_node, timeout=120):
queue_name = self.get_remote_queue_name('vm', 'slow') queue_name = self.get_remote_queue_name('vm', 'slow')
return vm_tasks.migrate.apply_async(args=[self.vm_name, return vm_tasks.migrate.apply_async(args=[self.vm_name,
to_node.host.hostname], to_node.host.hostname,
True],
queue=queue_name queue=queue_name
).get(timeout=timeout) ).get(timeout=timeout)
......
...@@ -250,10 +250,6 @@ class MigrateOperation(InstanceOperation): ...@@ -250,10 +250,6 @@ class MigrateOperation(InstanceOperation):
to_node = self.instance.select_node() to_node = self.instance.select_node()
sa.result = to_node sa.result = to_node
# Shutdown networks
with activity.sub_activity('shutdown_net'):
self.instance.shutdown_net()
try: try:
with activity.sub_activity('migrate_vm'): with activity.sub_activity('migrate_vm'):
self.instance.migrate_vm(to_node=to_node, timeout=timeout) self.instance.migrate_vm(to_node=to_node, timeout=timeout)
...@@ -262,6 +258,10 @@ class MigrateOperation(InstanceOperation): ...@@ -262,6 +258,10 @@ class MigrateOperation(InstanceOperation):
self.rollback(activity) self.rollback(activity)
raise raise
# Shutdown networks
with activity.sub_activity('shutdown_net'):
self.instance.shutdown_net()
# Refresh node information # Refresh node information
self.instance.node = to_node self.instance.node = to_node
self.instance.save() self.instance.save()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment