From 8dc0c8f0ac21a8f4caa05dc14d4d41c70447ded2 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 12 Oct 2019 01:36:50 -0400 Subject: [PATCH] Fix minor bugs --- client-cli/pvc.py | 4 ++-- client-common/common.py | 14 +++++++++++--- client-common/vm.py | 2 +- node-daemon/pvcd/fencing.py | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 37b7719e..66e94b75 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -229,7 +229,7 @@ def cli_vm(): help='Method to determine optimal target node during autoselect; saved with VM.' ) @click.option( - '-a'/'-A', '--autostart'/'--no-autostart', 'node_autostart', is_flag=True, default=False, + '-a/-A', '--autostart/--no-autostart', 'node_autostart', is_flag=True, default=False, help='Start VM automatically on next unflush/ready state of home node; unset by daemon once used.' ) @click.argument( @@ -262,7 +262,7 @@ def vm_define(config, target_node, node_limit, node_selector, node_autostart): help='Method to determine optimal target node during autoselect; saved with VM.' ) @click.option( - '-a'/'-A', '--autostart'/'--no-autostart', 'node_autostart', is_flag=True, default=None, + '-a/-A', '--autostart/--no-autostart', 'node_autostart', is_flag=True, default=None, help='Start VM automatically on next unflush/ready state of home node; unset by daemon once used.' ) @click.argument( diff --git a/client-common/common.py b/client-common/common.py index 397ad72c..1354f119 100644 --- a/client-common/common.py +++ b/client-common/common.py @@ -164,9 +164,17 @@ def getInformationFromXML(zk_conn, uuid): domain_lastnode = zkhandler.readdata(zk_conn, '/domains/{}/lastnode'.format(uuid)) domain_failedreason = zkhandler.readdata(zk_conn, '/domains/{}/failedreason'.format(uuid)) - domain_node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(uuid)) - domain_node_selector = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(uuid)) - domain_node_autostart = zkhandler.readdata(zk_conn, '/domains/{}/node_autostart'.format(uuid)) + try: + domain_node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(uuid)) + domain_node_selector = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(uuid)) + domain_node_autostart = zkhandler.readdata(zk_conn, '/domains/{}/node_autostart'.format(uuid)) + except: + domain_node_limit = None + domain_node_selector = None + domain_node_autostart = None + + if not domain_node_limit: + domain_node_limit = 'False' parsed_xml = getDomainXML(zk_conn, uuid) diff --git a/client-common/vm.py b/client-common/vm.py index e56cb84a..96a6e60e 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -707,8 +707,8 @@ def format_info(zk_conn, domain_information, long_output): ainformation.append('{}Failure reason:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['failed_reason'])) ainformation.append('') - ainformation.append('{}Node limit:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_limit'])) ainformation.append('{}Migration selector:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_selector'])) + ainformation.append('{}Node limit:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_limit'])) ainformation.append('{}Autostart:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_autostart'])) # Network list diff --git a/node-daemon/pvcd/fencing.py b/node-daemon/pvcd/fencing.py index afecd284..f53a6a14 100644 --- a/node-daemon/pvcd/fencing.py +++ b/node-daemon/pvcd/fencing.py @@ -94,7 +94,7 @@ def migrateFromFencedNode(zk_conn, node_name, config, logger): zkhandler.writedata(zk_conn, { '/domains/{}/state'.format(dom_uuid): 'stopped', '/domains/{}/node_autostart'.format(dom_uuid): 'True' - } + }) # Set node in flushed state for easy remigrating when it comes back zkhandler.writedata(zk_conn, { '/nodes/{}/domainstate'.format(node_name): 'flushed' })