Merge "Workaround for vhost-user binding" into stable/danube
[apex.git] / lib / overcloud-deploy-functions.sh
1 #!/usr/bin/env bash
2 ##############################################################################
3 # Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 ##preping it for deployment and launch the deploy
12 ##params: none
13 function overcloud_deploy {
14   local num_compute_nodes
15   local num_control_nodes
16   local dpdk_cores pmd_cores socket_mem ovs_dpdk_perf_flag ovs_option_heat_arr
17   declare -A ovs_option_heat_arr
18
19   ovs_option_heat_arr['dpdk_cores']=OvsDpdkCoreList
20   ovs_option_heat_arr['pmd_cores']=PmdCoreList
21   ovs_option_heat_arr['socket_memory']=OvsDpdkSocketMemory
22
23   # OPNFV Default Environment and Network settings
24   DEPLOY_OPTIONS+=" -e ${ENV_FILE}"
25   DEPLOY_OPTIONS+=" -e network-environment.yaml"
26
27   # Custom Deploy Environment Templates
28   if [[ "${#deploy_options_array[@]}" -eq 0 || "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
29     if [ "${deploy_options_array['sfc']}" == 'True' ]; then
30       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sfc.yaml"
31     elif [ "${deploy_options_array['vpn']}" == 'True' ]; then
32       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-bgpvpn.yaml"
33       if [ "${deploy_options_array['gluon']}" == 'True' ]; then
34         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/services/gluon.yaml"
35       fi
36     elif [ "${deploy_options_array['vpp']}" == 'True' ]; then
37       if [ "${deploy_options_array['odl_vpp_netvirt']}" == "True" ]; then
38         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-netvirt-vpp.yaml"
39       elif [ "${deploy_options_array['sdn_l3']}" == "True" ]; then
40         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-honeycomb.yaml"
41       else
42         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-honeycomb-l2.yaml"
43       fi
44     else
45       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-l3.yaml"
46     fi
47     SDN_IMAGE=opendaylight
48   elif [ "${deploy_options_array['sdn_controller']}" == 'opendaylight-external' ]; then
49     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml"
50     SDN_IMAGE=opendaylight
51   elif [ "${deploy_options_array['sdn_controller']}" == 'onos' ]; then
52     if [ "${deploy_options_array['sfc']}" == 'True' ]; then
53       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-onos-sfc.yaml"
54     else
55       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-onos.yaml"
56     fi
57     SDN_IMAGE=onos
58   elif [ "${deploy_options_array['sdn_controller']}" == 'ovn' ]; then
59     if [[ "$ha_enabled" == "True" ]]; then
60       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ml2-ovn-ha.yaml"
61       echo "${red}OVN HA support is not not supported... exiting.${reset}"
62       exit 1
63     else
64       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ml2-ovn.yaml"
65     fi
66     SDN_IMAGE=opendaylight
67   elif [ "${deploy_options_array['sdn_controller']}" == 'opencontrail' ]; then
68     echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}"
69     exit 1
70   elif [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'False' ]]; then
71     echo -e "${blue}INFO: SDN Controller disabled...will deploy nosdn scenario${reset}"
72     if [ "${deploy_options_array['vpp']}" == 'True' ]; then
73       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ml2-vpp.yaml"
74     elif [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then
75       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ovs-dpdk.yaml"
76     fi
77     SDN_IMAGE=opendaylight
78   else
79     echo "${red}Invalid sdn_controller: ${deploy_options_array['sdn_controller']}${reset}"
80     echo "${red}Valid choices are opendaylight, opendaylight-external, onos, opencontrail, False, or null${reset}"
81     exit 1
82   fi
83
84   # Enable Tacker
85   if [ "${deploy_options_array['tacker']}" == 'True' ]; then
86     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/enable_tacker.yaml"
87   fi
88
89   # Enable Congress
90   if [ "${deploy_options_array['congress']}" == 'True' ]; then
91     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/enable_congress.yaml"
92   fi
93
94   # Enable Real Time Kernel (kvm4nfv)
95   if [ "${deploy_options_array['rt_kvm']}" == 'True' ]; then
96     DEPLOY_OPTIONS+=" -e /home/stack/enable_rt_kvm.yaml"
97   fi
98
99   # Make sure the correct overcloud image is available
100   if [ ! -f $IMAGES/overcloud-full-${SDN_IMAGE}.qcow2 ]; then
101       echo "${red} $IMAGES/overcloud-full-${SDN_IMAGE}.qcow2 is required to execute your deployment."
102       echo "Please install the opnfv-apex package to provide this overcloud image for deployment.${reset}"
103       exit 1
104   fi
105
106   echo "Copying overcloud image to Undercloud"
107   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "rm -f overcloud-full.qcow2"
108   scp ${SSH_OPTIONS[@]} $IMAGES/overcloud-full-${SDN_IMAGE}.qcow2 "stack@$UNDERCLOUD":overcloud-full.qcow2
109
110   # disable neutron openvswitch agent from starting
111   if [[ -n "${deploy_options_array['sdn_controller']}" && "${deploy_options_array['sdn_controller']}" != 'False' ]]; then
112       echo -e "${blue}INFO: Disabling neutron-openvswitch-agent from systemd${reset}"
113       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
114       LIBGUESTFS_BACKEND=direct virt-customize --run-command "rm -f /etc/systemd/system/multi-user.target.wants/neutron-openvswitch-agent.service" \
115                                                --run-command "rm -f /usr/lib/systemd/system/neutron-openvswitch-agent.service" \
116                                                -a overcloud-full.qcow2
117 EOI
118   fi
119
120   if [ "${deploy_options_array['vpn']}" == 'True' ]; then
121       echo -e "${blue}INFO: Enabling ZRPC and Quagga${reset}"
122       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
123       LIBGUESTFS_BACKEND=direct virt-customize \
124          --run-command "systemctl enable zrpcd" \
125          -a overcloud-full.qcow2
126 EOI
127   fi
128
129   # Install ovs-dpdk inside the overcloud image if it is enabled.
130   if [[ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' || "${deploy_options_array['dataplane']}" == 'fdio' ]]; then
131     # install dpdk packages before ovs
132     echo -e "${blue}INFO: Enabling kernel modules for dpdk inside overcloud image${reset}"
133
134     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
135       cat << EOF > vfio_pci.modules
136 #!/bin/bash
137 exec /sbin/modprobe vfio_pci >/dev/null 2>&1
138 EOF
139
140       cat << EOF > uio_pci_generic.modules
141 #!/bin/bash
142 exec /sbin/modprobe uio_pci_generic >/dev/null 2>&1
143 EOF
144
145       LIBGUESTFS_BACKEND=direct virt-customize --upload vfio_pci.modules:/etc/sysconfig/modules/ \
146                                                --upload uio_pci_generic.modules:/etc/sysconfig/modules/ \
147                                                --run-command "chmod 0755 /etc/sysconfig/modules/vfio_pci.modules" \
148                                                --run-command "chmod 0755 /etc/sysconfig/modules/uio_pci_generic.modules" \
149                                                --run-command "sed -i 's/ is portbindings.VIF_TYPE_VHOST_USER:/ == portbindings.VIF_TYPE_VHOST_USER:/' \
150 /usr/lib/python2.7/site-packages/networking_odl/ml2/pseudo_agentdb_binding.py" \
151                                                -a overcloud-full.qcow2
152
153       if [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then
154         sed -i "/OS::TripleO::ComputeExtraConfigPre:/c\  OS::TripleO::ComputeExtraConfigPre: ./ovs-dpdk-preconfig.yaml" network-environment.yaml
155       fi
156
157 EOI
158
159   elif [ "${deploy_options_array['dataplane']}" != 'ovs' ]; then
160     echo "${red}${deploy_options_array['dataplane']} not supported${reset}"
161     exit 1
162   fi
163
164   if [ "$debug" == 'TRUE' ]; then
165     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "LIBGUESTFS_BACKEND=direct virt-customize -a overcloud-full.qcow2 --root-password password:opnfvapex"
166   fi
167
168   # upgrade ovs into ovs 2.5.90 with NSH function if SFC is enabled
169   if [[ "${deploy_options_array['sfc']}" == 'True' && "${deploy_options_array['dataplane']}" == 'ovs' ]]; then
170     echo "ONOS SFC is currently unavailable. JIRA: APEX-417"
171     exit 1
172     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
173          LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \
174                                                   --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \
175                                                   -a overcloud-full.qcow2
176 EOI
177   fi
178
179   # Patch neutron with using OVS external interface for router and add generic linux NS interface driver
180   if [[ "${deploy_options_array['dataplane']}" == 'fdio' ]]; then
181     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
182       LIBGUESTFS_BACKEND=direct virt-customize --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron-patch-NSDriver.patch" \
183                                                -a overcloud-full.qcow2
184 EOI
185
186     # Configure routing node for odl-fdio
187     if [[ "${deploy_options_array['sdn_l3']}" == 'True' ]]; then
188       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
189         sed -i "/opendaylight::vpp_routing_node:/c\    opendaylight::vpp_routing_node: ${deploy_options_array['odl_vpp_routing_node']}.${domain_name}" ${ENV_FILE}
190         sed -i "/ControllerExtraConfig:/ c\  ControllerExtraConfig:\n    tripleo::profile::base::neutron::agents::honeycomb::interface_role_mapping:  \"['${tenant_nic_mapping_controller_members}:tenant-interface']\"" ${ENV_FILE}
191         sed -i "/NovaComputeExtraConfig:/ c\  NovaComputeExtraConfig:\n    tripleo::profile::base::neutron::agents::honeycomb::interface_role_mapping:  \"['${tenant_nic_mapping_compute_members}:tenant-interface','${external_nic_mapping_compute_members}:public-interface']\"" ${ENV_FILE}
192 EOI
193     fi
194   fi
195
196   if [ -n "${deploy_options_array['performance']}" ]; then
197     ovs_dpdk_perf_flag="False"
198     for option in "${performance_options[@]}" ; do
199       if [ "${arr[1]}" == "vpp" ]; then
200         if [ "${arr[0]}" == "Compute" ]; then
201           role='NovaCompute'
202         else
203           role=${arr[0]}
204         fi
205         if [ "${arr[2]}" == "main-core" ]; then
206           ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
207             sed -i "/${role}ExtraConfig:/ c\  ${role}ExtraConfig:\n    fdio::vpp_cpu_main_core: \"'${arr[3]}'\"" ${ENV_FILE}
208 EOI
209         elif [ "${arr[2]}" == "corelist-workers" ]; then
210           ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
211             sed -i "/${role}ExtraConfig:/ c\  ${role}ExtraConfig:\n    fdio::vpp_cpu_corelist_workers: \"'${arr[3]}'\"" ${ENV_FILE}
212 EOI
213         fi
214       fi
215       arr=($option)
216       # use compute's kernel settings for all nodes for now.
217       if [ "${arr[0]}" == "Compute" ] && [ "${arr[1]}" == "kernel" ]; then
218         kernel_args+=" ${arr[2]}=${arr[3]}"
219       fi
220       if [ "${arr[0]}" == "Compute" ] && [ "${arr[1]}" == "ovs" ]; then
221          eval "${arr[2]}=${arr[3]}"
222          ovs_dpdk_perf_flag="True"
223       fi
224     done
225
226     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
227       sed -i "/ComputeKernelArgs:/c\  ComputeKernelArgs: '$kernel_args'" ${ENV_FILE}
228       sed -i "$ a\resource_registry:\n  OS::TripleO::NodeUserData: first-boot.yaml" ${ENV_FILE}
229       sed -i "/NovaSchedulerDefaultFilters:/c\  NovaSchedulerDefaultFilters: 'RamFilter,ComputeFilter,AvailabilityZoneFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,NUMATopologyFilter'" ${ENV_FILE}
230 EOI
231
232     if [[ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' && "$ovs_dpdk_perf_flag" == "True" ]]; then
233       for ovs_option in ${!ovs_option_heat_arr[@]}; do
234         if [ -n "${!ovs_option}" ]; then
235           ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
236             sed -i "/${ovs_option_heat_arr[$ovs_option]}:/c\  ${ovs_option_heat_arr[$ovs_option]}: ${!ovs_option}" ${ENV_FILE}
237 EOI
238         fi
239       done
240     fi
241   fi
242
243   if [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'False' ]]; then
244     if [ "${deploy_options_array['dataplane']}" == "fdio" ]; then
245       if [ "$tenant_nic_mapping_controller_members" == "$tenant_nic_mapping_compute_members" ]; then
246         echo -e "${blue}INFO: nosdn fdio deployment...installing correct vpp packages...${reset}"
247         ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
248           sed -i "/NeutronVPPAgentPhysnets:/c\  NeutronVPPAgentPhysnets: 'datacentre:${tenant_nic_mapping_controller_members}'" ${ENV_FILE}
249 EOI
250       else
251         echo -e "${red}Compute and Controller must use the same tenant nic name, please modify network setting file.${reset}"
252         exit 1
253       fi
254     fi
255   fi
256
257   # Set ODL version accordingly
258   if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && -n "${deploy_options_array['odl_version']}" ]]; then
259     case "${deploy_options_array['odl_version']}" in
260       beryllium) odl_version=''
261               ;;
262       boron)  odl_version='boron'
263               ;;
264       carbon) odl_version='master'
265               ;;
266       *) echo -e "${red}Invalid ODL version ${deploy_options_array['odl_version']}.  Please use 'carbon' or 'boron' values.${reset}"
267          exit 1
268          ;;
269     esac
270
271     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
272       LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
273                                                --run-command "yum -y install /root/${odl_version}/*" \
274                                                -a overcloud-full.qcow2
275 EOI
276
277     # Overwrite puppet-opendaylight with carbon. By default we install boron branch.
278     if [ "${deploy_options_array['odl_version']}" == 'carbon' ]; then
279       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
280         LIBGUESTFS_BACKEND=direct virt-customize --run-command "rm -rf /etc/puppet/modules/opendaylight" \
281                                                  --run-command "cd /etc/puppet/modules/ && tar xzf /root/puppet-opendaylight-carbon.tar.gz" \
282                                                  -a overcloud-full.qcow2
283 EOI
284     fi
285   fi
286
287   # Override ODL if we enable netvirt for fdio
288   if [[ "${deploy_options_array['odl_vpp_netvirt']}" == 'True' && "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
289     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
290       LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
291                                                --run-command "yum -y install /root/opendaylight-7.0.0-0.1.20170531snap665.el7.noarch.rpm" \
292                                                -a overcloud-full.qcow2
293 EOI
294   fi
295
296   # check if ceph should be enabled
297   if [ "${deploy_options_array['ceph']}" == 'True' ]; then
298     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml"
299   fi
300
301   if [ "${deploy_options_array['sdn_controller']}" == 'ovn' ]; then
302     # The epoch in deloran's ovs is 1: and in leif's is 0:
303     # so we have to execute a downgrade instead of an update
304     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
305       LIBGUESTFS_BACKEND=direct virt-customize \
306         --run-command "cd /root/ovs27 && yum update -y *openvswitch*" \
307         --run-command "cd /root/ovs27 && yum downgrade -y *openvswitch*" \
308         -a overcloud-full.qcow2
309 EOI
310   fi
311
312   # get number of nodes available in inventory
313   num_control_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "grep -c profile:control /home/stack/instackenv.json")
314   num_compute_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "grep -c profile:compute /home/stack/instackenv.json")
315
316   # check if HA is enabled
317   if [[ "$ha_enabled" == "True" ]]; then
318     if [ "$num_control_nodes" -lt 3 ]; then
319       echo -e "${red}ERROR: Number of control nodes in inventory is less than 3 and HA is enabled: ${num_control_nodes}. Check your inventory file.${reset}"
320       exit 1
321     else
322      DEPLOY_OPTIONS+=" --control-scale ${num_control_nodes}"
323      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml"
324      echo -e "${blue}INFO: Number of control nodes set for deployment: ${num_control_nodes}${reset}"
325     fi
326   else
327     if [ "$num_control_nodes" -lt 1 ]; then
328       echo -e "${red}ERROR: Number of control nodes in inventory is less than 1: ${num_control_nodes}. Check your inventory file.${reset}"
329       exit 1
330     fi
331   fi
332
333   if [ "$num_compute_nodes" -le 0 ]; then
334     echo -e "${red}ERROR: Invalid number of compute nodes: ${num_compute_nodes}. Check your inventory file.${reset}"
335     exit 1
336   else
337     echo -e "${blue}INFO: Number of compute nodes set for deployment: ${num_compute_nodes}${reset}"
338     DEPLOY_OPTIONS+=" --compute-scale ${num_compute_nodes}"
339   fi
340
341   DEPLOY_OPTIONS+=" --ntp-server $ntp_server"
342
343   DEPLOY_OPTIONS+=" --control-flavor control --compute-flavor compute"
344   if [[ "$virtual" == "TRUE" ]]; then
345     DEPLOY_OPTIONS+=" -e virtual-environment.yaml"
346   else
347     DEPLOY_OPTIONS+=" -e baremetal-environment.yaml"
348   fi
349
350   echo -e "${blue}INFO: Deploy options set:\n${DEPLOY_OPTIONS}${reset}"
351
352   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
353 # Create a key for use by nova for live migration
354 echo "Creating nova SSH key for nova resize support"
355 ssh-keygen -f nova_id_rsa -b 1024 -P ""
356 public_key=\'\$(cat nova_id_rsa.pub | cut -d ' ' -f 2)\'
357 sed -i "s#replace_public_key:#key: \$public_key#g" ${ENV_FILE}
358 python -c 'open("opnfv-environment-new.yaml", "w").write((open("${ENV_FILE}").read().replace("replace_private_key:", "key: \"" + "".join(open("nova_id_rsa").readlines()).replace("\\n","\\\n") + "\"")))'
359 mv -f opnfv-environment-new.yaml ${ENV_FILE}
360
361 source stackrc
362 set -o errexit
363 # Workaround for APEX-207 where sometimes swift proxy is down
364 if ! sudo systemctl status openstack-swift-proxy > /dev/null; then
365   sudo systemctl restart openstack-swift-proxy
366 fi
367 echo "Uploading overcloud glance images"
368 openstack overcloud image upload
369
370 echo "Configuring undercloud and discovering nodes"
371 openstack baremetal import --json instackenv.json
372
373 if [[ -z "$virtual" ]]; then
374   openstack baremetal introspection bulk start
375   if [[ -n "$root_disk_list" ]]; then
376     openstack baremetal configure boot --root-device=${root_disk_list}
377   else
378     openstack baremetal configure boot
379   fi
380 else
381   openstack baremetal configure boot
382 fi
383
384 echo "Configuring flavors"
385 for flavor in baremetal control compute; do
386   echo -e "${blue}INFO: Updating flavor: \${flavor}${reset}"
387   if openstack flavor list | grep \${flavor}; then
388     openstack flavor delete \${flavor}
389   fi
390   openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 \${flavor}
391   if ! openstack flavor list | grep \${flavor}; then
392     echo -e "${red}ERROR: Unable to create flavor \${flavor}${reset}"
393   fi
394 done
395 openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" baremetal
396 openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="control" control
397 openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="compute" compute
398 echo "Configuring nameserver on ctlplane network"
399 dns_server_ext=''
400 for dns_server in ${dns_servers}; do
401   dns_server_ext="\${dns_server_ext} --dns-nameserver \${dns_server}"
402 done
403 neutron subnet-update \$(neutron subnet-list | grep -Ev "id|tenant|external|storage" | grep -v \\\\-\\\\- | awk {'print \$2'}) \${dns_server_ext}
404 sed -i '/CloudDomain:/c\  CloudDomain: '${domain_name} ${ENV_FILE}
405 echo "Executing overcloud deployment, this should run for an extended period without output."
406 sleep 60 #wait for Hypervisor stats to check-in to nova
407 # save deploy command so it can be used for debugging
408 cat > deploy_command << EOF
409 openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90
410 EOF
411 EOI
412
413   if [ "$interactive" == "TRUE" ]; then
414     if ! prompt_user "Overcloud Deployment"; then
415       echo -e "${blue}INFO: User requests exit${reset}"
416       exit 0
417     fi
418   fi
419
420   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
421 source stackrc
422 openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90
423 if ! openstack stack list | grep CREATE_COMPLETE 1>/dev/null; then
424   $(typeset -f debug_stack)
425   debug_stack
426   exit 1
427 fi
428 EOI
429
430   # Configure DPDK and restart ovs agent after bringing up br-phy
431   if [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then
432     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI || (echo "DPDK config failed, exiting..."; exit 1)
433 source stackrc
434 set -o errexit
435 for node in \$(nova list | grep novacompute | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"); do
436 echo "Checking DPDK status and bringing up br-phy on \$node"
437 ssh -T ${SSH_OPTIONS[@]} "heat-admin@\$node" <<EOF
438 set -o errexit
439 sudo dpdk-devbind -s
440 sudo ifup br-phy
441 if [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'False' ]]; then
442   echo "Restarting openvswitch agent to pick up VXLAN tunneling"
443   sudo systemctl restart neutron-openvswitch-agent
444 fi
445 EOF
446 done
447 EOI
448   fi
449
450   if [ "$debug" == 'TRUE' ]; then
451       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
452 source overcloudrc
453 echo "Keystone Endpoint List:"
454 openstack endpoint list
455 echo "Keystone Service List"
456 openstack service list
457 EOI
458   fi
459 }