diff options
Diffstat (limited to 'remove-vm')
-rwxr-xr-x | remove-vm | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -30,11 +30,12 @@ remove_vm() 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" + if ! sudo lvremove --force "$lvpath" + then + # In case the LV was kpartx'd, undo that + sudo kpartx -dsv "$lvpath" + sudo lvremove --force "$lvpath" + fi fi # Remove the host from /etc/hosts, if there. |