[libvirt] [PATCH] conf: Do not load domain if the domain with same already exists

Eric Blake eblake at redhat.com
Tue Aug 16 14:58:03 UTC 2011


On 08/16/2011 09:05 AM, Osier Yang wrote:
> We don't allow to define domain with same name and different UUID,
> or with same UUID, so it's reasonable to not load the domain config
> if there is domain with same name already exists.
>
> Otherwise it can cause problem like:
>
> 1) % cp /etc/libvirt/qemu/dom.xml /etc/libvirt/qemu/dom_diffuuid.xml
 > 2) remove the line with "uuid" in the "dom_diffuuid.xml"

This is invalid.  Users should not be mucking with /etc/libvirt, but 
rather going through libvirt APIs.  Is there any way, using only libvirt 
APIs, where /etc/libvirt can end up with a domain without a uuid?  If 
not, then NACK to this patch, and instead fix the test scenario that was 
driving this patch to quit going behind libvirt's back.

> There will be 11 domains listed with the same name, as if there is
> no UUID specified in domain XML, libvirt will generate one for it,
> which will be definitely different with the original one.

Libvirt should have already generated a uuid for all domains already in 
/etc/libvirt; if there is no way for /etc/libvirt to have a domain 
without a uuid in /etc/libvirt short of going behind libvirt's back, 
then doing a name lookup won't buy us any safety.

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




More information about the libvir-list mailing list