[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 192.168.122.1, but that depends on how the
guest was setup, and still doesn't guarantee that you can resolve it to
a FQDN.

> 
> 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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]