VMware {code} Community
jrackliffe
Hot Shot
Hot Shot

PropertyCollector Depth limitation?

Maybe I am missing a simple setting, but it seems like the PropColl can't see properties past a certain depth from the root managedobject.

Example:

Using a simple non-traversing propfilterspec and a root object of a VirtualMachine (ref: o):

PropertyFilterSpec spec = new PropertyFilterSpec();

spec.objectSet = new ObjectSpec[] { new ObjectSpec() };

spec.objectSet[0].obj = o;

spec.propSet = new PropertySpec[] { new PropertySpec() };

spec.propSet[http://0].pathSet = new string[|http://0].pathSet = new string[] ;

spec.propSet[0].type = o.type;

spec.objectSet[0].selectSet = null;

spec.objectSet[0].skip = false;

spec.objectSet[0].skipSpecified = true;

I am looking to tell if a known disk device is thin provisioned so my propertyName is "config.hardware.device[2000].backing.thinProvisioned" which results in a RetrieveProperties SOAPEx on a InvalidProperty.

Now if I pull the backing via "config.hardware.device[2000].backing" and cast it to a VirtualDiskFlatVer2BackingInfo and access the thinProvisioned field all is well.

I checked a couple other properties of the disk backing and couldn't pull those eithe. Is it because the propertyCollector can't access properties of an derived type of VirtualDeviceBackingInfo or is there a limit to the property accessor dot notation depth?

0 Kudos
4 Replies
vtorch
Hot Shot
Hot Shot

I'm having trouble reading some parts of your message. In particular, your propertyName "config.hardware.device2000.backing.thinProvisioned" doesn't look right (there is no property named "device2000" in VirtualHardware. Can you show us what your property name really is?

0 Kudos
jrackliffe
Hot Shot
Hot Shot

Sorry didn't notice the forum formatter read my square brackets as formatting and not content. Don't know the escape char for square brackets in the new forum yet. Excuse the replacement, but the parens should be "read" as brackets.

The property line should be spec.propSet(0).pathSet = new string() ;

the example prop is: "config.hardware.device(2000).backing.thinProvisioned" where the device is the property and 2000 is the key in this case which points to a specific VirtualDisk in the VirtualHardware and "backing.thinProvisioned" follows through the FileBackingInfo to the thinProv bool (assume Backing is a ver2 for discussion).

In my propspec query on that propertyName from a root VirtualMachine mor I get a soapEx on an invalidprop, but referencing the backing (remove thinProvisioned from the propertyName) returns the object ref to the FileBacking w/o exception and w a simple cast check I can derive the thinProv value from the upcast type.

In theory though shouldn't I explicitly be able to get the true/false from the propSpec w the fully qualified path w/o having to gather the backing object, cast to type and get property? Note if the property doesn't exist (e.g. in a FileBackingver1) I would expect to get an exception in invalidProp, but I know this path is fine and pulling the backing and just using the property works.

Does that help?

J

0 Kudos
vtorch
Hot Shot
Hot Shot

Thanks for the clarification, it definitely helps. I suspected that was what your property path looked like but I didn't want to just guess.

The problem is actually pretty simple, and does not have to do with the depth of the property path. The type of config.hardware.device[2000].backing is VirtualDeviceBackingInfo, which does not contain a property named "thinProvisioned". You can only specifiy properties that match the static type of the objects. As a result, in this situation, I think you will have to gather the backing object and and cast it to the appropriate derived type to retrieve the thinProvisioned property.

0 Kudos
jrackliffe
Hot Shot
Hot Shot

Doh!

I had hoped that wouldn't be the issue and that the propCol would have the magic to downcast to the dataobject's instance type, but I guess not.

Well I will weep a few tears, but it isn't difficult to workaround as you note. Just need to add a couple extra steps to do the casting and extraction of the desired prop.

Cest la vi

J

0 Kudos