Fix handling of failed-start
This commit is contained in:
parent
94abdf9041
commit
3851069b7a
|
@ -82,17 +82,17 @@ class VMInstance:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dom = conn.createXML(xmlconfig, 0)
|
dom = conn.createXML(xmlconfig, 0)
|
||||||
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:
|
if not self.domuuid in self.thishypervisor.domain_list:
|
||||||
self.thishypervisor.domain_list.append(self.domuuid)
|
self.thishypervisor.domain_list.append(self.domuuid)
|
||||||
|
|
||||||
conn.close()
|
|
||||||
ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o')
|
ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o')
|
||||||
self.dom = dom
|
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'))
|
||||||
|
self.dom = None
|
||||||
|
|
||||||
|
conn.close()
|
||||||
self.instart = False
|
self.instart = False
|
||||||
|
|
||||||
# Stop the VM forcibly without updating state
|
# Stop the VM forcibly without updating state
|
||||||
|
|
Loading…
Reference in New Issue