Enable CSIT deployments to use NFS backend
[apex.git] / apex / overcloud / deploy.py
index dd476b6..e8547d8 100644 (file)
@@ -72,8 +72,6 @@ OVS_PERF_MAP = {
     'NeutronDpdkMemoryChannels': 'memory_channels'
 }
 
-OVS_NSH_KMOD_RPM = "openvswitch-kmod-2.6.1-1.el7.centos.x86_64.rpm"
-OVS_NSH_RPM = "openvswitch-2.6.1-1.el7.centos.x86_64.rpm"
 ODL_NETVIRT_VPP_RPM = "/root/opendaylight-7.0.0-0.1.20170531snap665.el7" \
                       ".noarch.rpm"
 
@@ -209,6 +207,8 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir,
             else:
                 deploy_options.append(os.path.join(con.THT_ENV_DIR, v))
 
+    # TODO(trozet) Fix this check to look for if ceph is in controller services
+    # and not use name of the file
     if ds_opts['ceph'] and 'csit' not in env_file:
         prep_storage_env(ds, ns, virtual, tmp_dir)
         deploy_options.append(os.path.join(con.THT_ENV_DIR,
@@ -361,14 +361,7 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
 
     if dataplane == 'ovs':
         if ds_opts['sfc']:
-            virt_cmds.extend([
-                {con.VIRT_RUN_CMD: "yum -y install "
-                                   "/root/ovs/rpm/rpmbuild/RPMS/x86_64/"
-                                   "{}".format(OVS_NSH_KMOD_RPM)},
-                {con.VIRT_RUN_CMD: "yum downgrade -y "
-                                   "/root/ovs/rpm/rpmbuild/RPMS/x86_64/"
-                                   "{}".format(OVS_NSH_RPM)}
-            ])
+            oc_builder.inject_ovs_nsh(tmp_oc_image, tmp_dir)
         elif sdn == 'opendaylight':
             # FIXME(trozet) remove this after RDO is updated with fix for
             # https://bugzilla.redhat.com/show_bug.cgi?id=1544892
@@ -382,6 +375,7 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
                 {con.VIRT_RUN_CMD: "yum downgrade -y /root/{}".format(
                     ovs_file)}
             ])
+
     if dataplane == 'fdio':
         # Patch neutron with using OVS external interface for router
         # and add generic linux NS interface driver
@@ -395,9 +389,9 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
                                    "/root/nosdn_vpp_rpms/*.rpm"}
             ])
 
+    undercloud_admin_ip = ns['networks'][con.ADMIN_NETWORK][
+        'installer_vm']['ip']
     if sdn == 'opendaylight':
-        undercloud_admin_ip = ns['networks'][con.ADMIN_NETWORK][
-            'installer_vm']['ip']
         oc_builder.inject_opendaylight(
             odl_version=ds_opts['odl_version'],
             image=tmp_oc_image,
@@ -440,6 +434,23 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
     virt_cmds.append(
         {con.VIRT_RUN_CMD: "crudini --del {} Unit "
                            "ConditionPathExists".format(dhcp_unit)})
+    # Prep for NFS
+    virt_cmds.extend([
+        {con.VIRT_INSTALL: "nfs-utils"},
+        {con.VIRT_RUN_CMD: "ln -s /usr/lib/systemd/system/nfs-server.service "
+                           "/etc/systemd/system/multi-user.target.wants/"
+                           "nfs-server.service"},
+        {con.VIRT_RUN_CMD: "mkdir -p /root/nfs/glance"},
+        {con.VIRT_RUN_CMD: "mkdir -p /root/nfs/cinder"},
+        {con.VIRT_RUN_CMD: "mkdir -p /root/nfs/nova"},
+        {con.VIRT_RUN_CMD: "echo '/root/nfs/glance *(rw,sync,"
+                           "no_root_squash,no_acl)' > /etc/exports"},
+        {con.VIRT_RUN_CMD: "echo '/root/nfs/cinder *(rw,sync,"
+                           "no_root_squash,no_acl)' >> /etc/exports"},
+        {con.VIRT_RUN_CMD: "echo '/root/nfs/nova *(rw,sync,"
+                           "no_root_squash,no_acl)' >> /etc/exports"},
+        {con.VIRT_RUN_CMD: "exportfs -avr"},
+    ])
     virt_utils.virt_customize(virt_cmds, tmp_oc_image)
     logging.info("Overcloud image customization complete")
     return patched_containers
@@ -718,6 +729,10 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir):
                          "services")
 
     logging.info("opnfv-environment file written to {}".format(tmp_opnfv_env))
+    with open(tmp_opnfv_env, 'r') as fh:
+        logging.debug("opnfv-environment content is : {}".format(
+            pprint.pformat(yaml.safe_load(fh.read()))
+        ))
 
 
 def generate_ceph_key():
@@ -871,8 +886,7 @@ def external_network_cmds(ns, ds):
                  "--allocation-pool start={},end={} --subnet-range " \
                  "{}".format(gateway, pool_start, pool_end, str(cidr))
     if external and cidr.version == 6:
-        subnet_cmd += ' --ip-version 6 --ipv6-ra-mode slaac ' \
-                      '--ipv6-address-mode slaac'
+        subnet_cmd += ' --ip-version 6'
     cmds.append(subnet_cmd)
     logging.debug("Neutron external network commands determined "
                   "as: {}".format(cmds))