Ubuntu – shutdown kvm-guests without libvirt/virsh

kvm-virtualizationUbuntuvirtualization

We use kvm on ubuntu 10.4 as virtualisation-solution (we have bash-scripted the whole networking, subneting, starting of vms…..

Is there a way to shutdown a kvm-guest without the usage of libvirt/virsh? A bash or python based solution would be great.

Best Answer

If you have started your VM with the monitor option (-monitor unix:/tmp/file.mon,server,nowait ), you can stop it by using echo 'system_powerdown' | socat - UNIX-CONNECT:/tmp/file.mon.

It send a ACPI signal to the VM, which can use it as you push your power button, and then do a shutdown.