Adds declaring disk device to use on overcloud nodes
[apex.git] / lib / overcloud-deploy-functions.sh
index 18d1ec4..e1e6630 100755 (executable)
@@ -15,9 +15,7 @@ function overcloud_deploy {
   local num_control_nodes
 
   if [[ "${#deploy_options_array[@]}" -eq 0 || "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
-    if [ "${deploy_options_array['sdn_l3']}" == 'True' ]; then
-      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_l3.yaml"
-    elif [ "${deploy_options_array['sfc']}" == 'True' ]; then
+    if [ "${deploy_options_array['sfc']}" == 'True' ]; then
       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sfc.yaml"
     elif [ "${deploy_options_array['vpn']}" == 'True' ]; then
       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sdnvpn.yaml"
@@ -26,7 +24,7 @@ function overcloud_deploy {
     elif [ "${deploy_options_array['vpn']}" == 'true' ]; then
       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sdnvpn.yaml"
     else
-      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml"
+      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-l3.yaml"
     fi
     SDN_IMAGE=opendaylight
   elif [ "${deploy_options_array['sdn_controller']}" == 'opendaylight-external' ]; then
@@ -109,12 +107,6 @@ EOF
                                                  -a overcloud-full.qcow2
       fi
 
-      if [ "${deploy_options_array['sfc']}" == 'True' ]; then
-          # upgrade ovs into ovs 2.5.90 with NSH function
-          LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \
-                                                   --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \
-                                                   -a overcloud-full.qcow2
-      fi
 EOI
 
   elif [ "${deploy_options_array['dataplane']}" != 'ovs' ]; then
@@ -126,11 +118,32 @@ EOI
     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "LIBGUESTFS_BACKEND=direct virt-customize -a overcloud-full.qcow2 --root-password password:opnfvapex"
   fi
 
+  # upgrade ovs into ovs 2.5.90 with NSH function if SFC is enabled
+  if [[ "${deploy_options_array['sfc']}" == 'True' && "${deploy_options_array['dataplane']}" == 'ovs' ]]; then
+    ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+         LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \
+                                                  --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \
+                                                  -a overcloud-full.qcow2
+EOI
+  fi
+
   # Set ODL version accordingly
-  if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && "${deploy_options_array['odl_version']}" == 'boron' ]]; then
+  if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && -n "${deploy_options_array['odl_version']}" ]]; then
+    case "${deploy_options_array['odl_version']}" in
+      beryllium) odl_version=''
+              ;;
+      boron)  odl_version='boron'
+              ;;
+      cabron) odl_version='master'
+              ;;
+      *) echo -e "${red}Invalid ODL version ${deploy_options_array['odl_version']}.  Please use 'carbon' or 'boron' values.${reset}"
+         exit 1
+         ;;
+    esac
+
     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
       LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
-                                               --run-command "yum -y install /root/boron/*" \
+                                               --run-command "yum -y install /root/${odl_version}/*" \
                                                -a overcloud-full.qcow2
 EOI
   fi
@@ -196,11 +209,17 @@ if [ -n "${public_network_controller_interface}" ]; then
 fi
 EOI
 
+    echo -e "${blue}INFO: Including /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml ${reset}"
+    if [ "$debug" == 'TRUE' ]; then
+      ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "cat /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml"
+    fi
     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml"
   fi
 
-  # make sure ceph is installed
-  DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml"
+  # check if ceph should be enabled
+  if [ "${deploy_options_array['ceph']}" == 'True' ]; then
+    DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml"
+  fi
 
   #DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml"
   DEPLOY_OPTIONS+=" -e network-environment.yaml"
@@ -242,22 +261,22 @@ EOI
      DEPLOY_OPTIONS+=" -e virtual-environment.yaml"
   fi
 
-  DEPLOY_OPTIONS+=" -e opnfv-environment.yaml"
+  DEPLOY_OPTIONS+=" -e ${ENV_FILE}"
 
   echo -e "${blue}INFO: Deploy options set:\n${DEPLOY_OPTIONS}${reset}"
 
   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
 if [ "${deploy_options_array['tacker']}" == 'False' ]; then
-    sed -i '/EnableTacker:/c\  EnableTacker: false' opnfv-environment.yaml
+    sed -i '/EnableTacker:/c\  EnableTacker: false' ${ENV_FILE}
 fi
 
 # Create a key for use by nova for live migration
 echo "Creating nova SSH key for nova resize support"
 ssh-keygen -f nova_id_rsa -b 1024 -P ""
 public_key=\'\$(cat nova_id_rsa.pub | cut -d ' ' -f 2)\'
-sed -i "s#replace_public_key:#key: \$public_key#g" opnfv-environment.yaml
-python -c 'open("opnfv-environment-new.yaml", "w").write((open("opnfv-environment.yaml").read().replace("replace_private_key:", "key: \"" + "".join(open("nova_id_rsa").readlines()).replace("\\n","\\\n") + "\"")))'
-mv -f opnfv-environment-new.yaml opnfv-environment.yaml
+sed -i "s#replace_public_key:#key: \$public_key#g" ${ENV_FILE}
+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") + "\"")))'
+mv -f opnfv-environment-new.yaml ${ENV_FILE}
 
 source stackrc
 set -o errexit
@@ -270,11 +289,19 @@ openstack overcloud image upload
 
 echo "Configuring undercloud and discovering nodes"
 openstack baremetal import --json instackenv.json
-openstack baremetal configure boot
+
 bash -x set_perf_images.sh ${performance_roles[@]}
-#if [[ -z "$virtual" ]]; then
-#  openstack baremetal introspection bulk start
-#fi
+if [[ -z "$virtual" ]]; then
+  openstack baremetal introspection bulk start
+  if [[ -n "$root_disk_list" ]]; then
+    openstack baremetal configure boot -root-device=${root_disk_list}
+  else
+    openstack baremetal configure boot
+  fi
+else
+  openstack baremetal configure boot
+fi
+
 echo "Configuring flavors"
 for flavor in baremetal control compute; do
   echo -e "${blue}INFO: Updating flavor: \${flavor}${reset}"
@@ -295,7 +322,7 @@ for dns_server in ${dns_servers}; do
   dns_server_ext="\${dns_server_ext} --dns-nameserver \${dns_server}"
 done
 neutron subnet-update \$(neutron subnet-list | grep -Ev "id|tenant|external|storage" | grep -v \\\\-\\\\- | awk {'print \$2'}) \${dns_server_ext}
-sed -i '/CloudDomain:/c\  CloudDomain: '${domain_name} opnfv-environment.yaml
+sed -i '/CloudDomain:/c\  CloudDomain: '${domain_name} ${ENV_FILE}
 echo "Executing overcloud deployment, this should run for an extended period without output."
 sleep 60 #wait for Hypervisor stats to check-in to nova
 # save deploy command so it can be used for debugging
@@ -314,7 +341,7 @@ EOI
   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
 source stackrc
 openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90
-if ! heat stack-list | grep CREATE_COMPLETE 1>/dev/null; then
+if ! openstack stack list | grep CREATE_COMPLETE 1>/dev/null; then
   $(typeset -f debug_stack)
   debug_stack
   exit 1