diff options
author | Martin Schwenke <martin@meltin.net> | 2014-08-12 11:27:24 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2014-08-12 11:27:24 +1000 |
commit | bc215c403e7f05fea0faac313aaea648e6cfa4cb (patch) | |
tree | 30de5c25e5cabf3144cd5ce09f1bb7563c79ffc6 | |
parent | 611c5744f88fbd5e33356823b48b57851c213d6e (diff) | |
download | autocluster-bc215c403e7f05fea0faac313aaea648e6cfa4cb.tar.gz autocluster-bc215c403e7f05fea0faac313aaea648e6cfa4cb.tar.xz autocluster-bc215c403e7f05fea0faac313aaea648e6cfa4cb.zip |
Undefine nodes in old cluster when building a new one
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>
-rwxr-xr-x | autocluster | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/autocluster b/autocluster index 2d8a8af..7e259d2 100755 --- a/autocluster +++ b/autocluster @@ -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 ;; |