Re: Can a VM tell what host it's on?

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

 



On 02/02/2012 11:54 AM, Brian K. White wrote:
> On 2/2/2012 1:41 PM, Bryan Kearney wrote:
>> On 02/02/2012 01:33 PM, Whit Blauvelt wrote:
>>> Is there a way internal to a KVM VM to know which host it's running on?
>>>
>>> It could send a command via ssh to virsh on a host, and learn from that
>>> whether the host currently has it running. But is there something
>>> within the
>>> VM itself which will reveal this?
>>>
>>> Thanks,
>>> Whit
>>
>>
>> I was under the impression that without some creative uses of DMI, this
>> could not be done.
>>
>> -- bk
> 
> No idea what is or is not in the code in this regard, but as a purely
> conceptual thought, why couldn't the host elect to put a small amount of
> info, whatever the admin wishes, into the fake nvram presented to the vm
> for it's bios?

Yes, the host can pass through information visible through the guest's
SMBIOS.  In fact, libvirt even supports a passthrough mode for SMBIOS
information, where the host's information (except for UUID) is copied to
the guest; http://libvirt.org/formatdomain.html#elementsOSBIOS (under
<os>, use <smbios mode='host'/>).  But note that this is only valid from
the time the guest was started; SMBIOS information is read-only, and
must not modify itself on the fly when the guest is migrated, so you
cannot assume that what the guest reads out of SMBIOS via 'dmidecode' is
still pertaining to the host currently running guest.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux