[Libvir] uuid string format
Daniel P. Berrange
berrange at redhat.com
Mon May 22 22:14:32 UTC 2006
On Tue, May 23, 2006 at 12:02:09AM +0200, Karel Zak wrote:
> On Po, kv?? 22, 2006 at 09:52:35 -0400, Daniel Veillard wrote:
> > On Mon, May 22, 2006 at 03:45:04PM +0200, Karel Zak wrote:
> > >
> > > Hello,
> > >
> > > I've found that we use in our XML dump:
> > >
> > > <uuid>%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x</uuid>
> > >
> > > it's strange format of the UUID string representation. Is there any
> > > reason for this format? I think normal (rfc4122) is format:
> > >
> > > "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
> > >
> > > it means with '-'.
> >
> > RFC 4122 is for URN embedding, that's a specific use. We are not following
> > that syntax anyway since it's not an URN, we really don't need to encode this
> > as an URI, only as an unambiguous ASCII string, and the current format does
> > the job minimally.
>
> Well, for example "xm list --long" uses the format with '-' (and
> xend, filesystems, and ... everywhere). I think it's better follow
> old manners although we don't need it.
More importantly than tradition - the printable formatting of UUIDs is quite
often visible to humans, where the chunked formatting greatly increases
readability - one can much more easily compare two UUIDs in chunked encoding.
So, given its a mere 4 extra characters I think its definitely worthwhile.
> I've commited virDomainGetUUIDString() and virDomainLookupByUUIDString()
> functions and the virsh command supports domain look up by UUID now.
>
> All these changes use '-' format ;-) It's nothing important, but I
> think it's better support conversion from/to UUID string in the
> library rather than duplicate this code in every libvirt application.
> Now we use UUID in gnome-virt-manager (+ in dbus API), virsh and my
> plan is use it also in gnome-applet-vm.
Great - as you say I'd already had to written such code in both the Perl
bindings & the gnome-virt-manager application, so this will usefully
removely that duplication.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the libvir-list
mailing list