Commit c954157e by Guba Sándor

instance: handle Domain not found exception fixes #32

parent 6ecab692
......@@ -671,8 +671,13 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
# Destroy virtual machine
with act.sub_activity('destroying_vm'):
queue_name = self.get_remote_queue_name('vm')
vm_tasks.destroy.apply_async(args=[self.vm_name],
queue=queue_name).get()
try:
vm_tasks.destroy.apply_async(args=[self.vm_name],
queue=queue_name).get()
except Exception as e:
if e.libvirtError is True:
if "Domain not found" in str(e):
pass
  • What's this code supposed to do? The except block is ~equivalent to pass.

    Edited
Please register or sign in to reply
def __cleanup_after_destroy_vm(self, act):
"""Clean up the virtual machine's data after destroy.
......
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