Quantcast
Channel: VMware Communities: Message List - vSphere Management SDK
Viewing all articles
Browse latest Browse all 2052

Re: FindAllByDnsName ==> general system error occurred: Missing non-optional field

$
0
0

Not entirely sure, but this error might just be thrown when the guest hostname cannot be found (via guest tools).  I tried it with a VM hostname I know is not on a specific host and reproduced your error:

REQUEST: $VAR1 = '<?xml version="1.0" encoding="UTF-8"?>

   <soapenv:Envelope 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>

<FindAllByDnsName xmlns="urn:vim25"><_this type="SearchIndex">ha-searchindex</_this>

<dnsName>esx-17.vlab.local</dnsName><vmSearch>1</vmSearch></FindAllByDnsName></soapenv:Body></soapenv:Envelope>

';

 

 

 

 

RESPONSE: $VAR1 = '<?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>

<soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>A general system error occurred: Missing non-optional field</faultstring><detail><SystemErrorFault xmlns="urn:vim25" xsi:type="SystemError"><reason>Missing non-optional field</reason></SystemErrorFault></detail></soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>';

 

However, I think this is a problem specific to the HostSystem API. When I target the vCenter API with an unknown vm guest hostname, it just returns a proper null value for an nonexistent hostname (not fault message).

 

Most of the SDK kits do not use the FindBy* methods for locating objects.  Instead, they use a limited property match on the name and traversal specs, then do a second query to get more specific properties that the code specified.  You might need to capture that error, but I'm not sure if it will raise on other conditions.  It's a bit obscure to be sure.  It's possible this is unique to the HostSystem API (instead of vCenter).

 

Any problems with GuestTools would boil up and make a VM hard to locate.  But perhaps that's built into your application logic.

 

You should ideally use RetrievePropertiesEx (2x) similar to the other SDK kits.  You'd want to use a ContainerView to avoid the complicated TraversalSpec creation.  That would also let you use multiple search criteria (vm name, vm hostname, vm ip address, etc).  Though you'll need more code to parse the RetrievePropertiesEx results.


Viewing all articles
Browse latest Browse all 2052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>