Hereward Cooper
2011-Mar-03 16:15 UTC
[libvirt-users] libvirt + ESX (HTTP response code 400 for call to 'Login')
Hi folks, I'm trying to connect to a vSphere cluster using the information from the libvirt documentation. ------------------- $ virsh -c "vpx://root at 10.51.4.11/dc1/dc1-cluster-e01/dc1-vsphere-e04/?no_verify=1" Enter root's password for 10.51.4.11: error: internal error HTTP response code 400 for call to 'Login' error: failed to connect to the hypervisor ------------------- I seem to be able to establish a connection, but it fails with a "HTTP code 400". If I provide the incorrect password it fails with a 'login credentials' error, so it looks like I am getting a connection, but it's failing for another reason. Wireshark is no help as it's all done over SSL/TLS. Any thoughts folks? I've tried various versions of libvirt up to the newest. When I put virsh into debug mode it returns this: ------------------- [snip] Enter root's password for 10.51.4.11: 15:19:09.011: debug : do_open:1249 : driver 3 ESX returned ERROR 15:19:09.011: debug : virUnrefConnect:294 : unref connection 0x98aa8f8 1 15:19:09.011: debug : virReleaseConnect:249 : release connection 0x98aa8f8 error: internal error HTTP response code 400 for call to 'Login' error: failed to connect to the hypervisor I've watched the vmware hostd.log file whilst trying to login, and it reports this error: ------------------- And the VMware hostd.log file reports this: ------------------- [2011-03-02 10:24:16.415 26AF8B90 verbose 'Proxysvc Req16870'] New proxy client SSL(TCP(local=10.4.100.26:34001, peer=10.51.4.103:443)) [2011-03-02 10:24:16.430 26933B90 error 'SoapAdapter'] Client sent us an invalid SOAP request: at line number 8, not well-formed (invalid token) ------------------- Any thoughts appreciated. Cheers. Coops.
Matthias Bolte
2011-Mar-03 21:52 UTC
[libvirt-users] libvirt + ESX (HTTP response code 400 for call to 'Login')
2011/3/3 Hereward Cooper <hereward.cooper at iomart.com>:> Hi folks, > > I'm trying to connect to a vSphere cluster using the information from > the libvirt documentation. > > > ------------------- > $ virsh -c > "vpx://root at 10.51.4.11/dc1/dc1-cluster-e01/dc1-vsphere-e04/?no_verify=1" > > Enter root's password for 10.51.4.11: > error: internal error HTTP response code 400 for call to 'Login' > error: failed to connect to the hypervisor > ------------------- > > I seem to be able to establish a connection, but it fails with a "HTTP > code 400". If I provide the incorrect password it fails with a 'login > credentials' error, so it looks like I am getting a connection, but it's > failing for another reason.400 means bad request. You probably have a character in you password that needs to be escaped in XML: <, >, &, ', " libvirt currently doesn't escape the password properly when building the SOAP request. You can manually workaround this by entering the password in escaped form. For example when your password is some&word enter some&word instead. I posted a patch to fix this: https://www.redhat.com/archives/libvir-list/2011-March/msg00118.html> Wireshark is no help as it's all done over SSL/TLS.By default libvirt uses HTTPS to talk to vSphere server. You can disable TLS by using the transport=http query parameter like this virsh -c "vpx://root at 10.51.4.11/dc1/dc1-cluster-e01/dc1-vsphere-e04/?no_verify=1&transport=http" But you'll have to configure the vCenter server to accept HTTP connections if you want use this. Matthias