From 682c6cecf790892141639e572b469d82d7e5eaac Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 8 Jan 2020 17:46:30 -0500 Subject: [PATCH] Support overriding initial state of VM Still defaults to "stop" state unless overridden in the calling function. --- client-common/vm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client-common/vm.py b/client-common/vm.py index ad1a6597..8be494a3 100644 --- a/client-common/vm.py +++ b/client-common/vm.py @@ -157,7 +157,7 @@ def flush_locks(zk_conn, domain): return success, message -def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node_autostart, profile=None): +def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node_autostart, profile=None, initial_state='stop'): # Parse the XML data try: parsed_xml = lxml.objectify.fromstring(config_data) @@ -200,7 +200,7 @@ def define_vm(zk_conn, config_data, target_node, node_limit, node_selector, node # Add the new domain to Zookeeper zkhandler.writedata(zk_conn, { '/domains/{}'.format(dom_uuid): dom_name, - '/domains/{}/state'.format(dom_uuid): 'stop', + '/domains/{}/state'.format(dom_uuid): initial_state, '/domains/{}/node'.format(dom_uuid): target_node, '/domains/{}/lastnode'.format(dom_uuid): '', '/domains/{}/node_limit'.format(dom_uuid): formatted_node_limit,