From 7fe53c3d16f6f209502a3a9f1391283225a87959 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Tue, 28 Aug 2018 15:36:50 +0100
Subject: [PATCH] Check nova VM status in CI

Previously we were not checking the status of created VMs in CI, meaning
that VM creation failures would be silently ignored. This change checks
the status, requiring it to be ACTIVE for a pass.

Change-Id: Ia559c81b4944c2c6c7dedfca0c6c570db390704b
---
 dev/functions | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dev/functions b/dev/functions
index 1512847b7..18ec53a11 100644
--- a/dev/functions
+++ b/dev/functions
@@ -231,6 +231,11 @@ function overcloud_test {
     echo "Creating a VM"
     openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net demo1
     openstack server show demo1
+    status=$(openstack server show demo1 -f value -c status)
+    if [[ $status != ACTIVE ]]; then
+        echo "VM creation failed"
+        return 1
+    fi
     # TODO(mgoddard): Test SSH connectivity to the VM.
 
     echo "Deleting the VM"