[libvirt] Allow to undefine a running domain

Eric Blake eblake at redhat.com
Fri Aug 19 13:39:16 UTC 2011


On 08/19/2011 08:03 AM, Osier Yang wrote:
> Per API virDomainUndefineFlags' doc says, if a domain is running,
> it will be converted to transient, but keep running. However,
> the drivers prohibit one undefining a running domain.
>
> This patch series modify the internal domainUndefineFlags function
> of all drivers (except some driver don't need to check if the
> domain is running, it's handled by the underlying hypervisor, such
> as ESX and XEND).
>
> The principle is:
>
> 1) Set vm->persistent = 0 for a running domain
> 2) domainDestroy and domainShutdown will take care of remove the
> domain obj from the hash table.

For hypervisors like qemu that already support transient domains, this 
is good.  But I worry that for hypervisors like esx, which currently 
have no notion of a transient domain, this is wrong (that is, esx 
domains are always persistent, because the domain state is maintained by 
esx and libvirt merely queries esx which domains exist, running or 
otherwise; if esx doesn't support transient domains natively, then 
libvirt can't fake it).  Thus, for domains where virDomainIsPersistent 
always returns true (such as esx), I think you need to keep the 
restriction that attempts to undefine a running domain are rejected, 
because the hypervisor lacks transient domain support.

>
> [PATCH 1/8] libxl: Allow to undefine a running domain
> [PATCH 2/8] lxc: Allow to undefine a running domain
> [PATCH 3/8] openvz: Allow to undefine a running domain
> [PATCH 4/8] qemu: Allow to undefine a running domain
> [PATCH 5/8] test: Allow to undefine a running domain
> [PATCH 6/8] uml: Allow to undefine a running domain
> [PATCH 7/8] vmware: Allow to undefine a running domain
> [PATCH 8/8] xen: Allow to undefine a running domain (xm_internal)
>
> Split the patches for easy reviewing, will merge when committing
> if need.

Nope, keep it separate; that way we can apply just the hypervisors that 
need it.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list