Correct bug where starting a running instance triggered failed state
This commit is contained in:
parent
57b3c62fb0
commit
09b4191427
|
@ -115,6 +115,19 @@ class VMInstance:
|
||||||
self.instart = False
|
self.instart = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Try to get the current state in case it's already running
|
||||||
|
try:
|
||||||
|
self.dom = self.lookupByUUID(self.domuuid)
|
||||||
|
curstate = self.dom.state()[0]
|
||||||
|
except:
|
||||||
|
curstate = 'notstart'
|
||||||
|
|
||||||
|
if curstate == libvirt.VIR_DOMAIN_RUNNING:
|
||||||
|
# If it is running just update the model
|
||||||
|
self.addDomainToList()
|
||||||
|
zkhandler.writedata(self.zk_conn, { '/domains/{}/failedreason'.format(self.domuuid): '' })
|
||||||
|
else:
|
||||||
|
# Or try to create it
|
||||||
try:
|
try:
|
||||||
# Grab the domain information from Zookeeper
|
# Grab the domain information from Zookeeper
|
||||||
xmlconfig = zkhandler.readdata(self.zk_conn, '/domains/{}/xml'.format(self.domuuid))
|
xmlconfig = zkhandler.readdata(self.zk_conn, '/domains/{}/xml'.format(self.domuuid))
|
||||||
|
|
Loading…
Reference in New Issue