summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch')
-rw-r--r--patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch b/patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch
new file mode 100644
index 00000000..e29daa1e
--- /dev/null
+++ b/patches/opnfv-fuel/0021-lib.sh-Remove-all-storage-on-undefine.patch
@@ -0,0 +1,49 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2017 Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Thu, 7 Sep 2017 21:55:16 +0200
+Subject: [PATCH] lib.sh: Remove all storage on undefine
+
+While executing the deploy script via sudo will raise no issues with
+re-using old storage volume files, non-root deploys fail to change
+ownership of said files.
+
+Properly clean after ourselves when destroying and undefining VMs.
+
+JIRA: ARMBAND-311
+
+Change-Id: I7fdd269dccbfd5ab5285d852ac7dacfc4dc5ccd7
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ mcp/scripts/lib.sh | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
+index 884e852..f43bb08 100644
+--- a/mcp/scripts/lib.sh
++++ b/mcp/scripts/lib.sh
+@@ -43,7 +43,9 @@ cleanup_vms() {
+ virsh destroy "${node}"
+ done
+ for node in $(virsh list --name --all | grep -P '\w{3}\d{2}'); do
+- virsh undefine --nvram "${node}"
++ virsh domblklist "${node}" | awk '/^.da/ {print $2}' | \
++ xargs --no-run-if-empty -I{} sudo rm -f {}
++ virsh undefine "${node}" --remove-all-storage --nvram
+ done
+ }
+
+@@ -55,6 +57,7 @@ prepare_vms() {
+ cleanup_uefi
+ cleanup_vms
+ get_base_image "${base_image}" "${image_dir}"
++ # shellcheck disable=SC2016
+ envsubst '${SALT_MASTER},${CLUSTER_DOMAIN}' < \
+ user-data.template > user-data.sh
+