Add failedreason ZK key write on VM failure

This commit is contained in:
Joshua Boniface 2018-07-19 22:46:50 -04:00
parent 61aef9fd3e
commit d9da59c86b
1 changed files with 2 additions and 0 deletions

View File

@ -122,9 +122,11 @@ class VMInstance:
self.addDomainToList()
ansiiprint.echo('Successfully started VM', '{}:'.format(self.domuuid), 'o')
self.dom = dom
zkhandler.writedata(self.zk_conn, { '/domains/{}/failedreason'.format(self.domuuid): '' })
except libvirt.libvirtError as e:
ansiiprint.echo('Failed to create VM', '{}:'.format(self.domuuid), 'e')
zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(self.domuuid): 'failed' })
zkhandler.writedata(self.zk_conn, { '/domains/{}/failedreason'.format(self.domuuid): e })
self.dom = None
lv_conn.close()