5

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).

13

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
  • 4
    In addition it's worth noting that "virsh create" is creating a transient domain that will disappear when the VM is stopped, while "virsh define" is creating a persistent domain. See VM_lifecycle for more info. – Jerf Altair Jul 11 '13 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.