Add try blocks around decode functions for when a new daemon is created
This commit is contained in:
parent
ec0dacb042
commit
34fb851c33
|
@ -21,7 +21,11 @@ class NodeInstance(threading.Thread):
|
||||||
# Zookeeper handlers for changed states
|
# Zookeeper handlers for changed states
|
||||||
@zk.DataWatch(self.zkey + '/state')
|
@zk.DataWatch(self.zkey + '/state')
|
||||||
def watch_hypervisor_state(data, stat, event=""):
|
def watch_hypervisor_state(data, stat, event=""):
|
||||||
|
try:
|
||||||
self.state = data.decode('ascii')
|
self.state = data.decode('ascii')
|
||||||
|
except AttributeError:
|
||||||
|
self.state = 'stop'
|
||||||
|
|
||||||
if self.state == 'flush':
|
if self.state == 'flush':
|
||||||
self.flush()
|
self.flush()
|
||||||
if self.state == 'unflush':
|
if self.state == 'unflush':
|
||||||
|
@ -29,11 +33,17 @@ class NodeInstance(threading.Thread):
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/memfree')
|
@zk.DataWatch(self.zkey + '/memfree')
|
||||||
def watch_hypervisor_memfree(data, stat, event=""):
|
def watch_hypervisor_memfree(data, stat, event=""):
|
||||||
|
try:
|
||||||
self.memfree = data.decode('ascii')
|
self.memfree = data.decode('ascii')
|
||||||
|
except AttributeError:
|
||||||
|
self.memfree = 0
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/runningdomains')
|
@zk.DataWatch(self.zkey + '/runningdomains')
|
||||||
def watch_hypervisor_runningdomains(data, stat, event=""):
|
def watch_hypervisor_runningdomains(data, stat, event=""):
|
||||||
|
try:
|
||||||
self.domain_list = data.decode('ascii').split()
|
self.domain_list = data.decode('ascii').split()
|
||||||
|
except AttributeError:
|
||||||
|
self.domain_list = []
|
||||||
|
|
||||||
# Get value functions
|
# Get value functions
|
||||||
def getfreemem(self):
|
def getfreemem(self):
|
||||||
|
|
Loading…
Reference in New Issue