How to automatically start VM created by virt-manager?

Solution 1:

As far as automatically starting/stopping and you're using virsh you can do that like this (as a privileged user)

virsh autostart Domain

I'm not sure why virt manager isn't giving you any output. It does have a connection to the machine hosting machine right? It should show a list of domains if it's connected.

Solution 2:

Open the VM display, click View->Details

enter image description here

Select Boot Options, and tick Start virtual machine on host boot up

enter image description here

Solution 3:

The answer by Tim is the way to go, and virsh allows you to do many useful things besides that.

To set a virtual machine to be automatically started, you use:

# virsh autostart <domain-id>

The <domain-id> is either the virtual machine's number, UUID or a "friendly name" like "debian1", which you entered in virt-manager.

To get a list of virtual machines (numbers and names), use:

# virsh list --all

In my case I get:

 Id Name                 State
----------------------------------
  1 other                running
  2 other-clone          running

So I've used:

# virsh autostart other

Solution 4:

install virsh then

virsh list                    (this will print list of your VMs)
virsh dominfo your_vm_name    (get info about selected VM)
virsh autostart your_vm_name  (set autostart of selected VM)

Solution 5:

You can also place a symlink to the guest domxml in /etc/libvirt/qemu/autostart:

Will look like this for a VM named "test":
test.xml -> /etc/libvirt/qemu/test.xml