Fix several bugs around load-based migrations
This commit is contained in:
parent
65ddcee0db
commit
5d73974e95
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue