Fix several bugs around load-based migrations

This commit is contained in:
Joshua Boniface 2020-01-29 17:22:29 -05:00
parent 65ddcee0db
commit 5d73974e95
2 changed files with 6 additions and 6 deletions

View File

@ -382,16 +382,16 @@ def findTargetNodeMem(zk_conn, node_limit, dom_uuid):
# via load average # via load average
def findTargetNodeLoad(zk_conn, node_limit, dom_uuid): def findTargetNodeLoad(zk_conn, node_limit, dom_uuid):
least_load = 9999 least_load = 9999.0
target_node = None target_node = None
node_list = getNodes(zk_conn, node_limit, dom_uuid) node_list = getNodes(zk_conn, node_limit, dom_uuid)
for node in node_list: for node in node_list:
load = int(zkhandler.readdata(zk_conn, '/nodes/{}/cpuload'.format(node))) load = float(zkhandler.readdata(zk_conn, '/nodes/{}/cpuload'.format(node)))
if load < least_load: if load < least_load:
least_load = load least_load = load
target_hypevisor = node target_node = node
return target_node return target_node

View File

@ -212,16 +212,16 @@ def findTargetNodeMem(zk_conn, node_limit, dom_uuid):
# via load average # via load average
def findTargetNodeLoad(zk_conn, node_limit, dom_uuid): def findTargetNodeLoad(zk_conn, node_limit, dom_uuid):
least_load = 9999 least_load = 9999.0
target_node = None target_node = None
node_list = getNodes(zk_conn, node_limit, dom_uuid) node_list = getNodes(zk_conn, node_limit, dom_uuid)
for node in node_list: for node in node_list:
load = int(zkhandler.readdata(zk_conn, '/nodes/{}/load'.format(node))) load = float(zkhandler.readdata(zk_conn, '/nodes/{}/cpuload'.format(node)))
if load < least_load: if load < least_load:
least_load = load least_load = load
target_hypevisor = node target_node = node
return target_node return target_node