11

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

Lorin Hochstein
  • 5,028
  • 15
  • 56
  • 72

1 Answers1

18

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
dawud
  • 15,096
  • 3
  • 42
  • 61
  • 6
    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](http://wiki.libvirt.org/page/VM_lifecycle) for more info. – Jerf Altair Jul 11 '13 at 05:35