ParseError on CreateCollectorForTasks.ReadNextTasks(10)
Open
@tianhao64 is already working on this.
Since May 19, 2016.
bug
high priority
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
We had an incident at a customer side today with the following piece of code:
from pyVmomi import vim
filter_spec = vim.TaskFilterSpec(alarm=None, scheduledTask=None, state=["running", "queued"])
collector = client.service_content.taskManager.CreateCollectorForTasks(filter_spec)
while True:
tasks = collector.ReadNextTasks(10)
if len(tasks) == 0:
break
for task in tasks:
yield task
collector.DestroyCollector()
The traceback is:
File "src/infi/vendata/vmware_powertools/vcenter/stale_tasks.py", line 9, in _get_all_running_tasks
tasks = collector.ReadNextTasks(10)
File "eggs/pyvmomi-5.5.0.1-py2.7.egg/pyVmomi/VmomiSupport.py", line 569, in <lambda>
self.f(*(self.args + (obj,) + args), **kwargs)
File "eggs/pyvmomi-5.5.0.1-py2.7.egg/pyVmomi/VmomiSupport.py", line 378, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "eggs/pyvmomi-5.5.0.1-py2.7.egg/pyVmomi/SoapAdapter.py", line 1292, in InvokeMethod
raise exc
ParserError: 'xml document: <?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"\n xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:xsd="http://www.w3.org/2001/XMLSchema"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n<soapenv:Body>\n<ReadNextTasksResponse xmlns="urn:vim25"><returnval><key>task-3996443</key><task type="Task">task-3996443</task><description><key>com.vmware.vdp2.task.description</key><arg><key>workOrderId</key><value xsi:type="xsd:string">cp.20141020150650</value></arg></description><descriptionId>com.vmware.vdp2.integritycheck</descriptionId><entity type="VirtualMachine">vm-133364</entity><entityName>VDP3</entityName><state>running</state><cancelled>false</cancelled><cancelable>true</cancelable><reason xsi:type="TaskReasonUser"><userName>vmware\\sa-vdp3</userName></reason><queueTime>2014-10-20T15:09:08.789999Z</queueTime><startTime>2014-10-20T15:09:09.073Z</startTime><eventChainId>21691195</eventChainId></returnval><returnval><key>task-1178117</key><task type="Task">task-1178117</task><descriptionId>com.vmware.vcIntegrity.CheckNotificationTask</descriptionId><entity type="Folder">group-d1</entity><entityName>Datacenters</entityName><state>queued</state><cancelled>false</cancelled><cancelable>true</cancelable><reason xsi:type="TaskReasonSchedule"><name>VMware vSphere Update Manager Check Notification</name><scheduledTask type="ScheduledTask">schedule-2</scheduledTask></reason><queueTime>2013-01-08T14:12:01.556999Z</queueTime><eventChainId>3410272</eventChainId></returnval><returnval><key>task-746590</key><task type="Task">task-746590</task><name>LeaseMapDiskRegion</name><descriptionId>host.DiskManager.Lease.MapDiskRegion</descriptionId><entity type="VirtualMachine">vm-982</entity><entityName>Applicure</entityName><state>queued</state><cancelled>false</cancelled><cancelable>false</cancelable><reason xsi:type="TaskReasonUser"><userName>VMWARE\\sa-veeam1</userName></reason><queueTime>2012-09-27T12:03:03.412999Z</queueTime><eventChainId>2325872</eventChainId></returnval><returnval><key>task-56327</key><task type="Task">task-56327</task><name>LeaseMapDiskRegion</name><descriptionId>host.DiskManager.Lease.MapDiskRegion</descriptionId><entity type="VirtualMachine">vm-1010</entity><entityName>vCD-Oracle</entityName><state>queued</state><cancelled>false</cancelled><cancelable>false</cancelable><reason xsi:type="TaskReasonUser"><userName>VMWARE\\sa-veeam1</userName></reason><queueTime>2012-02-27T10:56:50.656999Z</queueTime><eventChainId>345916</eventChainId></returnval></ReadNextTasksResponse>\n</soapenv:Body>\n</soapenv:Envelope> parse error at: line:7, col:1377'
The error is in line7 column 1337, which is the '/' in the ending name tag ... task-746590</task><name>LeaseMapDiskRegion</name>
with proper indentation, the response looks legit:
<?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>
<ReadNextTasksResponse xmlns="urn:vim25">
<returnval>
<key>task-3996443</key>
<task type="Task">task-3996443</task>
<description>
<key>com.vmware.vdp2.task.description</key>
<arg>
<key>workOrderId</key>
<value xsi:type="xsd:string">cp.20141020150650</value>
</arg>
</description>
<descriptionId>com.vmware.vdp2.integritycheck</descriptionId>
<entity type="VirtualMachine">vm-133364</entity>
<entityName>VDP3</entityName>
<state>running</state>
<cancelled>false</cancelled>
<cancelable>true</cancelable>
<reason xsi:type="TaskReasonUser">
<userName>vmware\\sa-vdp3</userName>
</reason>
<queueTime>2014-10-20T15:09:08.789999Z</queueTime>
<startTime>2014-10-20T15:09:09.073Z</startTime>
<eventChainId>21691195</eventChainId>
</returnval>
<returnval>
<key>task-1178117</key>
<task type="Task">task-1178117</task>
<descriptionId>com.vmware.vcIntegrity.CheckNotificationTask</descriptionId>
<entity type="Folder">group-d1</entity>
<entityName>Datacenters</entityName>
<state>queued</state>
<cancelled>false</cancelled>
<cancelable>true</cancelable>
<reason xsi:type="TaskReasonSchedule">
<name>VMware vSphere Update Manager Check Notification</name>
<scheduledTask type="ScheduledTask">schedule-2</scheduledTask>
</reason>
<queueTime>2013-01-08T14:12:01.556999Z</queueTime>
<eventChainId>3410272</eventChainId>
</returnval>
<returnval>
<key>task-746590</key>
<task type="Task">task-746590</task>
<name>LeaseMapDiskRegion</name>
<descriptionId>host.DiskManager.Lease.MapDiskRegion</descriptionId>
<entity type="VirtualMachine">vm-982</entity>
<entityName>Applicure</entityName>
<state>queued</state>
<cancelled>false</cancelled>
<cancelable>false</cancelable>
<reason xsi:type="TaskReasonUser">
<userName>VMWARE\\sa-veeam1</userName>
</reason>
<queueTime>2012-09-27T12:03:03.412999Z</queueTime>
<eventChainId>2325872</eventChainId>
</returnval>
<returnval>
<key>task-56327</key>
<task type="Task">task-56327</task>
<name>LeaseMapDiskRegion</name>
<descriptionId>host.DiskManager.Lease.MapDiskRegion</descriptionId>
<entity type="VirtualMachine">vm-1010</entity>
<entityName>vCD-Oracle</entityName>
<state>queued</state>
<cancelled>false</cancelled>
<cancelable>false</cancelable>
<reason xsi:type="TaskReasonUser">
<userName>VMWARE\\sa-veeam1</userName>
</reason>
<queueTime>2012-02-27T10:56:50.656999Z</queueTime>
<eventChainId>345916</eventChainId>
</returnval>
</ReadNextTasksResponse>
</soapenv:Body>
</soapenv:Envelope>
This was against vCenter 5.1, don't know which update, but I can find out.
I'll try tomorrow to re-create this tomorrow by creating a task with a name attribute
Does anyone has more insight about this?
Thanks,
Guy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.