VMware Cloud Community
ispdev
Contributor
Contributor

VRO 7.0.1 getComputeResourceOfVM TypeError: Cannot read property "resourcePool" from null

Hi all,

in VRO 7.0.1 if I pass a VC:VirtualMachine into the getComputeResourceOfVM action I get the TypeError: Cannot read property "resourcePool" from null. This works fine in version 6.X has anyone come across this or knows why this is happening?

Thanks

D.

3 Replies
pizzle85
Expert
Expert

Can you share your action with us?

The obvious answer is that the object you're attempting to pull the resourcePool property from is null. I've seen this happen for all sorts of reasons. Sometimes I've had to use get methods like object.getResourcePool()  if its available. Other times simply restarting the vRO services has resolved rogue issues like this. Other times it was just my code and having someone else look at is showed some silly issue I had overlooked in the heat of troubleshooting. Another really common thing i do is try to act on arrays of objects as if it was a single object, I don't think that will return a null value but worth mentioning.

0 Kudos
ispdev
Contributor
Contributor

The action is built-in very easy to reproduce by using "getComputeResourceOfVM", I have not customized the action at all, the code of the action is as follows:

----------------------------------------------------

var parent = vm.resourcePool;

while (parent != null && ! (parent instanceof VcClusterComputeResource) && ! (parent instanceof VcComputeResource)) {

  parent = parent.parent;

}

return parent;

---------------------------------------------------

I am simply passing in the "vm" of type VC:VirtualMachine. If I look at the properties of the VC:VirtualMachine there is no resourcePool property however the property does exist for the type scripting class VcVirtualMachine the same is true in VRO version 6 therefore I don't understand why it shouldn't work.

0 Kudos
pizzle85
Expert
Expert

It works fine in my vRO 7.0.1 cluster. When I've seen errors like that, restarting the vRO services usually resolves them. If that doesn't help I guess a support ticket is in order. You may be able to find more info in the vRO logs by logging into the configurator interface. Something strange is definately going on if you don't see the resourcePool property of the VM. If restarting services doesn't work perhaps try updating the vCenter object.

Capture.PNG