Commit da9ac904 by Dudás Ádám

vm: block until confirmation on shutdown

parent 5d3ab4a7
...@@ -822,8 +822,20 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -822,8 +822,20 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
task_uuid=task_uuid, user=user): task_uuid=task_uuid, user=user):
queue_name = self.get_remote_queue_name('vm') queue_name = self.get_remote_queue_name('vm')
self.__clear_libvirt_state_queue()
vm_tasks.shutdown.apply_async(args=[self.vm_name], vm_tasks.shutdown.apply_async(args=[self.vm_name],
queue=queue_name).get() queue=queue_name).get()
i = 2
while i > 0:
try:
libvirt_state = self.libvirt_state_queue.get(True, 60)
except Empty:
raise TimeoutError()
else:
if libvirt_state == 'MISSING':
break
else:
i -= 1
def shutdown_async(self, user=None): def shutdown_async(self, user=None):
"""Execute shutdown asynchronously. """Execute shutdown asynchronously.
......
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