Import XML into libvirt without booting virtual machine

libvirt

Is it possible to import an XML file into libvirt without having libvirt boot the virtual machine?

If I do:

virsh create centos63.xml

Then libvirt will import the XML file and immediately try to boot the image, and this isn't what I want.

(I have several scripts that take as argument a libvirt domain that corresponds to a VM that is not currently running, which is why I want to do this).

Best Answer

Yes, it is possible:

virsh # help define
  NAME
    define - define (but don't start) a domain from an XML file

  SYNOPSIS
    define <file>

  DESCRIPTION
    Define a domain.

  OPTIONS
    [--file] <string>  file containing an XML domain description