Fix
This commit is contained in:
parent
0a8faac2aa
commit
3b319fa498
|
@ -14,6 +14,27 @@ class NodeInstance(threading.Thread):
|
||||||
self.node_list = node_list
|
self.node_list = node_list
|
||||||
self.domainlist = []
|
self.domainlist = []
|
||||||
|
|
||||||
|
@zk.DataWatch(self.zkey + '/state')
|
||||||
|
def watch_state(data, stat):
|
||||||
|
self.state = data.decode('ascii')
|
||||||
|
print("Version: %s, data: %s" % (stat.version, self.state))
|
||||||
|
|
||||||
|
@zk.DataWatch(self.zkey + '/cpucount')
|
||||||
|
def watch_cpucount(data, stat):
|
||||||
|
self.cpucount = data.decode('ascii')
|
||||||
|
print("Version: %s, data: %s" % (stat.version, self.cpucount))
|
||||||
|
|
||||||
|
@zk.DataWatch(self.zkey + '/cpuload')
|
||||||
|
def watch_cpuload(data, stat):
|
||||||
|
self.cpuload = data.decode('ascii')
|
||||||
|
print("Version: %s, data: %s" % (stat.version, self.cpuload))
|
||||||
|
|
||||||
|
@zk.DataWatch(self.zkey + '/memfree')
|
||||||
|
def watch_memfree(data, stat):
|
||||||
|
self.memfree = data.decode('ascii')
|
||||||
|
print("Version: %s, data: %s" % (stat.version, self.memfree))
|
||||||
|
|
||||||
|
|
||||||
# Get value functions
|
# Get value functions
|
||||||
def getfreemem(self):
|
def getfreemem(self):
|
||||||
return self.memfree
|
return self.memfree
|
||||||
|
@ -57,27 +78,6 @@ class NodeInstance(threading.Thread):
|
||||||
else:
|
else:
|
||||||
self.setup_remote_node()
|
self.setup_remote_node()
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/state')
|
|
||||||
def watch_state(data, stat):
|
|
||||||
self.state = data.decode('ascii')
|
|
||||||
print("Version: %s, data: %s" % (stat.version, self.state))
|
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/cpucount')
|
|
||||||
def watch_cpucount(data, stat):
|
|
||||||
self.cpucount = data.decode('ascii')
|
|
||||||
print("Version: %s, data: %s" % (stat.version, self.cpucount))
|
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/cpuload')
|
|
||||||
def watch_cpuload(data, stat):
|
|
||||||
self.cpuload = data.decode('ascii')
|
|
||||||
print("Version: %s, data: %s" % (stat.version, self.cpuload))
|
|
||||||
|
|
||||||
@zk.DataWatch(self.zkey + '/memfree')
|
|
||||||
def watch_memfree(data, stat):
|
|
||||||
self.memfree = data.decode('ascii')
|
|
||||||
print("Version: %s, data: %s" % (stat.version, self.memfree))
|
|
||||||
|
|
||||||
|
|
||||||
def setup_local_node(self):
|
def setup_local_node(self):
|
||||||
# Connect to libvirt
|
# Connect to libvirt
|
||||||
libvirt_name = "qemu:///system"
|
libvirt_name = "qemu:///system"
|
||||||
|
|
Loading…
Reference in New Issue