VMware {code} Community
barrycooks
Contributor
Contributor

Issue with retrieveProperties

Hi,

I am using VMWare SDK Web Service API to monitor and collect the performance statistics. I am trying to retrieve performance statistics (Historical Intervals) from vCenter. Here is the piece of code for this.

private ObjectContent[] getManagerContents(PropertySpec propertySpec, ManagedObjectReference ref) throws Exception

    {

        PropertySpec[] propspecary = new PropertySpec[]{ propertySpec };

        PropertyFilterSpec spec = new PropertyFilterSpec();

        spec.setPropSet(propspecary);

        spec.setObjectSet(new ObjectSpec[]{new ObjectSpec()});

        spec.getObjectSet(0).setObj(ref);

        spec.getObjectSet(0).setSkip(new Boolean(false));

        return cb.getConnection().getService().retrieveProperties(cb.getConnection().getServiceContent().getPropertyCollector(), new PropertyFilterSpec[]{spec});

   }

The above method works most of the time, but some times returns blank ObjectContent. I would like to know in which case it will return blank array of ObjectContent.

Any help would be greatly appreciated.

Thanks,

Reply
0 Kudos
3 Replies
Mobster
Contributor
Contributor

I had a similar issue with hosts/vcenter >= 4.1.  I switched from using retrieveproperties to using retrievepropertiesex together with continueretrievepropertiesex and the problem of blank returns went away (though I am fighting another problem but that is a different story).  See if changing your calls helps.

--Moby

Reply
0 Kudos
balaga32
Enthusiast
Enthusiast

Even I do have the same issue (even with the retrievepropertiesex + continueretrievepropertiesex ) using vsphere 5.5.

Is this the known issue  and vmware is working on this ?

Reply
0 Kudos
Steve_Jin
Expert
Expert

Feel free to take a look at the implementation of open source vijava API which has resolved the issue: http://vijava.sf.net. Or, you can just use the API and forget about these tedious details.

Commercial version of open source is also available: http://www.doublecloud.org/2014/01/announcing-vijavang-much-lighter-and-faster-with-commercial-licen...

Disclaimer: I am the creator of the open source.

Steve

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
Reply
0 Kudos