How can I configure VMs to suspend or shutdown when the host is rebooted/shutdown with KVM / virt-manager?

I am running openSUSE Tumbleweed with virt-manager.

I can see an option in the VM details for starting the VM when the host boots up.

enter image description here

I am trying to find a way to configure what a VM does when the host is shutdown? For example, I want one VM to suspend and another VM to shutdown.

@imthenachoman Hi use the virsh command eg virsh suspend <some_domain> and virsh shutdown <some_domain>. Create a systemd service that runs on the host being shutdown. On startup you can virsh resume <some_domain>.

@imthenachoman I also see the libvirt-guests.service which by default suspends/resumes all running machines. I suspect you would need to create your own /etc/sysconfig/libvirt-guests for specific machines…