Question

How can I create a transient domain using libvirt? (Using QEMU/KVM as back-end)

The documentation discusses the difference between transient and persistent domains at this link: http://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains

Still, I haven't found any concrete example on how to create one.

The only pointer I found is in this email: https://www.redhat.com/archives/libvirt-users/2011-August/msg00057.html, where the maintainer suggests to add the <transient/> tag in the <disk> field of the XML's description.

When I tried, I got this disappointing answer: "libvirtError: unsupported configuration: transient disks not supported yet".

Is this feature really "not supported yet", or am I missing something? The documentation makes me think that this should be supported.

Any answer related to the C or Python binding, virsh, or virt-manager will be highly appreciated!

Was it helpful?

Solution

Using virsh

If you are using virsh, than there are commands:

  • define -- This command takes an XML file as it's parameter and makes the domain known to libvirt (you can reference that domain by using its name or UUID).

  • start -- This command takes the domain name or UUID as its parameter and starts (boots) the domain.

  • create -- This command takes an XML file as it's parameter and creates (starts) the domain with settings described in that file. Depending on whether the domain is known to libvirt (previously defined with that UUID) it may result in two things:

    • if it is already defined, the known domain is marked as started, it is persistent domain, but it is started with the settings supplied and not those it was defined with).

    • in case it is not defined, the domain started is now a transient domain (it disappears when it is destroyed, shuts down, etc.).

  • undefine -- This command takes a domain name or UUID (or ID if it's started) and makes it unknown to libvirt, but if that domain is running it doesn't destroy it, just marks it transient.

C functions

In C, the APIs that virsh is using for these commands are:

Notes:

  • The names may be a little bit confusing, but due to backward compatibility it is kept from Xen times.

  • Most of those mention commands have parameters which may alter the behavior, these may cause using different C functions for the purpose.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top