[libvirt] [PATCH 1/4] Index hashes by UUID instead of name

Cole Robinson crobinso at redhat.com
Fri Jun 18 18:33:56 UTC 2010


On 06/18/2010 01:08 PM, Matthias Bolte wrote:
> 2010/6/17 Jiri Denemark <jdenemar at redhat.com>:
>> Per-connection hashes for domains, networks, storage pools and network
>> filter pools were indexed by names which was not the best choice. UUIDs
>> are better identifiers, so lets use them.
> 
> Well, the comments say the same: "UUID is better than the name has
> key", but why? Because they are more random than the name and might
> result in less collisions in the hash?
> 

A while ago, there was a bug with libvirt leaking domain references.
This caused hash table confusion if a user did:

- create VM named 'foobar'
- whoops, messed up config. delete VM 'foobar'
- create new VM named 'foobar'
- createXML errors obscurely

Leak fixed, solve the problem, but it shouldn't have caused issues in
the first place as long as UUID is different. Granted this change just
transfers that possible issue to UUIDs, possible in the case of define
$xml; undefine $xmlname; define $xml  but that's probably not as useful
a usecase.

Also keying off UUID might make implementing a rename API easier.

- Cole

> Also ID, name and UUID must be unique per domain anyway.
> 
>> ---
>> Â src/datatypes.c | Â  64 +++++++++++++++++++++++++++++++------------------------
>> Â 1 files changed, 36 insertions(+), 28 deletions(-)
>>
> 
> Anyway, ACK.
> 
> Matthias
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list