On Thu, Feb 2, 2012 at 2:08 PM, Eric Blake <eblake@xxxxxxxxxx> wrote: > Did you mean for this to go to the list? Yes, sorry :) > On 02/02/2012 12:04 PM, Paul Lussier wrote: >> On Thu, Feb 2, 2012 at 1:52 PM, Eric Blake <eblake@xxxxxxxxxx> wrote: >>> On 02/02/2012 11:33 AM, Whit Blauvelt wrote: >>>> Is there a way internal to a KVM VM to know which host it's running on? >>> >>> No. The ideal hypervisor is one where the guest doesn't even know it is >>> running as a virtual machine. And consider live migration - a guest >>> might not be running on the same host over its lifetime. Therefore, >>> there should be nothing that requires a guest to know which host it is >>> running on. >> >> From a system administration perspective, though, it's imperative to >> know what physical hosts your VMs are running on. Perhaps the VM >> itself doesn't know, but the sysadmin should be able to have some >> means of figuring this out in a dynamic manner, not simply by "keeping >> track" of where VMs are deployed. > > Yes, but that's a different question. It's not the guests' job to know > which host they are running on, rather, it's the management app _outside > of the guests_ that knows which hosts are running which guests. What do you mean by "management app", virt-manager, or something else ? >>> Why do you think you need it? Perhaps if you ask a better question >>> about what you are really trying to solve, we can give a better answer. >> >> Asset tracking, physical host trouble-shooting, etc. If I'm running >> an environment with 2K physical systems, each of which are running 20+ >> VMs, and someone reports a problem with vm-23475, it would be really >> nice to know that I can ask that VM where it is on my network and on >> what physical hosts. Especially if that VM has been around a while >> and possibly migrated to/from several physical systems. > > That's more a question you should be directing to your management app, > not to your guest. Your management app should know which host is > currently running vm-23475; you shouldn't have to directly query > vm-23475 itself (besides, if you treat guests as untrusted code, you > wouldn't want to rely on any answer vm-23475 gave you in the first place). While I agree with you in principle, my impression is that people are not treating guests as untrusted code, but rather, almost exactly like physical hosts. Perhaps I haven't had the luxury of being in a virtual environment where people are doing things the way they were intended :) -- Paul