VMware {code}

 View Only
  • 1.  Getting Error "VimFault: Type not found: 'hostSubSpec'" while collecting Event data

    Posted May 17, 2019 06:42 AM

    After upgrading vCenter Server from  Windows v6.0 Build 5318200 (vCenter 6.0 Update 3b)  to VCSA 6.5  Build 9451637 (vCenter 6.5 Update 2c),  Issue "hostSubSpec type not found" is coming while collecting Events data.

    We are using python vim25 library to collect events data from vCenter Server.

    Following is the code snippet:

    from vim25.connection import Connection

    class EventCollector(Connection):

    try:

    targetEventManager = self.eventManager

    eventSpec = Connection.vim25client.new('EventFilterSpec', entity=None, userName=None, alarm=None, scheduledTask=None)

    eventSpec.time.beginTime = startTime

    eventSpec.time.endTime = stopTime

    events = targetEventManager.queryEvents(eventSpec)

    return events

    Error :

    in collectEvents
        targetEventManager.queryEvents(eventSpec)

      File "vim25/mo.py", line 989, in queryEvents
        return self.getVimService().QueryEvents(self.getMOR(), filter=targetfilter)
      File "vim25/soap_wrapper.py", line 62, in vimSvcWrapper
        return self.invoke(t, _this, **kwargs)
      File "/vim25/soap_wrapper.py", line 79, in invoke
        self.handle_exception(e)
      File "vim25/soap_wrapper.py", line 46, in handle_exception
        raise VimFault(e)

    VimFault: Type not found: 'hostSubSpec'

    Here it is throwing error "hostSubSpec" type not found, we tried to find out if there is any specific configuration for "Host Sub Specification" on ESXi host, but we couldn't fine.

    This code was working properly with vCenter Server Windows (Version 6.0)  Build 5318200 (vCenter 6.0 Update 3b)

    Can you share more information about this vCenter error? Also suggest, if we need to do any specific configuration on vCenter in order to resolve the issue.



  • 2.  Re: Getting Error "VimFault: Type not found: 'hostSubSpec'" while collecting Event data

    Posted May 17, 2019 12:40 PM

    Get a more modern version of pyvmomi.



  • 3.  Re: Getting Error "VimFault: Type not found: 'hostSubSpec'" while collecting Event data

    Posted May 17, 2019 01:26 PM

    daphnissov

    Thank you for the quick response.

    As I have mentioned that we are using vim25 and it is challenging to migrate from vim25  to pyvmomi SDK.

    So can you please suggest how we can fix it with vim25 lib? Also, can you please share us what is missing in vim25 library regarding this or any better approach to resolve it?



  • 4.  Re: Getting Error "VimFault: Type not found: 'hostSubSpec'" while collecting Event data

    Posted May 17, 2019 01:28 PM

    No, I cannot. You can't presume to upgrade to a new version of a product but not update your tooling at the same time. Otherwise, you get inexplicable errors like these.



  • 5.  Re: Getting Error "VimFault: Type not found: 'hostSubSpec'" while collecting Event data

    Posted May 28, 2019 10:36 AM

    After digging we came to know that suds throws Type error (Type not found: 'hostSubSpec'") for "HostSubSpecificationUpdateEvent" type Events.

    As we are using suds library for SOAP requests which use WSDL files from vCenter Server (suds.client.Client(url="https://"+server_url+"/sdk/vimService?wsdl"))  to dig further, I have analyzed WSDL files (VMware\vCenterServer\cfg\vmware-vpx\docRoot\sdk\vim-types.xsd) on vCenter Server and found that there is no type defined for "HostSubSpecificationUpdateEvent" and "HostSubSpecificationDeleteEvent" events.

    As per my analysis, suds library finds type from vim-types.xsd. And If specific Events type (as per snippet 2) is not specified then it refers to main Event type (snippet 1) and

    If there is no type defined for any field/parameter of event then it will throw Type not found error.

    Now, type for specific HostSubSpecificationUpdateEvent  is not defined in vim-types.xsd file and these events contain field "hostSubSpec". So as per my theory, it will check type for "hostSubSpec" into Event type (Snippet 1) but it is not there so suds will throw an error 'Type not found: 'hostSubSpec'" '.

    As I have no idea if it is the issue with vim-types.xsd file or else, to tempory fix this I have implemented following two approaches

    1) I have appended (<element name="hostSubSpec" type="vim25:HostSubSpecification" />) to Event type (Snippet 1)

    2) Add Specific Event type to vim-types.xsd file (Snippet 2)

    Both are working.

    Snippet 1

       <complexType name="Event">

          <complexContent>

             <extension base="vim25:DynamicData">

                <sequence>

                   <element name="key" type="xsd:int" />

                   <element name="chainId" type="xsd:int" />

                   <element name="createdTime" type="xsd:dateTime" />

                   <element name="userName" type="xsd:string" />

                   <element name="datacenter" type="vim25:DatacenterEventArgument" minOccurs="0" />

                   <element name="computeResource" type="vim25:ComputeResourceEventArgument" minOccurs="0" />

                   <element name="host" type="vim25:HostEventArgument" minOccurs="0" />

                   <element name="vm" type="vim25:VmEventArgument" minOccurs="0" />

                   <element name="ds" type="vim25:DatastoreEventArgument" minOccurs="0" />

                   <element name="net" type="vim25:NetworkEventArgument" minOccurs="0" />

                   <element name="dvs" type="vim25:DvsEventArgument" minOccurs="0" />

                   <element name="fullFormattedMessage" type="xsd:string" minOccurs="0" />

                   <element name="changeTag" type="xsd:string" minOccurs="0" />

               </sequence>

             </extension>

          </complexContent>

       </complexType>

    Snippet 2

      

    <complexType name="HostSubSpecificationUpdateEvent">

          <complexContent>

             <extension base="vim25:Event">

                <sequence>

                   <element name="name" type="xsd:string" />

                   <element name="createdTime" type="xsd:dateTime" />

                   <element name="data" type="xsd:byte" minOccurs="0" maxOccurs="unbounded" />

                   <element name="hostSubSpec" type="vim25:HostSubSpecification" />

                </sequence>

             </extension>

          </complexContent>

       </complexType>