Jean-Pierre Ribeauville
2014-Jul-04 10:23 UTC
[libvirt-users] Acces to hypervisor from a KVM guest
Hi,>From a KVM guest, I want to retrieve the hostname of the host on which the hypervisor is running.Before doing that by using libvirt API, I first try via virsh. So, I run virsh and the run hostname command.( got that in virsh help : .... hostname print the hypervisor hostname ....) Unfortunately, I got following error when starting virsh : error: Failed to reconnect to the hypervisor error: no valid connection error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary) Do I miss to install some package on my KVM guest ? or is it not the right way to get this information ? Any help is welcome. Thx. [cid:image001.png@01CF75CE.35F97F50] Jean-Pierre RIBEAUVILLE Developer Tel: 01 49 11 45 81 Discover Systar's Videos!<https://www.youtube.com/channel/UCvyaJkMXCGFo8_XZYd9rcBw> P Please consider the environment before printing this e-mail
On 07/04/2014 04:23 AM, Jean-Pierre Ribeauville wrote:> Hi, > >>From a KVM guest, I want to retrieve the hostname of the host on which the hypervisor is running. > Before doing that by using libvirt API, I first try via virsh.Well, virsh just uses the libvirt API under the hood. I'd suggest that you try: virsh -c qemu://host/system hostname except that this is a chicken-and-egg situation, because virsh in the guest doesn't know what host to connect to. If you are using the out-of-the-box NAT setup, then you could use qemu://192.168.122.1/system, since your guest will be using an IP address assigned from that subnet from the host. Other than that, libvirt is not really designed for guest-to-host communication, but for host management of guests. You'll have to solve your problem in some other way. Consider the same situation with bare metal hosts - if you are provisioning a cluster, and want machines in the cluster to communicate to a particular controller, but not all machines connect to the same controller, how would you do that? If you can solve that problem, then you can use it to solve your guest provisioning problem.> error: Failed to reconnect to the hypervisor > error: no valid connection > error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)This failure is because you did not use -c to connect to a remote daemon, but don't have libvirtd running in the guest. You do not need libvirtd running locally to use virsh for remote connections, but you do need to know where the remote connection lives. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Reasonably Related Threads
- follow-up to thread : Acces to hypervisor from a KVM guest, ( by the way , how to enter a follow up in a thread ?) Thx
- How to retrieve legacy cgroups location ?
- Re: operation forbidden Read Only Access
- Using unix-type channel ....
- Re: about guest live migration configuration changes persistence ..