Fixes permissions issue for Nova with NFS
[apex.git] / apex / overcloud / deploy.py
index 5fdc691..f40c8bd 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"
 
@@ -154,7 +152,7 @@ def get_docker_sdn_files(ds_opts):
     :return: list of docker THT env files for an SDN
     """
     docker_services = con.VALID_DOCKER_SERVICES
-    tht_dir = con.THT_DOCKER_ENV_DIR[ds_opts['os_version']]
+    tht_dir = con.THT_DOCKER_ENV_DIR
     sdn_env_list = build_sdn_env_list(ds_opts, SDN_FILE_MAP)
     for i, sdn_file in enumerate(sdn_env_list):
         sdn_base = os.path.basename(sdn_file)
@@ -196,8 +194,6 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir,
         sdn_docker_files = get_docker_sdn_files(ds_opts)
         for sdn_docker_file in sdn_docker_files:
             deploy_options.append(sdn_docker_file)
-        if sdn_docker_files:
-            deploy_options.append('sdn-images.yaml')
     else:
         deploy_options += build_sdn_env_list(ds_opts, SDN_FILE_MAP)
 
@@ -209,6 +205,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,
@@ -249,12 +247,16 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir,
     if net_data:
         cmd += ' --networks-file network_data.yaml'
     libvirt_type = 'kvm'
-    if virtual:
+    if virtual and (platform.machine() != 'aarch64'):
         with open('/sys/module/kvm_intel/parameters/nested') as f:
             nested_kvm = f.read().strip()
             if nested_kvm != 'Y':
                 libvirt_type = 'qemu'
+    elif virtual and (platform.machine() == 'aarch64'):
+        libvirt_type = 'qemu'
     cmd += ' --libvirt-type {}'.format(libvirt_type)
+    if platform.machine() == 'aarch64':
+        cmd += ' --override-ansible-cfg /home/stack/ansible.cfg '
     logging.info("Deploy command set: {}".format(cmd))
 
     with open(os.path.join(tmp_dir, 'deploy_command'), 'w') as fh:
@@ -361,14 +363,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 +377,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
@@ -440,6 +436,26 @@ 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: "chmod 777 /root/nfs/glance"},
+        {con.VIRT_RUN_CMD: "chmod 777 /root/nfs/cinder"},
+        {con.VIRT_RUN_CMD: "chmod 777 /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
@@ -875,8 +891,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))