Fixes various corner cases with clean and deploy 19/4619/1
authorTim Rozet <trozet@redhat.com>
Tue, 15 Dec 2015 22:35:30 +0000 (17:35 -0500)
committerTim Rozet <trozet@redhat.com>
Tue, 15 Dec 2015 22:35:30 +0000 (17:35 -0500)
Fixes Include:
 - Fixed info print statement when using flat network
 - deploy now looks at arp table as well to determine instack IP address
   as default leases file may not exist
 - clean now uses --pool with vol-delete command

JIRA: APEX-50

Change-Id: I664fd06e92e0890e0b65191851dfa81f8d8ac492
Signed-off-by: Tim Rozet <trozet@redhat.com>
ci/clean.sh
ci/deploy.sh

index b8be179..2b48880 100755 (executable)
@@ -8,14 +8,14 @@ vm_index=4
 # Clean off instack VM
 virsh destroy instack 2> /dev/null || echo -n ''
 virsh undefine instack --remove-all-storage 2> /dev/null || echo -n ''
-virsh vol-delete instack.qcow2 default 2> /dev/null
+virsh vol-delete instack.qcow2 --pool default 2> /dev/null
 rm -f /var/lib/libvirt/images/instack.qcow2 2> /dev/null
 
 # Clean off baremetal VMs in case they exist
 for i in $(seq 0 $vm_index); do
   virsh destroy baremetalbrbm_brbm1_$i 2> /dev/null || echo -n ''
   virsh undefine baremetalbrbm_brbm1_$i --remove-all-storage 2> /dev/null || echo -n ''
-  virsh vol-delete baremetalbrbm_brbm1_${i}.qcow2 default 2> /dev/null
+  virsh vol-delete baremetalbrbm_brbm1_${i}.qcow2 --pool default 2> /dev/null
   rm -f /var/lib/libvirt/images/baremetalbrbm_brbm1_${i}.qcow2 2> /dev/null
 done
 
index 1c0d012..aae8e00 100755 (executable)
@@ -335,8 +335,15 @@ function setup_instack_vm {
   # get the instack VM IP
   UNDERCLOUD=$(grep instack /var/lib/libvirt/dnsmasq/default.leases | awk '{print $3}' | head -n 1)
   if [ -z "$UNDERCLOUD" ]; then
-     echo "\n\nNever got IP for Instack. Can Not Continue."
-     exit 1
+    #if not found then dnsmasq may be using leasefile-ro
+    instack_mac=$(virsh domiflist instack | grep default | \
+                  grep -Eo "[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+")
+    UNDERCLOUD=$(arp -e | grep ${instack_mac} | awk {'print $1'})
+
+    if [ -z "$UNDERCLOUD" ]; then
+      echo "\n\nNever got IP for Instack. Can Not Continue."
+      exit 1
+    fi
   else
      echo -e "${blue}\rInstack VM has IP $UNDERCLOUD${reset}"
   fi
@@ -582,7 +589,7 @@ parse_cmdline() {
   done
 
   if [[ ! -z "$NETENV" && "$net_isolation_enabled" == "FALSE" ]]; then
-    echo -e "{red}WARN: Single flat network requested, but netenv specified.  Ignoring netenv settings!${reset}"
+    echo -e "${red}INFO: Single flat network requested. Ignoring any netenv settings!${reset}"
   elif [[ ! -z "$NETENV" && ! -z "$DEPLOY_SETTINGS_FILE" ]]; then
     echo -e "${red}WARN: deploy_settings and netenv specified.  Ignoring netenv settings! deploy_settings will contain \
 netenv${reset}"