I'm actually testing RHEL 5.3 with Xen between two servers in order to have a disaster recovery solution. So I'm playing with moving my domU from one dom0 server to the other server.

Unfortunatly when somebody else move the domU I don't have any clue where my domain is hosted. I'm wondering where I can't find my dom0 name with inside domU. I'm looking for something like the gzonename command on a solaris sparse zone. I check inside /proc/xen but I don't see anything special except the dom0 kernel release.

Does anybody know a wait to find this ?

link|improve this question
What benefit is there to having a domU know its dom0's hostname? – SirStan Aug 20 '09 at 23:11
1  
If you want to add some memory or disk, it's better to know on which dom0 you have to connect. – svigan Aug 20 '09 at 23:23
Surprised that it's 2 years since this was asked, and no real answer has been provided. I'm searching for the same thing at the moment - how to identify the dom0 that a domU I'm logged into is physically running on. – dossy Mar 1 at 18:40
feedback

4 Answers

I'm pretty sure there's no way to find the dom0 "name" (which is a nebulous concept at best) from within the domU. If you're not running pygrub, you could add something to the kernel boot command line (in the domU config file stored on each dom0) that you could query from /proc/cmdline, but that's a bit of a hack.

What you really should be doing is having a script that can query the dom0s to display which VMs are where. Even something that looped through the dom0s and ran xm list would probably do for your simple purposes.

link|improve this answer
Actually what I'm doing is starting the dom0 with a home made script which create a /etc/hvname file within the name of the dom0. – svigan Aug 20 '09 at 23:37
feedback

I found a clever solution (which I can't take credit for): add a parameter to the Xen script to tell the domU which dom0 it's running on

link|improve this answer
Since the kernel will ignore anything that it does not undestand - ok. But this will propably not work in a live-migrate (i.e. the kernel-parameter will not change after the move). – Nils May 18 '11 at 19:56
feedback

SLES11 has a "clever" solution provided by two rpms:

The first runs on the Dom0 and creates a small ram-disk (loop-device in /dev/shm). That ram-disk is attached in ro/read many-mode to the Dom0. Then a daemon-process in Dom0 updates some information in the ram-disk at configurable intervals (Dom0-hostname, cpu-load of the Dom0, ...).

The second runs in the DomU and reads the values of that attached ram-disk.

See SLES11 XEN Documentation for further details...

link|improve this answer
feedback

We use "xenstore-write /tool/hostname $(uname -n); xenstore-chmod /tool/hostname r" on Dom0 and then "xenstore-read /tool/hostname" within the VMs. Easy and lightweight ...

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.