summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xremove-vm5
1 files changed, 5 insertions, 0 deletions
diff --git a/remove-vm b/remove-vm
index 2ac9e53..9d1e940 100755
--- a/remove-vm
+++ b/remove-vm
@@ -25,11 +25,16 @@ remove_vm()
run_virsh undefine "$name"
fi
+
# Remove the LV, if it exists.
lvpath="/dev/$vg/$name"
if [ -e "$lvpath" ]
then
sudo lvremove --force "$lvpath"
+ else
+ # In case the LV was kpartx'd, undo that
+ sudo kpartx -dsv "$lvpath"
+ sudo lvremove --force "$lvpath"
fi
# Remove the host from /etc/hosts, if there.