Passing deploy_dir through to create_vm 41/40141/3
authorDan Radez <dradez@redhat.com>
Thu, 24 Aug 2017 18:03:43 +0000 (14:03 -0400)
committerDan Radez <dradez@redhat.com>
Mon, 28 Aug 2017 13:29:40 +0000 (09:29 -0400)
Change-Id: I07a1c899d43c5edf1054fc819fff4336d9b3ed16
Signed-off-by: Dan Radez <dradez@redhat.com>
apex/deploy.py
apex/undercloud/undercloud.py

index 6a08b36..7900170 100644 (file)
@@ -64,7 +64,8 @@ def validate_cross_settings(deploy_settings, net_settings, inventory):
     # "$tenant_nic_mapping_compute_members
 
 
-def build_vms(inventory, network_settings):
+def build_vms(inventory, network_settings,
+              template_dir='/usr/share/opnfv-apex'):
     """
     Creates VMs and configures vbmc and host
     :param inventory:
@@ -82,7 +83,8 @@ def build_vms(inventory, network_settings):
             name, volume_path,
             baremetal_interfaces=network_settings.enabled_network_list,
             memory=node['memory'], cpus=node['cpu'],
-            macs=[node['mac_address']])
+            macs=[node['mac_address']],
+            template_dir=template_dir)
         virt_utils.host_setup({name: node['pm_port']})
 
 
@@ -284,7 +286,7 @@ def main():
             uc_external = True
         if args.virtual:
             # create all overcloud VMs
-            build_vms(inventory, net_settings)
+            build_vms(inventory, net_settings, args.deploy_dir)
         else:
             # Attach interfaces to jumphost for baremetal deployment
             jump_networks = ['admin']
@@ -311,6 +313,7 @@ def main():
         else:
             root_pw = None
         undercloud = uc_lib.Undercloud(args.image_dir,
+                                       args.deploy_dir,
                                        root_pw=root_pw,
                                        external_network=uc_external)
         undercloud.start()
index 7efc2cb..a1af4d0 100644 (file)
@@ -27,13 +27,15 @@ class Undercloud:
     """
     This class represents an Apex Undercloud VM
     """
-    def __init__(self, image_path, root_pw=None, external_network=False):
+    def __init__(self, image_path, template_path,
+                 root_pw=None, external_network=False):
         self.ip = None
         self.root_pw = root_pw
         self.external_net = external_network
         self.volume = os.path.join(constants.LIBVIRT_VOLUME_PATH,
                                    'undercloud.qcow2')
         self.image_path = image_path
+        self.template_path = template_path
         self.vm = None
         if Undercloud._get_vm():
             logging.error("Undercloud VM already exists.  Please clean "
@@ -60,7 +62,8 @@ class Undercloud:
                                    direct_boot='overcloud-full',
                                    kernel_args=['console=ttyS0',
                                                 'root=/dev/sda'],
-                                   default_network=True)
+                                   default_network=True,
+                                   template_dir=self.template_path)
         self.setup_volumes()
         self.inject_auth()