Import XML into libvirt without booting virtual machine

25,037

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
Share:
25,037

Related videos on Youtube

Lorin Hochstein
Author by

Lorin Hochstein

Updated on September 18, 2022

Comments

  • Lorin Hochstein
    Lorin Hochstein almost 2 years

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

  • Mike Wilson
    Mike Wilson almost 11 years
    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.