Define with profile and allow options

This commit is contained in:
Joshua Boniface 2019-12-11 17:05:05 -05:00
parent 88a181b20d
commit 88924497c2
1 changed files with 13 additions and 6 deletions

View File

@ -669,7 +669,7 @@ def clone_vm(self, vm_name, vm_profile):
# #
# Main VM provisioning function - executed by the Celery worker # Main VM provisioning function - executed by the Celery worker
# #
def create_vm(self, vm_name, vm_profile): def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
# Runtime imports # Runtime imports
import time import time
import importlib import importlib
@ -1108,10 +1108,17 @@ def create_vm(self, vm_name, vm_profile):
self.update_state(state='RUNNING', meta={'current': 9, 'total': 10, 'status': 'Defining and starting VM on the cluster'}) self.update_state(state='RUNNING', meta={'current': 9, 'total': 10, 'status': 'Defining and starting VM on the cluster'})
time.sleep(1) time.sleep(1)
if start_vm and not define_vm:
start_vm = False
if define_vm or start_vm:
print("Defining and starting VM on cluster") print("Defining and starting VM on cluster")
retcode, retmsg = pvc_vm.define_vm(zk_conn, vm_schema, target_node, vm_data['system_details']['node_limit'].split(','), vm_data['system_details']['node_selector'], vm_data['system_details']['start_with_node']) if define_vm:
retcode, retmsg = pvc_vm.define_vm(zk_conn, vm_schema, target_node, vm_data['system_details']['node_limit'].split(','), vm_data['system_details']['node_selector'], vm_data['system_details']['start_with_node'], vm_profile)
print(retmsg) print(retmsg)
if start_vm:
retcode, retmsg = pvc_vm.start_vm(zk_conn, vm_name) retcode, retmsg = pvc_vm.start_vm(zk_conn, vm_name)
print(retmsg) print(retmsg)