summaryrefslogtreecommitdiff
path: root/remove-vm
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-08-20 19:32:08 +0300
committerLars Wirzenius <liw@liw.fi>2021-08-20 19:32:08 +0300
commitcb437c9e3a1f7b25e1306e504656286c24186e4c (patch)
treec8314be1f48e51b0f145450c3a91a8b79390499e /remove-vm
parentd6789ab0b7175173ea73723fc2a686097569bf6f (diff)
downloadansibleness-cb437c9e3a1f7b25e1306e504656286c24186e4c.tar.gz
drop old crap
Sponsored-by: author
Diffstat (limited to 'remove-vm')
-rwxr-xr-xremove-vm55
1 files changed, 0 insertions, 55 deletions
diff --git a/remove-vm b/remove-vm
deleted file mode 100755
index e60bc93..0000000
--- a/remove-vm
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-#
-# Remove a VM for liw.
-
-set -eu
-
-run_virsh()
-{
- virsh -c qemu:///system "$@"
-}
-
-vm_exists()
-{
- run_virsh list --all | grep -F "$name" > /dev/null
-}
-
-remove_vm()
-{
- local name="$1"
-
- # Shut down and remove the VM, if it exists.
- if vm_exists "$name"
- then
- run_virsh destroy "$name" || true
- run_virsh undefine --nvram "$name"
- fi
-
-
- # Remove the LV, if it exists.
- lvpath="/dev/$vg/$name"
- if [ -e "$lvpath" ]
- then
- 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.
- awk -v "name=$name" '$2 != name' /etc/hosts | sudo sponge /etc/hosts
-
- # Done.
- echo "Virtual machine $name is gone."
-}
-
-
-# Read config variables.
-. "$HOME/.config/ansibleness/vm.conf"
-
-for name in "$@"
-do
- remove_vm "$name"
-done