diff --git a/VMInstance.py b/VMInstance.py index 57f23049..9217edd9 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -78,6 +78,9 @@ class VMInstance: def shutdown_vm(self): print("Stopping VM %s" % self.domuuid) self.dom.shutdown() + while self.dom.state()[0] == libvirt.VIR_DOMAIN_RUNNING: + time.sleep(0.5) + if self.domuuid in self.thishypervisor.domain_list: try: self.thishypervisor.domain_list.remove(self.domuuid)