Better domain parsing and improved instance cleanup

 * Fixes bug 911506
 * Fix typo - logical or not pipe

Change-Id: Id92a7e1d7e974710635899d43a7d428ce525227c
diff --git a/stack.sh b/stack.sh
index e1b005e..f3477cd 100755
--- a/stack.sh
+++ b/stack.sh
@@ -843,10 +843,10 @@
     clean_iptables
 
     # Destroy old instances
-    instances=`virsh list | grep $INSTANCE_NAME_PREFIX | cut -d " " -f3`
+    instances=`virsh list --all | grep $INSTANCE_NAME_PREFIX | sed "s/.*\($INSTANCE_NAME_PREFIX[0-9a-fA-F]*\).*/\1/g"`
     if [ ! $instances = "" ]; then
-        echo $instances | xargs -n1 virsh destroy
-        echo $instances | xargs -n1 virsh undefine
+        echo $instances | xargs -n1 virsh destroy || true
+        echo $instances | xargs -n1 virsh undefine || true
     fi
 
     # Clean out the instances directory.