Updates docs for D2.0
[apex.git] / lib / post-install-functions.sh
index eab1740..a93ad54 100755 (executable)
@@ -104,17 +104,23 @@ else
   neutron subnet-create --name external-net --tenant-id \$(openstack project show service | grep id | awk '{ print \$4 }') --disable-dhcp external --gateway ${admin_gateway} --allocation-pool start=${admin_introspection_range%%,*},end=${admin_introspection_range##*,} ${admin_cidr}
 fi
 
+if [ "${deploy_options_array['gluon']}" == 'True' ]; then
+  echo "Creating Gluon dummy network and subnet"
+  neutron net-create --shared --provider:network_type vxlan GluonNetwork
+  neutron subnet-create --name GluonSubnet --no-gateway --disable-dhcp GluonNetwork 0.0.0.0/1
+fi
+
 echo "Removing sahara endpoint and service"
 sahara_service_id=\$(openstack service list | grep sahara | cut -d ' ' -f 2)
 sahara_endpoint_id=\$(openstack endpoint list | grep sahara | cut -d ' ' -f 2)
-openstack endpoint delete \$sahara_endpoint_id
-openstack service delete \$sahara_service_id
+[[ -n "\$sahara_endpoint_id" ]] && openstack endpoint delete \$sahara_endpoint_id
+[[ -n "\$sahara_service_id" ]] && openstack service delete \$sahara_service_id
 
 echo "Removing swift endpoint and service"
 swift_service_id=\$(openstack service list | grep swift | cut -d ' ' -f 2)
 swift_endpoint_id=\$(openstack endpoint list | grep swift | cut -d ' ' -f 2)
-openstack endpoint delete \$swift_endpoint_id
-openstack service delete \$swift_service_id
+[[ -n "\$swift_endpoint_id" ]] && openstack endpoint delete \$swift_endpoint_id
+[[ -n "\$swift_service_id" ]] && openstack service delete \$swift_service_id
 
 if [ "${deploy_options_array['dataplane']}" == 'fdio' ] || [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then
     for flavor in \$(openstack flavor list -c Name -f value); do
@@ -123,17 +129,21 @@ if [ "${deploy_options_array['dataplane']}" == 'fdio' ] || [ "${deploy_options_a
     done
 fi
 
-# TODO: Change this back to True once everything is back in
-#       place with tht and puppet-congress for deployment
-if [ "${deploy_options_array['congress']}" == 'NeverTrue' ]; then
+if [ "${deploy_options_array['congress']}" == 'True' ]; then
     ds_configs="--config username=\$OS_USERNAME
-                --config tenant_name=\$OS_TENANT_NAME
+                --config tenant_name=\$OS_PROJECT_NAME
                 --config password=\$OS_PASSWORD
                 --config auth_url=\$OS_AUTH_URL"
-    for s in nova neutronv2 ceilometer cinder glancev2 keystone; do
+    for s in nova neutronv2 cinder glancev2 keystone; do
         ds_extra_configs=""
         if [ "\$s" == "nova" ]; then
-            nova_micro_version=\$(nova version-list | grep CURRENT | awk '{print \$10}')
+            # nova's latest version is 2.38 but congress relies on nova to do
+            # floating ip operation instead of neutron. fip support in nova
+            # was depricated as of 2.35. Hard coding 2.34 for danube.
+            # Carlos.Goncalves working on fixes for upstream congress that
+            # should be ready for ocata.
+            nova_micro_version="2.34"
+            #nova_micro_version=\$(nova version-list | grep CURRENT | awk '{print \$10}')
             ds_extra_configs+="--config api_version=\$nova_micro_version"
         fi
         if openstack congress datasource create \$s "\$s" \$ds_configs \$ds_extra_configs; then
@@ -148,8 +158,31 @@ if [ "${deploy_options_array['congress']}" == 'NeverTrue' ]; then
       echo "WARN: Datsource: doctor could NOT be created"
     fi
 fi
+
+
+# Fix project_id and os_tenant_name not in overcloudrc
+# Deprecated openstack client does not need project_id
+# and os_tenant_name anymore but glance client and
+# Rally in generall does need it.
+# REMOVE when not needed in Rally/glance-client anymore.
+if ! grep -q  "OS_PROJECT_ID" ./overcloudrc;then
+    project_id=\$(openstack project list |grep admin|awk '{print \$2}')
+    echo "export OS_PROJECT_ID=\$project_id" >> ./overcloudrc
+fi
+if ! grep -q  "OS_TENANT_NAME" ./overcloudrc;then
+    echo "export OS_TENANT_NAME=admin" >> ./overcloudrc
+fi
+
+
 EOI
 
+  # we need to restart neutron-server in Gluon deployments to allow the Gluon core
+  # plugin to correctly register itself with Neutron
+  if [ "${deploy_options_array['gluon']}" == 'True' ]; then
+    echo "Restarting neutron-server to finalize Gluon installation"
+    overcloud_connect "controller0" "sudo systemctl restart neutron-server"
+  fi
+
   # for virtual, we NAT external network through Undercloud
   # same goes for baremetal if only jumphost has external connectivity
   if [ "$virtual" == "TRUE" ] || ! test_overcloud_connectivity && [ "$external_network_ipv6" != "True" ]; then
@@ -186,6 +219,29 @@ EOI
     overcloud_connect "compute0" "sudo sh -c 'cd /var/opt/vsperf/systems/ && ./build_base_machine.sh 2>&1 > /var/log/vsperf.log'"
   fi
 
+  # install docker
+  if [ "${deploy_options_array['yardstick']}" == 'True' ] || [ "${deploy_options_array['dovetail']}" == 'True' ]; then
+    ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+sudo yum install docker -y
+sudo systemctl start docker
+sudo systemctl enable docker
+EOI
+  fi
+
+  # pull yardstick image
+  if [ "${deploy_options_array['yardstick']}" == 'True' ]; then
+    ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+sudo docker pull opnfv/yardstick
+EOI
+  fi
+
+  # pull dovetail image
+  if [ "${deploy_options_array['dovetail']}" == 'True' ]; then
+    ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+sudo docker pull opnfv/dovetail
+EOI
+  fi
+
   # Collect deployment logs
   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
 mkdir -p ~/deploy_logs
@@ -221,7 +277,7 @@ done
 # Print out the undercloud IP and dashboard URL
 source stackrc
 echo "Undercloud IP: $UNDERCLOUD, please connect by doing 'opnfv-util undercloud'"
-echo "Overcloud dashboard available at http://\$(openstack stack output show overcloud PublicVip | sed 's/"//g')/dashboard"
+echo "Overcloud dashboard available at http://\$(openstack stack output show overcloud PublicVip -f json | jq -r .output_value)/dashboard"
 EOI
 
 if [[ "$ha_enabled" == 'True' ]]; then
@@ -229,7 +285,10 @@ if [[ "$ha_enabled" == 'True' ]]; then
     echo "${blue}\nChecking pacemaker service status\n${reset}"
   fi
   overcloud_connect "controller0" "for i in \$(sudo pcs status | grep '^* ' | cut -d ' ' -f 2 | cut -d '_' -f 1 | uniq); do echo \"WARNING: Service: \$i not running\"; done"
-  # trozet disable congress in HA until congress bugs are fixed
-  overcloud_connect "controller0" "sudo pcs resource ban openstack-congress overcloud-controller-1; sudo pcs resource ban openstack-congress overcloud-controller-2; sudo systemctl restart openstack-congress"
+fi
+
+if [ "${deploy_options_array['vpn']}" == 'True' ]; then
+   # Check zrpcd is started
+   overcloud_connect "controller0" "sudo systemctl status zrpcd > /dev/null || echo 'WARNING: zrpcd is not running on controller0'"
 fi
 }