Commit 803c7821 by Bach Dániel

vm: fix MigrateOperation (Unhandled exception: 'NoneType' object has no attribute 'host')

parent f5f2eb9c
......@@ -920,6 +920,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
delete_dump.apply_async(args=[self.mem_dump['path']],
queue=queue_name).get(timeout=timeout)
def reallocate_node(self, activity):
with activity.sub_activity(
'scheduling',
readable_name=ugettext_noop("schedule")) as sa:
sa.result = node = self.select_node()
return node
def allocate_node(self, activity):
if self.node is not None:
return None
......
......@@ -398,7 +398,7 @@ class MigrateOperation(InstanceOperation):
def _operation(self, activity, to_node=None, timeout=120):
if not to_node:
self.instance.allocate_node(activity)
to_node = self.instance.reallocate_node(activity)
try:
with activity.sub_activity(
'migrate_vm', readable_name=create_readable(
......@@ -418,6 +418,7 @@ class MigrateOperation(InstanceOperation):
# Refresh node information
self.instance.node = to_node
self.instance.save()
# Estabilish network connection (vmdriver)
with activity.sub_activity(
'deploying_net', readable_name=ugettext_noop(
......
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