[libvirt-users] follow-up to thread : Acces to hypervisor from a KVM guest, ( by the way , how to enter a follow up in a thread ?) Thx

Jean-Pierre Ribeauville jean-pierre.ribeauville at systar.com
Sun Jul 6 14:45:40 UTC 2014


Hi,

This is what I tried :

Y , how enter    an answer in the thread ?)

virsh -c qemu+ssh://127.0.0.1:22/system  hostname root at 127.0.0.1's<mailto:root at 127.0.0.1's> password:

error: End of file while reading data: : Input/output error

error: failed to connect to the hypervisor



In another hand ,as we have few information  to share ,  I was thinking to use a virtio channel to dialog between host and guest .

Does it fit ?



Thx



J.P. ?



-----Message d'origine-----

De : Eric Blake [mailto:eblake at redhat.com] Envoyé : vendredi 4 juillet 2014 15:20 À : Jean-Pierre Ribeauville; libvirt-users at redhat.com<mailto:libvirt-users at redhat.com> Objet : Re: [libvirt-users] Acces to hypervisor from a KVM guest



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




[cid:image001.png at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140706/36b224af/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4806 bytes
Desc: image001.png
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140706/36b224af/attachment.png>


More information about the libvirt-users mailing list