Hi,
I try to create a new WF to receive a VC:VirtualMachine object from a user and print information on the machine (ID, Name, CPU, Memory, OS type).
The wf not works well :
System.log("VM ID: " + VmName.id + "VM Name : " + VmName.name + "VM CPU : " + VmNme.cpu + "VM Memroy : " + VmName.memory + "VM OS : " + VmName.guestOS);
I got this log - [2017-09-04 12:02:35.616] [I] VM ID: vm-81VM Name : VM-SQLVM CPU : undefinedVM Memroy : undefinedVM OS : undefined
Some help...
Hi,
I can see why you've gone for those property names, but they're not right. If you use the vRO API explorer and get to the VcVirtualMachine object, you'll see that "cpu", "memory" and "guestOS" aren't properties of that object at all and hence why they're showing as "undefined".
The properties that you want can be found from some of the referenced objects. For example, VmName.config.hardware will return an object that contains the CPU and Memory configuration for the VM (amongst other things).
The line of javascript that you'd then end up with would be:
System.log("VM ID: " + VmName.id + " VM Name: " + VmName.name + " VM CPU: " + VmName.config.hardware.numCPU + " VM Memory: " + VmName.config.hardware.memoryMB + " VM OS: " + VmName.config.guestFullName);
Hopefully that should produce the output that you want.
Michael
Hi,
I can see why you've gone for those property names, but they're not right. If you use the vRO API explorer and get to the VcVirtualMachine object, you'll see that "cpu", "memory" and "guestOS" aren't properties of that object at all and hence why they're showing as "undefined".
The properties that you want can be found from some of the referenced objects. For example, VmName.config.hardware will return an object that contains the CPU and Memory configuration for the VM (amongst other things).
The line of javascript that you'd then end up with would be:
System.log("VM ID: " + VmName.id + " VM Name: " + VmName.name + " VM CPU: " + VmName.config.hardware.numCPU + " VM Memory: " + VmName.config.hardware.memoryMB + " VM OS: " + VmName.config.guestFullName);
Hopefully that should produce the output that you want.
Michael
Hi,
poorem - actually, I think the newer builds of vCenter plug-in has these properties of VcVirtualMachine (at least I see them in the plug-in version shipped with vRO 7.3) They act as kind of aliases for vm.summary.config.numCpu, vm.summary.config.memorySizeMB and vm.summary.config.guestFullName, respectively.
Vidal30 - could you confirm the version and build number of the vCenter plug-in you are using?
The original post was tagged with "vco 6" I think.
Thanks for the help!
Yes the version is VCO 6.0.5
The PrtScr from vco :
Ah, yes, I missed the tag.
vRO 7.3 is the first vRO version that ships with a different implementation of vCenter plug-in. All previous vRO versions, including vRO 6.0.5, contain the "classic" implementation of vCenter plug-in, which does not have these properties directly exposed as top-level properties on VirtualMachine object.
So, to make sure your scripting code works in both plug-in implementations, you can use the longer property expressions (as shown in post 1 and post 2) to fetch the info you need.
It's working, but why when I click on VC: VirtualMachine I don't see the property or function? has a picture above.
Try clicking on the link for "VcVirtualMachine" next to where it says "Scripting Object".
I must admit that I haven't fully explored the newer vCenter plugin yet. Useful to know, thank you.