VMware Cloud Community
anuragvr
Enthusiast
Enthusiast
Jump to solution

Vim Object Reference Not Found

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

0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

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?

0 Kudos
anuragvr
Enthusiast
Enthusiast
Jump to solution

Please find the attached image for my complete workflow

Untitled.png

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)

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
anuragvr
Enthusiast
Enthusiast
Jump to solution

Hi Christophe

Thanks a lot  for valuable clue.

-AVR

0 Kudos