[libvirt-users] Using virsh to connect to ESX

Matthias Bolte matthias.bolte at googlemail.com
Thu May 17 09:06:44 UTC 2012

2012/5/17 Mauro Monteiro <maumontesilva at gmail.com>:
> Hello All,
> I have just started studying the libvirt and I am trying to connect to ESX
> Server (version 4) using virsh (version 0.7.5) using the following command:

libvirt/virsh 0.7.5 is quite old, if possible you should use a more
recent release. But this is just a recommendation, libvirt 0.7.5 will
work with ESX.

> virsh -c esx+ssh://root@<fully qualified hostname)>
> It inquires the root password and as soon as I inform the password it throws
> the error:
> error: cannot recv data: Connection reset by peer
> error: failed to connect to the hypervisor

As stated here http://libvirt.org/drvesx.html#uri the ESX driver does
not utilize the normal libvirt transport mechanism such as SSH.
Therefore esx+ssh:// doesn't work. The ESX driver uses the HTTP(S)
based vSphere API of the ESX server. The correct virsh call looks like

virsh -c esx://root@<fully qualified hostname>

If you did not replace the default self-signed SSL certificate on the
ESX server with you own certificate then this call will fail with a
certificate verification error. You can tell the ESX driver to not
verify the SSL certificate using

virsh -c esx://root@<fully qualified hostname>/?no_verify=1

> I can access my server using ssh. I am running it from Ubuntu 10.04 and the
> libvirt version 0.7.5. Can someone help me?

Do you used the Ubuntu provided libvirt package? That won't work,
because Ubuntu/Debian ship libvirt packages without ESX support. In
that case you'll need to build libvirt from source to get ESX support.

Matthias Bolte

More information about the libvirt-users mailing list