summaryrefslogtreecommitdiffstats
path: root/func/spawn_vm.py
diff options
context:
space:
mode:
authorMofassir Arif <Mofassir_arif@dellteam.com>2015-12-22 04:17:57 -0800
committerMofassir Arif <Mofassir_arif@dellteam.com>2015-12-22 04:17:57 -0800
commit39342467e5e647ae605f40bed04c5a3b3bc50f5e (patch)
tree9c7b73c5e32a816c83db93bbac6aa3af80e7f9fa /func/spawn_vm.py
parent4b3e9b6cf97296dd591dc2cf95ead96ee60075f5 (diff)
Restructured QTIP directories and CLI
I have changed the arguments for the CLI and now QTIP takes a file along withthe name of the lab to run on Right now only the config files for the dell lab have been added, These will increase when we make QTIP available for other labs. I have also added the provision of changing the public network from the config file and some leftover files from previous verisons have been remove Change-Id: Ifeb01d80099eab06dc77a7b2e07097ebb17a13a2 Signed-off-by: Mofassir Arif <Mofassir_arif@dellteam.com>
Diffstat (limited to 'func/spawn_vm.py')
-rw-r--r--func/spawn_vm.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/func/spawn_vm.py b/func/spawn_vm.py
index e7947008..39587b34 100644
--- a/func/spawn_vm.py
+++ b/func/spawn_vm.py
@@ -26,8 +26,6 @@ class SpawnVM(Env_setup):
def __init__(self, vm_info):
print 'SpawnVM Class initiated'
-
- # def setupVM(self,vm_info):
vm_role_ip_dict = vm_info.copy()
print 'Generating Heat Template\n'
self._keystone_client = None
@@ -37,12 +35,12 @@ class SpawnVM(Env_setup):
nova =self. _get_nova_client()
azoneobj = create_zones()
azoneobj.create_agg(vm_info['availability_zone'])
-
self.Heat_template1 = self.HeatTemplate_vm(vm_info)
self.create_stack(vm_role_ip_dict, self.Heat_template1)
def HeatTemplate_vm(self, vm_params):
try:
+ Heat_Dic=''
with open('./heat/SampleHeat.yaml', 'r+') as H_temp:
Heat_Dic = yaml.load(H_temp)
except yaml.YAMLError as exc:
@@ -51,7 +49,6 @@ class SpawnVM(Env_setup):
print 'Error in qtip/heat/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1, mark.column + 1)
print 'EXITING PROGRAM. Correct File and restart'
sys.exit(0)
- #fopen = open('/root/.ssh/id_rsa.pub', 'r')
fopen = open('./data/QtipKey.pub', 'r')
fopenstr = fopen.read()
fopenstr = fopenstr.rstrip()
@@ -66,6 +63,10 @@ class SpawnVM(Env_setup):
'name': 'my_key'
}
}
+ Heat_Dic['parameters']['public_network'] = {
+ 'type': 'string',
+ 'default': vm_params['public_network'][0]
+ }
for x in range(1, len(vm_params['availability_zone']) + 1):
avail_zone = vm_params['availability_zone'][x - 1]
img = vm_params['OS_image'][x - 1]
@@ -215,11 +216,10 @@ class SpawnVM(Env_setup):
print '\nStack Creating Started\n'
- # try:
- heat.stacks.create(stack_name=stackname, template=Heat_template)
-
- #except:
- #print 'Create Failed :( '
+ try:
+ heat.stacks.create(stack_name=stackname, template=Heat_template)
+ except:
+ print 'Create Failed :( '
cluster_detail = heat.stacks.get(stackname)
while(cluster_detail.status != 'COMPLETE'):