Fix minor bugs

This commit is contained in:
Joshua Boniface 2019-10-12 02:03:23 -04:00
parent 18fc49fc6c
commit 75d95bbef7
2 changed files with 3 additions and 5 deletions

View File

@ -290,20 +290,18 @@ def getPrimaryNode(zk_conn):
#
# 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
try:
node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(node)).split(',')
except:
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
try:
search_field = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(node)).split(',')
except:
search_field = config.migration_target_selector
zkhandler.writedata(zk_conn, { '/domains/{}/node_selector'.format(node): config.migration_target_selector })
search_field = 'mem'
# Execute the search
if search_field == 'mem':

View File

@ -170,7 +170,7 @@ def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node
dom_name = parsed_xml.name.text
if not target_node:
target_node = common.findTargetNode(zk_conn, selector, dom_uuid)
target_node = common.findTargetNode(zk_conn, dom_uuid)
else:
# Verify node is valid
valid_node = common.verifyNode(zk_conn, target_node)