Increasing loop device size for baremetal deployments
[apex.git] / apex / overcloud / deploy.py
index 92b42ff..dc7d84f 100644 (file)
@@ -75,6 +75,8 @@ 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"
 
+LOOP_DEVICE_SIZE = "10G"
+
 LOSETUP_SERVICE = """[Unit]
 Description=Setup loop devices
 Before=network.target
@@ -406,10 +408,16 @@ def prep_image(ds, ns, img, tmp_dir, root_pw=None, docker_tag=None,
         virt_cmds.extend([
             {con.VIRT_UPLOAD: "{}:/usr/lib/systemd/system/".format(tmp_losetup)
              },
-            {con.VIRT_RUN_CMD: 'truncate /srv/data.img --size 10G'},
+            {con.VIRT_RUN_CMD: 'truncate /srv/data.img --size {}'
+                .format(LOOP_DEVICE_SIZE)},
             {con.VIRT_RUN_CMD: 'systemctl daemon-reload'},
             {con.VIRT_RUN_CMD: 'systemctl enable losetup.service'},
         ])
+    # TODO(trozet) remove this after LP#173474 is fixed
+    dhcp_unit = '/usr/lib/systemd/system/dhcp-interface@.service'
+    virt_cmds.append(
+        {con.VIRT_RUN_CMD: "crudini --del {} Unit "
+                           "ConditionPathExists".format(dhcp_unit)})
     virt_utils.virt_customize(virt_cmds, tmp_oc_image)
     logging.info("Overcloud image customization complete")
     return patched_containers
@@ -491,6 +499,10 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir):
     else:
         perf = False
 
+    tenant_settings = ns['networks']['tenant']
+    tenant_vlan_enabled = 'tenant' in ns.enabled_network_list and \
+        ns['networks']['tenant'].get('segmentation_type') == 'vlan'
+
     # Modify OPNFV environment
     # TODO: Change to build a dict and outputting yaml rather than parsing
     for line in fileinput.input(tmp_opnfv_env, inplace=True):
@@ -514,6 +526,46 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir):
                 ds_opts['dataplane'] == 'ovs_dpdk':
             output_line = '  OS::TripleO::ComputeExtraConfigPre: ' \
                           './ovs-dpdk-preconfig.yaml'
+        elif 'NeutronNetworkVLANRanges' in line:
+            vlan_setting = ''
+            if tenant_vlan_enabled:
+                if ns['networks']['tenant']['overlay_id_range']:
+                    vlan_setting = ns['networks']['tenant']['overlay_id_range']
+                    if 'datacentre' not in vlan_setting:
+                        vlan_setting += ',datacentre:1:1000'
+            # SRIOV networks are VLAN based provider networks. In order to
+            # simplify the deployment, nfv_sriov will be the default physnet.
+            # VLANs are not needed in advance, and the user will have to create
+            # the network specifying the segmentation-id.
+            if ds_opts['sriov']:
+                if vlan_setting:
+                    vlan_setting += ",nfv_sriov"
+                else:
+                    vlan_setting = "datacentre:1:1000,nfv_sriov"
+            if vlan_setting:
+                output_line = "  NeutronNetworkVLANRanges: " + vlan_setting
+        elif 'NeutronBridgeMappings' in line and tenant_vlan_enabled:
+            if tenant_settings['overlay_id_range']:
+                physnets = tenant_settings['overlay_id_range'].split(',')
+                output_line = "  NeutronBridgeMappings: "
+                for physnet in physnets:
+                    physnet_name = physnet.split(':')[0]
+                    if physnet_name != 'datacentre':
+                        output_line += "{}:br-vlan,".format(physnet_name)
+                output_line += "datacentre:br-ex"
+        elif 'OpenDaylightProviderMappings' in line and tenant_vlan_enabled \
+                and ds_opts['sdn_controller'] == 'opendaylight':
+            if tenant_settings['overlay_id_range']:
+                physnets = tenant_settings['overlay_id_range'].split(',')
+                output_line = "  OpenDaylightProviderMappings: "
+                for physnet in physnets:
+                    physnet_name = physnet.split(':')[0]
+                    if physnet_name != 'datacentre':
+                        output_line += "{}:br-vlan,".format(physnet_name)
+                output_line += "datacentre:br-ex"
+        elif 'NeutronNetworkType' in line and tenant_vlan_enabled:
+            output_line = "  NeutronNetworkType: vlan\n" \
+                          "  NeutronTunnelTypes: ''"
 
         if ds_opts['sdn_controller'] == 'opendaylight' and \
                 'odl_vpp_routing_node' in ds_opts:
@@ -539,13 +591,6 @@ def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir):
             elif 'ComputeServices' in line:
                 output_line = ("  ComputeServices:\n"
                                "    - OS::TripleO::Services::NeutronDhcpAgent")
-        # SRIOV networks are VLAN based provider networks. In order to simplify
-        # the deployment, nfv_sriov will be the default physnet. VLANs are not
-        # needed in advance, and the user will have to create the network
-        # specifying the segmentation-id.
-        if ds_opts['sriov']:
-            if 'NeutronNetworkVLANRanges' in line:
-                output_line = ("{},nfv_sriov'".format(line[:-1]))
 
         if perf:
             for role in 'NovaCompute', 'Controller':
@@ -652,15 +697,7 @@ def prep_storage_env(ds, ns, virtual, tmp_dir):
             print(line)
 
     if ds_opts['containers']:
-        undercloud_admin_ip = ns['networks'][con.ADMIN_NETWORK][
-            'installer_vm']['ip']
-        ceph_version = con.CEPH_VERSION_MAP[ds_opts['os_version']]
-        docker_image = "{}:8787/ceph/daemon:tag-build-master-" \
-                       "{}-centos-7".format(undercloud_admin_ip,
-                                            ceph_version)
-        ceph_params = {
-            'DockerCephDaemonImage': docker_image,
-        }
+        ceph_params = {}
 
         # max pgs allowed are calculated as num_mons * 200. Therefore we
         # set number of pgs and pools so that the total will be less: