Fix minor bugs
This commit is contained in:
parent
18fc49fc6c
commit
75d95bbef7
|
@ -290,20 +290,18 @@ def getPrimaryNode(zk_conn):
|
||||||
#
|
#
|
||||||
# Find a migration target
|
# Find a migration target
|
||||||
#
|
#
|
||||||
def findTargetNode(zk_conn, config, dom_uuid):
|
def findTargetNode(zk_conn, dom_uuid):
|
||||||
# Determine VM node limits; set config value if read fails
|
# Determine VM node limits; set config value if read fails
|
||||||
try:
|
try:
|
||||||
node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(node)).split(',')
|
node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(node)).split(',')
|
||||||
except:
|
except:
|
||||||
node_limit = None
|
node_limit = None
|
||||||
zkhandler.writedata(zk_conn, { '/domains/{}/node_limit'.format(node): 'None' })
|
|
||||||
|
|
||||||
# Determine VM search field or use default; set config value if read fails
|
# Determine VM search field or use default; set config value if read fails
|
||||||
try:
|
try:
|
||||||
search_field = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(node)).split(',')
|
search_field = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(node)).split(',')
|
||||||
except:
|
except:
|
||||||
search_field = config.migration_target_selector
|
search_field = 'mem'
|
||||||
zkhandler.writedata(zk_conn, { '/domains/{}/node_selector'.format(node): config.migration_target_selector })
|
|
||||||
|
|
||||||
# Execute the search
|
# Execute the search
|
||||||
if search_field == 'mem':
|
if search_field == 'mem':
|
||||||
|
|
|
@ -170,7 +170,7 @@ def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node
|
||||||
dom_name = parsed_xml.name.text
|
dom_name = parsed_xml.name.text
|
||||||
|
|
||||||
if not target_node:
|
if not target_node:
|
||||||
target_node = common.findTargetNode(zk_conn, selector, dom_uuid)
|
target_node = common.findTargetNode(zk_conn, dom_uuid)
|
||||||
else:
|
else:
|
||||||
# Verify node is valid
|
# Verify node is valid
|
||||||
valid_node = common.verifyNode(zk_conn, target_node)
|
valid_node = common.verifyNode(zk_conn, target_node)
|
||||||
|
|
Loading…
Reference in New Issue