diff --git a/client-common/vm.py b/client-common/vm.py index 16d70221..77e71c24 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -413,12 +413,12 @@ def move_vm(zk_conn, domain, target_node): # Verify node is valid valid_node = common.verifyNode(zk_conn, target_node) if not valid_node: - return False, 'Specified node "{}" is invalid.'.format(target_node) + return False, 'ERROR: Specified node "{}" is invalid.'.format(target_node) # Check if node is within the limit - limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(dom_uuid).split(',') - if target_node not in limit: - return False, 'Specified node "{}" is not in the allowed list of nodes for VM "{}".'.format(target_node, domain) + node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(dom_uuid)).split(',') + if node_limit and target_node not in node_limit: + return False, 'ERROR: Specified node "{}" is not in the allowed list of nodes for VM "{}".'.format(target_node, domain) # Verify if node is current node if target_node == current_node: @@ -473,12 +473,12 @@ def migrate_vm(zk_conn, domain, target_node, force_migrate, is_cli=False): # Verify node is valid valid_node = common.verifyNode(zk_conn, target_node) if not valid_node: - return False, 'Specified node "{}" is invalid.'.format(target_node) + return False, 'ERROR: Specified node "{}" is invalid.'.format(target_node) # Check if node is within the limit - limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(dom_uuid).split(',') - if target_node not in limit: - return False, 'Specified node "{}" is not in the allowed list of nodes for VM "{}".'.format(target_node, domain) + node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(dom_uuid)).split(',') + if node_limit and target_node not in node_limit: + return False, 'ERROR: Specified node "{}" is not in the allowed list of nodes for VM "{}".'.format(target_node, domain) # Verify if node is current node if target_node == current_node: