Fix bugs with bad strings
This commit is contained in:
parent
01c8986381
commit
116013695f
|
@ -293,13 +293,15 @@ def getPrimaryNode(zk_conn):
|
||||||
def findTargetNode(zk_conn, 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(dom_uuid)).split(',')
|
||||||
|
if not any(node_limit):
|
||||||
|
node_limit = None
|
||||||
except:
|
except:
|
||||||
node_limit = None
|
node_limit = 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(dom_uuid))
|
||||||
except:
|
except:
|
||||||
search_field = 'mem'
|
search_field = 'mem'
|
||||||
|
|
||||||
|
|
|
@ -142,17 +142,17 @@ def removeIPAddress(ipaddr, cidrnetmask, dev):
|
||||||
def findTargetNode(zk_conn, config, dom_uuid):
|
def findTargetNode(zk_conn, config, 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(dom_uuid)).split(',')
|
||||||
except:
|
except:
|
||||||
node_limit = None
|
node_limit = None
|
||||||
zkhandler.writedata(zk_conn, { '/domains/{}/node_limit'.format(node): 'None' })
|
zkhandler.writedata(zk_conn, { '/domains/{}/node_limit'.format(dom_uuid): '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(dom_uuid))
|
||||||
except:
|
except:
|
||||||
search_field = config.migration_target_selector
|
search_field = config.migration_target_selector
|
||||||
zkhandler.writedata(zk_conn, { '/domains/{}/node_selector'.format(node): config.migration_target_selector })
|
zkhandler.writedata(zk_conn, { '/domains/{}/node_selector'.format(dom_uuid): config.migration_target_selector })
|
||||||
|
|
||||||
# Execute the search
|
# Execute the search
|
||||||
if search_field == 'mem':
|
if search_field == 'mem':
|
||||||
|
|
Loading…
Reference in New Issue