fyafighter / pysphere

Automatically exported from code.google.com/p/pysphere
0 stars 0 forks source link

No response to a get_hosts request when targeting vCenter 5.5, but an ESXi 5.5 host works fine. #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using pysphere 0.1.8. I can connect to ESXi 5.5 hosts just fine and invoke 
methods like get_hosts, get_datacenters, etc... without problem.

However, after successfully connecting to a vCenter 5.5 host, gets_hosts, 
get_datacenters, etc... raise an exception:

  File "/home/mpietrek/pyspheretest.py", line 15, in <module>
    hosts = server.get_hosts()
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/vi_server.py", line 179, in get_hosts
    return self._get_managed_objects(MORTypes.HostSystem, from_mor)
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/vi_server.py", line 792, in _get_managed_objects
    obj_type=mo_type)
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/vi_server.py", line 717, in _retrieve_properties_traversal
    return request_call(request)
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/vi_server.py", line 733, in call_retrieve_properties_ex
    request)._returnval
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/resources/VimService_services.py", line 114, in RetrievePropertiesEx
    response = self.binding.Receive(RetrievePropertiesExResponseMsg.typecode)
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/ZSI/client.py", line 540, in Receive
    self.ReceiveSOAP(**kw)
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/ZSI/client.py", line 423, in ReceiveSOAP
    if not self.IsSOAP():
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/ZSI/client.py", line 415, in IsSOAP
    self.ReceiveRaw()
  File "/usr/local/lib/python2.6/dist-packages/pysphere-0.1.8-py2.6.egg/pysphere/ZSI/client.py", line 382, in ReceiveRaw
    response = self.local.h.getresponse()
  File "/usr/lib/python2.6/httplib.py", line 986, in getresponse
    response.begin()
  File "/usr/lib/python2.6/httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.6/httplib.py", line 355, in _read_status
    raise BadStatusLine(line)

The vCenter server is working exactly like I'd expect. I can connect to it via 
the web client, interact with it, etc...

Here's the code:
----
from pysphere import VIServer
server = VIServer()
server.connect("myhost", "test-stack@system-domain", "foobar", 
hosts = server.get_hosts()
----

The test-stack account has administrator privileges.

The SOAP trace is as follows:

_________________________________ Tue Jan 28 23:14:49 2014 REQUEST:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-EN
V:Header><SOAP-ENV:Body 
xmlns:ns1="urn:vim25"><ns1:RetrieveServiceContent><ns1:_this 
type="ServiceInstance">ServiceInstance</ns1:_this></ns1:RetrieveServiceContent><
/SOAP-ENV:Body></SOAP-ENV:Envelope>
_________________________________ Tue Jan 28 23:14:49 2014 RESPONSE:
200
OK
-------
Date: Tue, 28 Jan 2014 23:14:19 GMT
Set-Cookie: vmware_soap_session="52ec9b37-6aac-230b-58e9-9367a1f9d187"; Path=/; 
HttpOnly; Secure; 
Cache-Control: no-cache
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
Content-Length: 3486

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RetrieveServiceContentResponse xmlns="urn:vim25"><returnval><rootFolder 
type="Folder">group-d1</rootFolder><propertyCollector 
type="PropertyCollector">propertyCollector</propertyCollector><viewManager 
type="ViewManager">ViewManager</viewManager><about><name>VMware vCenter 
Server</name><fullName>VMware vCenter Server 5.5.0 
build-1398495</fullName><vendor>VMware, 
Inc.</vendor><version>5.5.0</version><build>1398495</build><localeVersion>INTL</
localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLi
neId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVers
ion><instanceUuid>EAD1915F-A137-43D9-A24B-9D9C55E1B9F3</instanceUuid><licensePro
ductName>VMware VirtualCenter 
Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></a
bout><setting type="OptionManager">VpxSettings</setting><userDirectory 
type="UserDirectory">UserDirectory</userDirectory><sessionManager 
type="SessionManager">SessionManager</sessionManager><authorizationManager 
type="AuthorizationManager">AuthorizationManager</authorizationManager><serviceM
anager type="ServiceManager">ServiceMgr</serviceManager><perfManager 
type="PerformanceManager">PerfMgr</perfManager><scheduledTaskManager 
type="ScheduledTaskManager">ScheduledTaskManager</scheduledTaskManager><alarmMan
ager type="AlarmManager">AlarmManager</alarmManager><eventManager 
type="EventManager">EventManager</eventManager><taskManager 
type="TaskManager">TaskManager</taskManager><extensionManager 
type="ExtensionManager">ExtensionManager</extensionManager><customizationSpecMan
ager 
type="CustomizationSpecManager">CustomizationSpecManager</customizationSpecManag
er><customFieldsManager 
type="CustomFieldsManager">CustomFieldsManager</customFieldsManager><diagnosticM
anager type="DiagnosticManager">DiagMgr</diagnosticManager><licenseManager 
type="LicenseManager">LicenseManager</licenseManager><searchIndex 
type="SearchIndex">SearchIndex</searchIndex><fileManager 
type="FileManager">FileManager</fileManager><virtualDiskManager 
type="VirtualDiskManager">virtualDiskManager</virtualDiskManager><snmpSystem 
type="HostSnmpSystem">SnmpSystem</snmpSystem><vmProvisioningChecker 
type="VirtualMachineProvisioningChecker">ProvChecker</vmProvisioningChecker><vmC
ompatibilityChecker 
type="VirtualMachineCompatibilityChecker">CompatChecker</vmCompatibilityChecker>
<ovfManager type="OvfManager">OvfManager</ovfManager><ipPoolManager 
type="IpPoolManager">IpPoolManager</ipPoolManager><dvSwitchManager 
type="DistributedVirtualSwitchManager">DVSManager</dvSwitchManager><hostProfileM
anager 
type="HostProfileManager">HostProfileManager</hostProfileManager><clusterProfile
Manager 
type="ClusterProfileManager">ClusterProfileManager</clusterProfileManager><compl
ianceManager 
type="ProfileComplianceManager">MoComplianceManager</complianceManager><localiza
tionManager 
type="LocalizationManager">LocalizationManager</localizationManager><storageReso
urceManager 
type="StorageResourceManager">StorageResourceManager</storageResourceManager><gu
estOperationsManager 
type="GuestOperationsManager">guestOperationsManager</guestOperationsManager></r
eturnval></RetrieveServiceContentResponse>
</soapenv:Body>
</soapenv:Envelope>
_________________________________ Tue Jan 28 23:14:49 2014 REQUEST:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-EN
V:Header><SOAP-ENV:Body xmlns:ns1="urn:vim25"><ns1:Login><ns1:_this 
type="SessionManager">SessionManager</ns1:_this><ns1:userName>test-stack@system-
domain</ns1:userName><ns1:password>foobar</ns1:password></ns1:Login></SOAP-ENV:B
ody></SOAP-ENV:Envelope>
_________________________________ Tue Jan 28 23:14:49 2014 RESPONSE:
200
OK
-------
Date: Tue, 28 Jan 2014 23:14:20 GMT
Cache-Control: no-cache
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
Content-Length: 818

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<LoginResponse 
xmlns="urn:vim25"><returnval><key>52a261b1-03c8-dd17-317d-8dc3a6dbe6c5</key><use
rName>SYSTEM-DOMAIN\test-stack</userName><fullName> 
</fullName><loginTime>2014-01-28T23:14:20.180665Z</loginTime><lastActiveTime>201
4-01-28T23:14:20.180665Z</lastActiveTime><locale>en</locale><messageLocale>en</m
essageLocale><extensionSession>false</extensionSession><ipAddress>10.1.2.60</ipA
ddress><userAgent>VMware VI 
Client/5.0.0</userAgent><callCount>0</callCount></returnval></LoginResponse>
</soapenv:Body>
</soapenv:Envelope>
_________________________________ Tue Jan 28 23:14:53 2014 REQUEST:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-EN
V:Header><SOAP-ENV:Body 
xmlns:ns1="urn:vim25"><ns1:RetrievePropertiesEx><ns1:_this 
type="PropertyCollector">propertyCollector</ns1:_this><ns1:specSet><ns1:propSet>
<ns1:type>HostSystem</ns1:type><ns1:pathSet>name</ns1:pathSet></ns1:propSet><ns1
:objectSet><ns1:obj 
type="Folder">group-d1</ns1:obj><ns1:skip>false</ns1:skip><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>visitFolders</ns1:name><ns1:type>Folder</
ns1:type><ns1:path>childEntity</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSe
t><ns1:name>visitFolders</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name>dcTo
Hf</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name>dcToVmf</ns1:name></ns1:se
lectSet><ns1:selectSet><ns1:name>crToH</ns1:name></ns1:selectSet><ns1:selectSet>
<ns1:name>crToRp</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name>dcToDs</ns1:
name></ns1:selectSet><ns1:selectSet><ns1:name>hToVm</ns1:name></ns1:selectSet><n
s1:selectSet><ns1:name>dsToVm</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name
>rpToVm</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>dcToVmf</ns1:name><ns1:type>Datacenter</n
s1:type><ns1:path>vmFolder</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSet><n
s1:name>visitFolders</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>dcToDs</ns1:name><ns1:type>Datacenter</ns
1:type><ns1:path>datastore</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSet><n
s1:name>visitFolders</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>dcToHf</ns1:name><ns1:type>Datacenter</ns
1:type><ns1:path>hostFolder</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSet><
ns1:name>visitFolders</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>crToH</ns1:name><ns1:type>ComputeResource
</ns1:type><ns1:path>host</ns1:path><ns1:skip>false</ns1:skip></ns1:selectSet><n
s1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>crToRp</ns1:name><ns1:type>ComputeResourc
e</ns1:type><ns1:path>resourcePool</ns1:path><ns1:skip>false</ns1:skip><ns1:sele
ctSet><ns1:name>rpToRp</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name>rpToVm
</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>rpToRp</ns1:name><ns1:type>ResourcePool</
ns1:type><ns1:path>resourcePool</ns1:path><ns1:skip>false</ns1:skip><ns1:selectS
et><ns1:name>rpToRp</ns1:name></ns1:selectSet><ns1:selectSet><ns1:name>rpToVm</n
s1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>hToVm</ns1:name><ns1:type>HostSystem</ns1
:type><ns1:path>vm</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSet><ns1:name>
visitFolders</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>dsToVm</ns1:name><ns1:type>Datastore</ns1
:type><ns1:path>vm</ns1:path><ns1:skip>false</ns1:skip><ns1:selectSet><ns1:name>
visitFolders</ns1:name></ns1:selectSet></ns1:selectSet><ns1:selectSet 
xsi:type="ns1:TraversalSpec"><ns1:name>rpToVm</ns1:name><ns1:type>ResourcePool</
ns1:type><ns1:path>vm</ns1:path><ns1:skip>false</ns1:skip></ns1:selectSet></ns1:
objectSet></ns1:specSet><ns1:options></ns1:options></ns1:RetrievePropertiesEx></
SOAP-ENV:Body></SOAP-ENV:Envelope>

Original issue reported on code.google.com by mpiet...@skytap.com on 28 Jan 2014 at 11:30