Undefine nodes in old cluster when building a new one
[tridge/autocluster.git] / autocluster
index 2d8a8af7fa2b96fe2c5902622cdc3bd70acca584..7e259d2ad392853a90b4beaea898e03c16e1700b 100755 (executable)
@@ -54,7 +54,9 @@ EOF
   commands:
      base [ create | boot ] ...
 
-     cluster [ build | destroy | create | update_hosts | boot | setup ] ...
+     cluster [ build |
+               destroy | undefine |
+               create | update_hosts | boot | setup ] ...
 
      create base
            create a base image
@@ -536,6 +538,14 @@ cluster_destroy ()
     vircmd destroy "$CLUSTER" || true
 }
 
+cluster_undefine ()
+{
+    announce "cluster undefine \"${CLUSTER}\""
+    [ -n "$CLUSTER" ] || die "\$CLUSTER not set"
+
+    vircmd undefine "$CLUSTER" || true
+}
+
 cluster_update_hosts ()
 {
     announce "cluster update_hosts \"${CLUSTER}\""
@@ -1478,10 +1488,10 @@ case "$t" in
        actions_init
        for t in "$@" ; do
            case "$t" in
-               destroy|create|update_hosts|boot|setup)
+               destroy|undefine|create|update_hosts|boot|setup)
                    actions_add "cluster_${t}" ;;
                build)
-                   for t in destroy create update_hosts boot setup ; do
+                   for t in destroy undefine create update_hosts boot setup ; do
                        actions_add "cluster_${t}"
                    done
                    ;;