Undefine nodes in old cluster when building a new one
authorMartin Schwenke <martin@meltin.net>
Tue, 12 Aug 2014 01:27:24 +0000 (11:27 +1000)
committerMartin Schwenke <martin@meltin.net>
Tue, 12 Aug 2014 01:27:24 +0000 (11:27 +1000)
Otherwise, if the list of NODES is changed so that nodes are renamed,
then old nodes will come back when the new cluster is booted and
madness will ensue.

Signed-off-by: Martin Schwenke <martin@meltin.net>
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
                    ;;