(hopefully) fix race condition when data updates
This commit is contained in:
parent
d77373bb21
commit
b3169758ff
|
@ -48,9 +48,10 @@ class VMInstance:
|
||||||
print(data.decode('ascii'))
|
print(data.decode('ascii'))
|
||||||
try:
|
try:
|
||||||
self.hypervisor = data.decode('ascii')
|
self.hypervisor = data.decode('ascii')
|
||||||
except:
|
self.state = self.zk.get('/domains/{}/state'.format(self.domuuid))
|
||||||
return
|
|
||||||
self.manage_vm_state()
|
self.manage_vm_state()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# Watch for changes to the state field in Zookeeper
|
# Watch for changes to the state field in Zookeeper
|
||||||
@zk.DataWatch('/domains/{}/state'.format(self.domuuid))
|
@zk.DataWatch('/domains/{}/state'.format(self.domuuid))
|
||||||
|
@ -58,9 +59,10 @@ class VMInstance:
|
||||||
print(data.decode('ascii'))
|
print(data.decode('ascii'))
|
||||||
try:
|
try:
|
||||||
self.state = data.decode('ascii')
|
self.state = data.decode('ascii')
|
||||||
except:
|
self.hypervisor = self.zk.get('/domains/{}/hypervisor'.format(self.domuuid))
|
||||||
return
|
|
||||||
self.manage_vm_state()
|
self.manage_vm_state()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# Get data functions
|
# Get data functions
|
||||||
def getstate(self):
|
def getstate(self):
|
||||||
|
|
Loading…
Reference in New Issue