first commit of deploy.sh for compass
[genesis.git] / compass / deploy / func.sh
diff --git a/compass/deploy/func.sh b/compass/deploy/func.sh
new file mode 100644 (file)
index 0000000..29c2c23
--- /dev/null
@@ -0,0 +1,20 @@
+function tear_down_machines() {
+    virtmachines=$(virsh list --name |grep pxe)
+    for virtmachine in $virtmachines; do
+        echo "destroy $virtmachine"
+        virsh destroy $virtmachine
+        if [[ "$?" != "0" ]]; then
+            echo "destroy instance $virtmachine failed"
+            exit 1
+        fi
+    done
+    virtmachines=$(virsh list --all --name |grep pxe)
+    for virtmachine in $virtmachines; do
+        echo "undefine $virtmachine"
+        virsh undefine $virtmachine
+        if [[ "$?" != "0" ]]; then
+            echo "undefine instance $virtmachine failed"
+            exit 1
+        fi
+    done
+}