provision/kvm/etc-profile.d-virsh.sh
2024-10-19 10:15:41 -07:00

27 lines
692 B
Bash

# Aliases for virsh
vlist() {
/usr/bin/virsh --connect qemu:///system list --all
}
vstart() {
/usr/bin/virsh --connect qemu:///system start $1
}
vsave() {
/usr/bin/virsh --connect qemu:///system managedsave $1 --running
}
vstop() {
/usr/bin/virsh --connect qemu:///system shutdown $1
}
vkill() {
/usr/bin/virsh --connect qemu:///system destroy $1
}
vconsole() {
/usr/bin/virsh --connect qemu:///system console $1
}
vrm() {
echo "This will completely remove $1 and its associated storage."
read -r -p "Are you sure? (y/N) " ans
echo
if [[ "$ans" =~ ^[Yy]$ ]]; then
/usr/bin/virsh --connect qemu:///system undefine --nvram --remove-all-storage $1
fi
}