Linux – libvirt: how can I make a domain start when the host starts

kvm-virtualizationlibvirtlinuxvirtualization

I would like some of my domains to start automatically when my host starts (I'm using libvirt+KVM on ubuntu). I guess I could put some "virsh start…" statements in rc.local, but is there a way to configure this within libvirt/virsh?

Best Answer

Looking at the output of "help":

virsh # help autostart
  NAME
    autostart - autostart a domain

  SYNOPSIS
    autostart <domain> [--disable]

  DESCRIPTION
    Configure a domain to be automatically started at boot.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    --disable        disable autostarting

This requires that you defined the domain from a file (i.e., that the domain is persistent rather than transient).