From 79eb994a5e44c120f966772a8c9fe4224d3424c2 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 7 Nov 2022 11:59:53 -0500 Subject: [PATCH] Ensure equality of none and None for selector --- api-daemon/pvcapid/helper.py | 6 +++--- daemon-common/common.py | 2 +- daemon-common/vm.py | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/api-daemon/pvcapid/helper.py b/api-daemon/pvcapid/helper.py index 32913c04..ee3a6261 100755 --- a/api-daemon/pvcapid/helper.py +++ b/api-daemon/pvcapid/helper.py @@ -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 diff --git a/daemon-common/common.py b/daemon-common/common.py index 8d40808e..d193871e 100644 --- a/daemon-common/common.py +++ b/daemon-common/common.py @@ -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 diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 4ef3eb60..2c8c2a73 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -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."