Fix handling of failed-start

This commit is contained in:
Joshua Boniface 2018-06-10 21:04:00 -04:00
parent 94abdf9041
commit 3851069b7a
1 changed files with 6 additions and 6 deletions

View File

@ -82,17 +82,17 @@ class VMInstance:
try:
dom = conn.createXML(xmlconfig, 0)
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o')
self.dom = dom
except libvirt.libvirtError as e:
ansiiprint.echo('Failed to create VM', '{}:'.format(self.domuuid), 'e')
self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii'))
return
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
self.dom = None
conn.close()
ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o')
self.dom = dom
self.instart = False
# Stop the VM forcibly without updating state