[Libvir] Guest Identification

Daniel P. Berrange berrange at redhat.com
Fri Aug 11 13:19:44 UTC 2006

On Fri, Aug 11, 2006 at 09:05:12AM -0400, Daniel Veillard wrote:
> On Thu, Aug 10, 2006 at 04:28:20PM -0400, Juan Walker wrote:
> > On 8/10/06, Daniel Veillard <veillard at redhat.com> wrote:
> > >  Domains have an unique identifier which you can extract:
> > >    http://libvirt.org/html/libvirt-libvirt.html#virDomainGetUUID
> > 
> > 
> > Ah, great! Thanks. Is it possible for me to find out the UUID from something
> > running on domU? I need to have the application connect to the server and
> > identify the information it's sending as being from its specific domain. Any
> > ideas?
>   Oh, I don't think domU has access to that information, libvirt is meant to be
> used on dom0, won't work in domU.

Yeah it is not a job for libvirt, but you  can get this info within DomU if you
are using recent enough Xen tools (xen-unstable / forthcoming Xen 3.0.3)
In fully-virt (HVM) guests you can query the SMBIOS for it using DMIDecode.

# dmidecode  | grep --after 7 'Handle 0x0001'
Handle 0x0001
        DMI type 1, 25 bytes.
        System Information
                Manufacturer: IBM
                Product Name: 2672JHG
                Version: ThinkPad X31
                Serial Number: KBPKNB2
                UUID: EF861801-45B9-11CB-88E3-AFBFE5370493

Incidentally if you want a sensible UUID for Domain0 rather than the one Xen
gives (0000000-00000-0000-0000-000000) then you can again use DMIDecode to
get the UUID associated with the physical machine - this example above is from
my laptop in Domain-0.

On para-virt guests you can get the UUID from a file in sysfs:


As I say above though both of these tricks require a fairly recent set of
Xen tools from xen-unstable.  Failing that you could do some tricks such as
passing the UUID on the kernel boot command line when starting the DomU 
instance and then access that from /proc/cmdline.

|=- 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