Make util support more than 10 compute nodes
[apex.git] / apex / builders / undercloud_builder.py
index 268bad7..4efd00d 100644 (file)
@@ -8,8 +8,11 @@
 ##############################################################################
 
 # Used to modify undercloud qcow2 image
+import logging
+import os
 
 from apex.common import constants as con
+from apex.common import utils
 from apex.virtual import utils as virt_utils
 
 
@@ -20,12 +23,8 @@ def add_upstream_packages(image):
     :return: None
     """
     virt_ops = list()
-    # FIXME(trozet): we have to lock to this beta ceph ansible package because
-    # the current RPM versioning is wrong and an older package has a higher
-    # version than this package.  We should change to just 'ceph-ansible'
-    # once the package/repo has been fixed.  Note: luminous is fine here
-    # because Apex will only support container deployment for Queens and later
     pkgs = [
+        'epel-release',
         'openstack-utils',
         'ceph-common',
         'python2-networking-sfc',
@@ -34,12 +33,29 @@ def add_upstream_packages(image):
         'docker-distribution',
         'openstack-tripleo-validations',
         'libguestfs-tools',
-        'http://mirror.centos.org/centos/7/storage/x86_64/ceph-luminous' +
-        '/ceph-ansible-3.1.0-0.beta3.1.el7.noarch.rpm'
+        'ceph-ansible',
+        'python-tripleoclient'
     ]
 
     for pkg in pkgs:
         virt_ops.append({con.VIRT_INSTALL: pkg})
     virt_utils.virt_customize(virt_ops, image)
 
+
+def inject_calipso_installer(tmp_dir, image):
+    """
+    Downloads calipso installer script from artifacts.opnfv.org
+    and puts it under /root/ for further installation process.
+    :return:
+    """
+    calipso_file = os.path.basename(con.CALIPSO_INSTALLER_URL)
+    calipso_url = con.CALIPSO_INSTALLER_URL.replace(calipso_file, '')
+    utils.fetch_upstream_and_unpack(tmp_dir, calipso_url, [calipso_file])
+
+    virt_ops = [
+        {con.VIRT_UPLOAD: "{}/{}:/root/".format(tmp_dir, calipso_file)}]
+    virt_utils.virt_customize(virt_ops, image)
+    logging.info("Calipso injected into {}".format(image))
+
+# TODO(trozet): add unit testing for calipso injector
 # TODO(trozet): add rest of build for undercloud here as well