pyvmomi icon indicating copy to clipboard operation
pyvmomi copied to clipboard

Facing Parse error while querying config options of a VM using EnvironmentBrowser

Open GOVETIQK opened this issue 5 years ago • 7 comments

Facing Parse error while trying to query config options of a vm using environment browser. The Function is working fine in MOB console and a Html is returned with all the values but pyvmomi is throwing the parse error. This issue is only seen in case of vSphere 7 and is working fine for vSphere 6.x. .

pyvmomi version : 7.0

Following is the stack trace produced when running the python file error.py which invokes this function : <vm_object>.environmentBrowser.QueryConfigOptionEx()

python3 error.py

Traceback (most recent call last):
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 742, in EndElementHandler
obj = GuessWsdlType(name)
File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 1192, in GuessWsdlType
raise UnknownWsdlTypeError(name)
pyVmomi.VmomiSupport.UnknownWsdlTypeError: 'VirtualQAT'During handling of the above exception, another exception occurred:Traceback (most recent call last):
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 514, in ParseData
parser.ParseFile(data)
File "../Modules/pyexpat.c", line 473, in EndElement
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 744, in EndElementHandler
raise TypeError(data)
TypeError: VirtualQATDuring handling of the above exception, another exception occurred:Traceback (most recent call last):
File "getAllVMs.py", line 29, in <module>
details = vms[0].environmentBrowser.QueryConfigOptionEx()
File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 706, in <lambda>
self.f(*(self.args + (obj,) + args), **kwargs)
File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 1388, in InvokeMethod
raise exc
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 1378, in InvokeMethod
obj = deserializer.Deserialize(fd, info.result)
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 845, in Deserialize
ParseData(self.parser, response)
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 525, in ParseData
reraise(ParserError, pe, tb)
File "mydir/python3.6/site-packages/six.py", line 702, in reraise
raise value.with_traceback(tb)
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 514, in ParseData
parser.ParseFile(data)
File "../Modules/pyexpat.c", line 473, in EndElement
File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 744, in EndElementHandler
raise TypeError(data)
pyVmomi.SoapAdapter.ParserError: 'xml document: <http.client.HTTPResponse object at 0x7f235aa39390> parse error at: line:7, col:90985'python3 error.py
Traceback (most recent call last):
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 742, in EndElementHandler
  obj = GuessWsdlType(name)
 File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 1192, in GuessWsdlType
  raise UnknownWsdlTypeError(name)
pyVmomi.VmomiSupport.UnknownWsdlTypeError: 'VirtualQAT'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 514, in ParseData
  parser.ParseFile(data)
 File "../Modules/pyexpat.c", line 473, in EndElement
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 744, in EndElementHandler
  raise TypeError(data)
TypeError: VirtualQAT
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "getAllVMs.py", line 29, in <module>
  details = vms[0].environmentBrowser.QueryConfigOptionEx()
 File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 706, in <lambda>
  self.f(*(self.args + (obj,) + args), **kwargs)
 File "mydir/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
  return self._stub.InvokeMethod(self, info, args)
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 1388, in InvokeMethod
  raise exc
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 1378, in InvokeMethod
  obj = deserializer.Deserialize(fd, info.result)
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 845, in Deserialize
  ParseData(self.parser, response)
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 525, in ParseData
  reraise(ParserError, pe, tb)
 File "mydir/python3.6/site-packages/six.py", line 702, in reraise
  raise value.with_traceback(tb)
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 514, in ParseData
  parser.ParseFile(data)
 File "../Modules/pyexpat.c", line 473, in EndElement
 File "mydir/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 744, in EndElementHandler
  raise TypeError(data)
pyVmomi.SoapAdapter.ParserError: 'xml document: <http.client.HTTPResponse object at 0x7f235aa39390> parse error at: line:7, col:90985'

File : error.py

from pyVim import connect
from pyVmomi import vmodl
from pyVmomi import vim
import traceback

def get_all_vms(config):
    vms = []
    try:
        service_instance = connect.SmartConnectNoSSL(host=config['host'], user=config['user'],
                                                     pwd=config['password'], port=int(config['port']))
        content = service_instance.RetrieveContent()
        container = content.rootFolder
        view_type = [vim.VirtualMachine]
        recursive = True
        container_view = content.viewManager.CreateContainerView(container, view_type, recursive)
        children = container_view.view
        for child in children:
            vms.append(child)
    except vmodl.MethodFault as error:
        print("Caught vmodl fault : " + error.msg)
    finally:
        return vms


if __name__ == "__main__":
    config = {'host': 'esxi_ip', 'user': 'user_name', 'password': '', 'port': 'esxi_port'}
    vms = get_all_vms(config)
    try:
        details = vms[0].environmentBrowser.QueryConfigOptionEx()
    except Exception as e:
        print(traceback.format_exc())`

GOVETIQK avatar Jul 30 '20 12:07 GOVETIQK

Any update here? The same issue still exists with pyvmomi-7.0.1

li-kai-yuan avatar Jan 20 '21 23:01 li-kai-yuan

Also get this error using pyvmomi-7.0.2:

The full traceback is:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyVmomi/SoapAdapter.py", line 742, in EndElementHandler
    obj = GuessWsdlType(name)
  File "/usr/local/lib/python3.6/dist-packages/pyVmomi/VmomiSupport.py", line 1192, in GuessWsdlType
    raise UnknownWsdlTypeError(name)
pyVmomi.VmomiSupport.UnknownWsdlTypeError: 'VirtualQAT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pyVmomi/SoapAdapter.py", line 514, in ParseData
    parser.ParseFile(data)
  File "../Modules/pyexpat.c", line 468, in EndElement
  File "/usr/local/lib/python3.6/dist-packages/pyVmomi/SoapAdapter.py", line 744, in EndElementHandler
    raise TypeError(data)
TypeError: VirtualQAT

Tomorrow9 avatar Aug 10 '21 09:08 Tomorrow9

Unable to fetch available guestos for hwVersion > vmx-17

environmentBrowser.QueryConfigOption(key='vmx-04') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-07') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-08') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-09') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-10') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-11') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-12') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-13') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-14') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-15') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-16') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-17') # => Ok
environmentBrowser.QueryConfigOption(key='vmx-18') # => Exception('xml document: <http.client.HTTPResponse object at 0x7f880de13828> parse error at: line:7, col:881605')
environmentBrowser.QueryConfigOption(key='vmx-19') # => Exception('xml document: <http.client.HTTPResponse object at 0x7f880de5ffd0> parse error at: line:7, col:953987')

babs avatar Aug 11 '21 13:08 babs

I also hit this issue with v7.0.3 of pyvmomi

ExaneServerTeam avatar Jan 05 '22 13:01 ExaneServerTeam

Hello, Can you pls. share plan to address this issue?

~Regards Satyajit GP Veritas Technologies

satyajitgpvx avatar Jan 21 '22 18:01 satyajitgpvx

My workaround:

from pyVmomi.VmomiSupport import CreateDataType
CreateDataType("vim.vm.device.VirtualQAT", "VirtualQAT",
               "vim.vm.device.VirtualDevice", "vim.version.v7_0", None)
CreateDataType("vim.vm.device.VirtualQAT.DeviceBackingInfo", "VirtualQATDeviceBackingInfo",
               "vim.vm.device.VirtualDevice.DeviceBackingInfo", "vim.version.v7_0", None)
CreateDataType("vim.vm.device.VirtualQATOption", "VirtualQATOption",
               "vim.vm.device.VirtualDeviceOption", "vim.version.v7_0", None)
CreateDataType("vim.vm.device.VirtualQATOption.DeviceBackingOption", "VirtualQATDeviceBackingOption",
               "vim.vm.device.VirtualDeviceOption.DeviceBackingOption", "vim.version.v7_0", None)

mabmayer avatar May 05 '23 14:05 mabmayer

Same issue here with Ansible and vSphere 8.0 and HW version 20/21.

dgabrysch avatar Nov 10 '23 11:11 dgabrysch