Wait for shutdown

This commit is contained in:
Joshua Boniface 2018-06-02 16:19:51 -04:00
parent 6bc2bf0579
commit 6a1b282bfd
1 changed files with 3 additions and 0 deletions

View File

@ -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)