Apex: Fix OS branch detection on snapshot promotion
[releng.git] / jjb / apex / apex-snapshot-deploy.sh
index a93421c..a6dc190 100644 (file)
@@ -25,9 +25,11 @@ pushd ci > /dev/null
 sudo opnfv-clean
 popd > /dev/null
 
+full_snap_url=http://$GS_URL/${OS_VERSION}/${TOPOLOGY}
+
 echo "Downloading latest snapshot properties file"
-if ! wget -O $WORKSPACE/opnfv.properties http://$GS_URL/snapshot.properties; then
-  echo "ERROR: Unable to find snapshot.properties at ${GS_URL}...exiting"
+if ! wget -O $WORKSPACE/opnfv.properties ${full_snap_url}/snapshot.properties; then
+  echo "ERROR: Unable to find snapshot.properties at ${full_snap_url}...exiting"
   exit 1
 fi
 
@@ -39,6 +41,7 @@ if [ -z "$latest_snap_checksum" ]; then
 fi
 
 local_snap_checksum=""
+SNAP_CACHE=${SNAP_CACHE}/${OS_VERSION}/${TOPOLOGY}
 
 # check snap cache directory exists
 # if snapshot cache exists, find the checksum
@@ -133,6 +136,11 @@ for node_def in ${virsh_vm_defs}; do
   sudo virsh define ${node_def}
   node=$(echo ${node_def} | awk -F '.' '{print $1}')
   sudo cp -f ${node}.qcow2 /var/lib/libvirt/images/
+  # FIXME (trozet) install java on each disk image as required to upgrade ODL
+  # should be added to Apex as part of the deployment. Remove this after that
+  # is complete
+  sudo LIBGUESTFS_BACKEND=direct virt-customize --install java-1.8.0-openjdk \
+  --run-command "docker update --restart=always opendaylight_api" -a /var/lib/libvirt/images/${node}.qcow2
   sudo virsh start ${node}
   echo "Node: ${node} started"
 done
@@ -141,22 +149,23 @@ done
 mkdir -p $HOME/cloner-info
 cp -f overcloudrc $HOME/cloner-info/
 
-admin_controller_ip=$(cat overcloudrc | grep -Eo -m 1 "192.0.2.[0-9]+")
+admin_controller_ip=$(cat overcloudrc | grep -Eo -m 1 "192.0.2.[0-9]+" | head -1)
 netvirt_url="http://${admin_controller_ip}:8081/restconf/operational/network-topology:network-topology/topology/netvirt:1"
 
 source overcloudrc
 counter=1
 while [ "$counter" -le 10 ]; do
-  if curl --fail --silent ${admin_controller_ip}:80 > /dev/null; then
-    echo "Overcloud Horizon is up...Checking if OpenDaylight NetVirt is up..."
-    if curl --fail --silent -u admin:admin ${netvirt_url} > /dev/null; then
+  echo "Checking if OpenStack is up"
+  if nc -z ${admin_controller_ip} 9696 > /dev/null; then
+    echo "Overcloud Neutron is up...Checking if OpenDaylight NetVirt is up..."
+    if curl --fail --silent -u admin:${SDN_CONTROLLER_PASSWORD} ${netvirt_url} > /dev/null; then
       echo "OpenDaylight is up.  Overcloud deployment complete"
       exit 0
     else
       echo "OpenDaylight not yet up, try ${counter}"
     fi
   else
-    echo "Horizon/Apache not yet up, try ${counter}"
+    echo "Neutron not yet up, try ${counter}"
   fi
   counter=$((counter+1))
   sleep 60