Ensure equality of none and None for selector

This commit is contained in:
Joshua Boniface 2022-11-07 11:59:53 -05:00
parent d65f512897
commit 79eb994a5e
3 changed files with 12 additions and 8 deletions

View File

@ -538,10 +538,10 @@ def get_vm_meta(zkhandler, vm):
retcode = 200
retdata = {
"name": vm,
"node_limit": domain_node_limit,
"node_selector": domain_node_selector,
"node_limit": domain_node_limit.lower(),
"node_selector": domain_node_selector.lower(),
"node_autostart": domain_node_autostart,
"migration_method": domain_migrate_method,
"migration_method": domain_migrate_method.lower(),
}
return retdata, retcode

View File

@ -633,7 +633,7 @@ def findTargetNode(zkhandler, dom_uuid):
search_field = None
# If our search field is invalid, use the default
if search_field is None or search_field == "None":
if search_field is None or search_field in ["None", "none"]:
search_field = zkhandler.read("base.config.migration_target_selector")
# Execute the search

View File

@ -308,9 +308,9 @@ def define_vm(
(("domain.console.log", dom_uuid), ""),
(("domain.console.vnc", dom_uuid), ""),
(("domain.meta.autostart", dom_uuid), node_autostart),
(("domain.meta.migrate_method", dom_uuid), migration_method),
(("domain.meta.migrate_method", dom_uuid), str(migration_method).lower()),
(("domain.meta.node_limit", dom_uuid), formatted_node_limit),
(("domain.meta.node_selector", dom_uuid), node_selector),
(("domain.meta.node_selector", dom_uuid), str(node_selector).lower()),
(("domain.meta.tags", dom_uuid), ""),
(("domain.migrate.sync_lock", dom_uuid), ""),
]
@ -447,7 +447,9 @@ def modify_vm_metadata(
update_list.append((("domain.meta.node_limit", dom_uuid), node_limit))
if node_selector is not None:
update_list.append((("domain.meta.node_selector", dom_uuid), node_selector))
update_list.append(
(("domain.meta.node_selector", dom_uuid), str(node_selector).lower())
)
if node_autostart is not None:
update_list.append((("domain.meta.autostart", dom_uuid), node_autostart))
@ -456,7 +458,9 @@ def modify_vm_metadata(
update_list.append((("domain.profile", dom_uuid), provisioner_profile))
if migration_method is not None:
update_list.append((("domain.meta.migrate_method", dom_uuid), migration_method))
update_list.append(
(("domain.meta.migrate_method", dom_uuid), str(migration_method).lower())
)
if len(update_list) < 1:
return False, "ERROR: No updates to apply."