diff options
author | Michael Polenchuk <mpolenchuk@mirantis.com> | 2019-01-16 14:03:48 +0400 |
---|---|---|
committer | Michael Polenchuk <mpolenchuk@mirantis.com> | 2019-01-16 14:29:59 +0400 |
commit | 352e7bb783b5cb70a41acff26d4a7635ba9aeaec (patch) | |
tree | 1d358651be5bb3d94eef1ad3205dceaaff81c053 /mcp/scripts | |
parent | b9e7d9baa57594b7627556c0429ae17328f33a4d (diff) |
Make shutdown only on physical nodes
Change-Id: If167e7a6bdcdccd6b6df43bd5cac54250abec61a
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/lib.sh | 6 | ||||
-rw-r--r-- | mcp/scripts/lib_jump_deploy.sh | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 79767f0fa..85360bf2e 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -38,6 +38,7 @@ function wait_for { function cleanup_uefi { # Clean up Ubuntu boot entry if cfg01, kvm nodes online from previous deploy local cmd_str="ssh ${SSH_OPTS} ${SSH_SALT}" + local grain_virtual=$(salt -C 'I@nova:compute and *01*' grains.get virtual --out txt | cut -d ' ' -f2) ping -c 1 -w 1 "${SALT_MASTER}" || return 0 [ ! "$(hostname)" = 'cfg01' ] || cmd_str='eval' # NOTE: Targeting nodes by hostname is fragile and should be refactored to @@ -47,7 +48,10 @@ function cleanup_uefi { efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \ xargs -I{} efibootmgr --delete-bootnum --bootnum {}; \ rm -rf /boot/efi/*\"" || true - ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run 'shutdown now'" || true + + if [ "${grain_virtual}" == physical ]; then + ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run 'shutdown now'" || true + fi } function get_nova_compute_pillar_data { diff --git a/mcp/scripts/lib_jump_deploy.sh b/mcp/scripts/lib_jump_deploy.sh index d8b62fd7c..9c4d8fb5a 100644 --- a/mcp/scripts/lib_jump_deploy.sh +++ b/mcp/scripts/lib_jump_deploy.sh @@ -194,7 +194,7 @@ function __apt_repos_pkgs_image { function __cleanup_vms { # clean up existing nodes for node in $(${VIRSH} list --name | grep -P '\w{3}\d{2}'); do - ${VIRSH} destroy "${node}" + ${VIRSH} destroy "${node}" 2>/dev/null || true done for node in $(${VIRSH} list --name --all | grep -P '\w{3}\d{2}'); do ${VIRSH} domblklist "${node}" | awk '/^.da/ {print $2}' | \ |