Libvirt: command to start up all guest virtual machines which have auto-start enabled

kvmlibvirtqemuvirtual machine

I'm using Debian Jessie as a virtual machine host using libvirt/qemu/kvm.

I've set some of the guest virtual machines to automatically start when the host OS boots up, this is working fine.

For maintenance purposes, I'm running "service libvirt-guests stop" to shut all the guests down (but not the host).

Once I've done my maintenance, I want to easily boot all the guests up again (without rebooting the host).

Is there a single command that will start all the guest VMs up again? I'm interested in knowing about both:

  1. a command to start all the autostart-marked guests up again

  2. a command to start all the guests up again that were running before I ran "service libvirt-guests stop"

Rebooting the host OS would achieve #1, but I don't want to reboot the host.

I tried, "service libvirt-guests start" but it doesn't seem to do it.

Best Answer

Like @jason-harris solution. But simpler and start only marked for autostart.

for i in $(virsh list --name --autostart); do virsh start $i; done

UPD: I tested it on libvirt 3.2.0 (CentOS 7.4.1708)

Related Question