Hi,
I am trying to convert VCD vApps vm to vCenter vm trough orchestrator workflow by following code, when I try to run the getVMVimRef() function (off a VM) it throw error “Vim Object Reference Not Found”.
Any ideas as to what could cause a VM to not have a Vim reference?
My workflow code is as liste below
var vcVms = new Array();
System.log("Vms passed in: " + vms.length);
for (var i in vms) {
var moref = vms[i].getVMVimRef().moRef;
var XPath = "xpath:id='"+ moref +"'";
var VMs = VcPlugin.getAllVirtualMachines(null, XPath);
var vm = VMs[0];
var vmName = vm.name;
vcVms[i] = vm;
}
--AVR
Check your plug-in configuration. It is likely that you are not connected to the system organization.
This is required to get access to the getVMVimRef() method.
Christophe.
Where does 'vms' array come from? Could you show the code which populates it? Or is it an input parameter and user selects VMs from chooser? If possible, could you attach the complete workflow, or extract a small subset of it enough to demonstrate the problem?
Also, could you insert some log messages in the for loop to check whether all VMs have no valid reference, or only some of them?
Please find the attached image for my complete workflow
I am facing issue on last scriptable task “Change vCloud VM(s)”, it take input array of VApps VM from action “getVms FromVApp”. When I print following in this scriptable task , It prints arrays actual length and VM name.
Yes, array contains the VM objects as when I print following
System.log("Vms passed in: " + vms.length);
System.log("vCloud VM: " + vms[i].name);
System.log(vms[i]);
var moref = vms[i].getVMVimRef().moRef;
Log subtracts for reference
[2013-04-15 09:15:08.494] [I] Vms passed in: 2
[2013-04-15 09:15:08.498] [I] vCloud VM: test1
[2013-04-15 09:15:08.501] [I] DynamicWrapper (Instance) : [VclVM]-[class com.vmware.vmo.plugin.vcloud.model.VM] -- VALUE : com.vmware.vmo.plugin.vcloud.model.VM@c36c4a9a
[2013-04-15 09:15:09.112] [I] Vim Object Reference Not Found (Workflow:SetAffinityRule / Change vCloud:VM(s) to VC:VM(s) (item4)#7)
Check your plug-in configuration. It is likely that you are not connected to the system organization.
This is required to get access to the getVMVimRef() method.
Christophe.
Hi Christophe
Thanks a lot for valuable clue.
-AVR