vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.19k stars 766 forks source link

GuestOS is missing on vm which was shut down #1014

Open dmetzler1988 opened 1 year ago

dmetzler1988 commented 1 year ago

Describe the bug

We have some VMs, which are in shut-down state some times. On these VMs no guestOS Informations was given by this pyvmomi tool. I had taken the credentials and SOAP requests from the SoapAdapter.py and pasted it into Postman to check, if there is an issue with pyvmomi or the vSphere API itself. If i send the SOAP requests directly to the vSphere API, i receive the GuetOS information in the response (tested it with the same VM which which was shut down). The pyvmomi response doesn't contain the guestOS information - it is empty.

I don't can find anything else instead of the shut-down-state, what could make an issue there.

I am not sure, if this is a wanted case, that a shut down vm doesn't can contain a vm.

Reproduction steps

  1. shut down a vm
  2. try to get the guestOS information via pyvmomi tool of the vm in shut-down-state
  3. try to make a manual SOAP request to the same vm via another tool (like Postman or SOAP-UI)

Expected behavior

The guestOS information should be also available with shut down vm's.

Additional context

I tried the pyvmomi versions 7.0, 7.0.3 and 8.0.0.1.2 - same issue on each version.

karaatanassov commented 6 months ago

Can you share the details of the SOAP request and Python code you used? PyVMOMI is usually a mere Python binding for the SOAP API.

dmetzler1988 commented 5 months ago

@karaatanassov The soap request will be sent to https://<our-url>/sdk with this body:

<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soapenv:Body>
        <RetrievePropertiesEx xmlns="urn:vim25">
            <_this type="PropertyCollector">propertyCollector</_this>
            <specSet>
                <propSet>
                    <type>VirtualMachine</type>
                    <all>false</all>
                    <pathSet>config</pathSet>
                </propSet>
                <objectSet>
                    <obj type="VirtualMachine">vm-123456</obj>
                    <skip>false</skip>
                </objectSet>
            </specSet>
            <options>
                <maxObjects>1</maxObjects>
            </options>
        </RetrievePropertiesEx>
    </soapenv:Body>
</soapenv:Envelope>

This soap request returns a guestFullName value - so its not empty. If i inspect the pyVmomi code after the datas are fetched from the server, this value is empty. So its nothing on our side - seems something gone wrong on resolving data from the soap response into the object model of pyVmomi.