Does anyone know how to add a VM to vApp in orchestrator script API? I've searched the forums and found topics about using Cloud Director, but i dont have that available to me.
I figured out how to create a vApp from a resourcePool, But i dont know how to add VM's i create after that to the vApp i made. Any Ideas?
I got it!
array = new Array();
array[0] = VM;
vApp.moveIntoResourcePool(array);
Take a look at VcVirtualApp#registerChildVm_Task(...) scripting method.
I tried this out and everything looks good but it didnt actually do anything. I used the .vmx file as the datastore path and just used the vm name for the name. Anything you think im doing wrong?
Could you share the sample workflow/javascript code you are using?
Also, could you check the version/build numbers of vCO server and VC plug-in in your environment? They should be listed in vCO configurator; on 'General' and 'Plugins' tabs.
My scheme is simple. I pass in a VirtualApp (vApp) and a VirtualMachine (VM)
then i call vApp.registerChildVM_Task(VM.config.files.vmPathName);
I've also tried vApp.registerChildVM_Task(VM.config.files.vmPathName, VM.name, null);
I'm using Version 5.1.1 of vmware, vCO Library 1.1.0
Thanks for your help
registerChildVM_Task() returns a task object. Could you log its properties (in vCO scripting node); maybe there is an error message or an error code?
Also, there should be some task logs/events in vCenter. could you check if the task is listed as finished successfully there?
I dont think i was getting this yesterday, but now I'm getting an error "The specified key, name, or identifier already exists"
I ran it in my 5.5 environment and got the same error An idiomatic example of useless error message.
Not sure why such error is thrown; maybe the folks on vCenter forum could have an idea what's happening (I think registerChildVM_Task is part of vSphere API and vCO only redirects to it).
oh.. well at least im not crazy lol
I got it!
array = new Array();
array[0] = VM;
vApp.moveIntoResourcePool(array);