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
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users