- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert String to vCO Object type?
Hi All,
Can someone help me how to convert String to vCO Object Type?
For example:
I will pass VM name as string to workflow and then convert that into VC:VirtualMachine object in Scriptable task & then assign to sub workflow (PowerOff VM) as VC:VirtualMachine.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To Converter Workflows please check this :
VMware vCenter Orchestrator Plug-In Documentation Center
Hope this helped .
Best regards
Your Oscar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you have to actually search the inventory for the VM with the given name (be careful, there might be not unique!).
For the you can use VcPlugin.getAllVirtualMachines() with an xpath filter in a scriptable task,
or the Action com.vmware.library.vc.vm.getAllVMsMatchingRegexp from the library.
Also have a look at these resources:
http://www.vmwarelearning.com/orchestrator
Case insensitive search for VM by name (the examples here actually should solve your problem)
cheers,
Joerg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply.
Actually, I want to call workflow from Java code and pass Input as VM (VC:VirtualMachine) object, i tried with below code,
SdkObject obj = new SdkObject();
obj.setType("VC:VirtualMachine");
obj.setId("VCIP/vm-744");
context = new ExecutionContextBuilder().addParam("vm",obj).build();
WorkflowExecution execution = executionService.execute(workflow, context);
but it is pass null to VM input parameter in vCO workflow.
So i thought to pass Vm name as string and within workflow script i will convert that into VC:VirtualMachine object type. but i'm not able to do this.
Can anyone help me resolve this issue or on the workaround?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuckyT:
The ID of a Virtual Machine actually looks like this through the SOAP api:
dunes://service.dunes.ch/CustomSDKObject?id='vcenter.yourdomain.lab/vm-744'&dunesName='VC:VirtualMachine'
Try using that format on your line that sets the ID... See if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
I'm using the same format, but using through Java:
obj.setType("VC:VirtualMachine");
obj.setId("VCIP/vm-744");
Can you suggest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ SPAM DELETED BY ADMIN]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Burke - this style of IDs ('dunes://...') is not supported in vCO REST API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not a JAVA developer so I can't help much more
My id example was based on the SOAP API.
Hopefully one of our community members more familiar with Java will be able to further assist you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone help on this? I'm not able send SDKObject (VM Name) to vCO from my java code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuckyT did you ever find the solution for this one? I have the same problem, but calling via POST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found this guide to work http://www.vzare.com/?p=3560