From 6a1b282bfd444e65a500994021431fbcc55b92ea Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 2 Jun 2018 16:19:51 -0400 Subject: [PATCH] Wait for shutdown --- VMInstance.py | 3 +++ 1 file changed, 3 insertions(+) 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)