[virt-tools-list] [KVM] : Identify KVM-Host from inside the KVM-Guest

Eric Blake eblake at redhat.com
Tue Nov 15 04:59:06 UTC 2011

On 11/14/2011 09:37 PM, Anand Nande wrote:
> Hi,
> Is there a way to identify the KVM Host on which a KVM-Guest is running
> - all this from inside the KVM-Guest.

Not reliably.  Think about it - if your guest can be migrated at will
between hosts, then the answer is prone to changing on a whim, anyways.
 Furthermore, the sign of an ultimate virtualization is that the guest
cannot detect that it was virtualized (the virt-what utility only works
insofar as the host is not an ultimate invisible setup, but it is
subject to false negatives).

If your guest was set up by the host to use default NAT networking, then
the host can be reached at, but that depends on how the
guest was setup, and still doesn't guarantee that you can resolve it to

> Any 'virsh' options or any files that can tell me the name of the
> parent-KVM-Host running this particular KVM-Guest?
> [in the form of the KVM-hosts ipaddress or hostname]

Now that's a different question.  'virsh hostname' tells you the
hostname that a particular connection believes itself to be on; thus,
'virsh -c qemu+ssh//somehost/system hostname' would (hopefully) return a
proper FQDN for somehost, depending on everything else in your network
having sane configurations.  But virsh runs on the host, not within the
guest, so it wasn't the answer you want for a guest being able to learn
this information.

> PS:
> I am trying to figure this out - while taking a direct-VNC connection to
> a Fedora-15 Guest being hosted by a Fedora-16 KVM host.
> I have tried using virt-what which just gives the type of hypervisor or
> the version of the KVM (inside the KVM-guest):

Yep, that's all the better virt-what can do.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20111114/d641bfe6/attachment.sig>

More information about the virt-tools-list mailing list