thale13
Contributor
Contributor

Obtain info from the 'Right click' menu in a workflow

Jump to solution

I'm not even certain how to search for this, but I've tried.

What I want to do is, within a Workflow, get the object that was selected in vCenter.  Example: within vCenter you right click on an ESXi host and select 'All vRealize Orchestrator Plugin actions->Custom Create New Virtual Machine'.  Within that workflow I want to pre-populate a 'ESXi host' field with the host that was right-clicked on.

Is that even possible?  I realize there would have to be code for if it wasn't activated that way but that shouldn't be too hard I don't think.

Thanks in advance for any input or help you can provide.

T.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

Hi,

There is already code to pre-populate the context object into workflow input parameter of the same type. If the input parameter is empty, then this is an indication that the name of the vCenter server in vRO doesn't match exactly the name of the vCenter in vSphere Web Client.

When you registered your vCenter in vRO using the workflow Add a vCenter Server instance, how did you specify the vCenter instance - by its IP address or by its fully qualified domain name?

Please make sure that you register it using exactly the same format as it appears in Web Client, eg. myvcenter.mydomain.com. Note that it is case-sensitive; eg. myvcenter.domain.com is not the same as MYVCENTER.domain.com

View solution in original post

0 Kudos
7 Replies
iiliev
VMware Employee
VMware Employee

Hi,

There is already code to pre-populate the context object into workflow input parameter of the same type. If the input parameter is empty, then this is an indication that the name of the vCenter server in vRO doesn't match exactly the name of the vCenter in vSphere Web Client.

When you registered your vCenter in vRO using the workflow Add a vCenter Server instance, how did you specify the vCenter instance - by its IP address or by its fully qualified domain name?

Please make sure that you register it using exactly the same format as it appears in Web Client, eg. myvcenter.mydomain.com. Note that it is case-sensitive; eg. myvcenter.domain.com is not the same as MYVCENTER.domain.com

0 Kudos
thale13
Contributor
Contributor

Ok.  I did have my vcenter registered as myvcenter.domain.com but in the web client it shows up as Myvcenter.domain.com.  I ran the "Update a vCenter Server instance" workflow to change it and it succeeded successfully.  When I reloaded the web client (browser only) it still wasn't populating the field.  Do I need to restart anything to get that to take effect?

T.

0 Kudos
iiliev
VMware Employee
VMware Employee

No, you shouldn't need to restart anything.

To troubleshoot it further, check vRO server Tomcat's access log file at /storage/log/vmware/vco/app-server/localhost_access_log.txt after you right-click on the object and workflow presentation wizard is opened. There should be some REST requests like "GET /vco/api/catalog/VC/<something>" <statuscode> <datasize> <time>

The <something> part should include the name of your vCenter; make sure it is spelled correctly. Also, the <statuscode> number should be 200 and not 4xx or 5xx

Also, check vSphere Web Client's log file vsphere_client_virgo.log for errors around the time of the right-click.

0 Kudos
thale13
Contributor
Contributor

2018-07-06 07:15:03.278-0400 [https-jsse-nio-0.0.0.0-8281-exec-11] 10.254.12.11 - - "GET /vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115376/ HTTP/1.1" 404 256 13

2018-07-06 07:15:03.340-0400 [https-jsse-nio-0.0.0.0-8281-exec-6] 10.254.12.11 - - "GET /vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115376/ HTTP/1.1" 404 256 17

2018-07-06 07:15:03.817-0400 [https-jsse-nio-0.0.0.0-8281-exec-8] 10.254.12.11 - - "POST /vco/api/workflows/56faea39-484e-48f2-8558-f227d918c853/presentation/instances/ HTTP/1.1" 200 16949 89

2018-07-06 07:15:03.880-0400 [https-jsse-nio-0.0.0.0-8281-exec-5] 10.254.12.11 - - "POST /vco/api/workflows/56faea39-484e-48f2-8558-f227d918c853/presentation/instances/d233a153-17bb-42fd-a45c-9db52affc8c2/ HTTP/1.1" 200 16959 45

2018-07-06 07:15:03.951-0400 [https-jsse-nio-0.0.0.0-8281-exec-4] 10.254.12.11 - - "GET /vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115376/ HTTP/1.1" 404 256 15

2018-07-06 07:15:04.001-0400 [https-jsse-nio-0.0.0.0-8281-exec-3] 10.254.12.11 - - "GET /vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115376/ HTTP/1.1" 404 256 14

Those are lines I found in localhost_access_log.txt.  The vCenter name is correct.

And correspondingly this from the virgo log:

[2018-07-06T11:15:03.184Z] [WARN ] data-service-pool-769        70008625 100507 200390 org.springframework.web.client.RestTemplate                       GET request for "https://orchestrator.domain.com:8281/vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115..." resulted in 404 (); invoking error handler

[2018-07-06T11:15:03.185Z] [ERROR] data-service-pool-769        70008625 100507 200390 com.vmware.vco.adapter.dataservice.VcoInventoryItemProcessor      Error performing vco inventory item search org.springframework.web.client.HttpClientErrorException: 404

at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:90)

at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:494)

at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:451)

at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:423)

at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:399)

at com.vmware.vco.session.QueryService.getItemInfo(QueryService.java:97)

at com.vmware.vco.adapter.dataservice.VcoInventoryItemProcessor.processQuery(VcoInventoryItemProcessor.java:99)

at com.vmware.vco.adapter.dataservice.VcoInventoryItemProcessor.getData(VcoInventoryItemProcessor.java:68)

at com.vmware.vise.data.query.impl.DataAdapterUtil.getDataFromAdapter(DataAdapterUtil.java:218)

at com.vmware.vise.data.query.impl.DataAdapterUtil.getResultFromAdapter(DataAdapterUtil.java:175)

at com.vmware.vise.data.query.impl.DataAdapterUtil.access$000(DataAdapterUtil.java:42)

at com.vmware.vise.data.query.impl.DataAdapterUtil$1.call(DataAdapterUtil.java:81)

at com.vmware.vise.data.query.impl.DataAdapterUtil$1.call(DataAdapterUtil.java:78)

at com.vmware.vise.util.concurrent.ExecutorUtil$2.call(ExecutorUtil.java:693)

at com.vmware.vise.util.concurrent.ExecutorUtil$ThreadContextPropagatingTask.call(ExecutorUtil.java:1060)

at com.vmware.vise.data.query.impl.DataServiceThreadPoolDecorator$1.call(DataServiceThreadPoolDecorator.java:167)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

0 Kudos
thale13
Contributor
Contributor

Ok, with Myothervcenter.domain.com it worked, so of the 2 vcenters I have, one works and one doesn't.

0 Kudos
thale13
Contributor
Contributor

And now Myvcenter.domain.com works.  That was the fix after all. 

Thanks for the help.

T.

0 Kudos
iiliev
VMware Employee
VMware Employee

OK, so GET requests to https://orchestrator.domain.com:8281/vco/api/catalog/VC/HostSystem/Myvcenter.domain.com%252Fhost-115...  are failing with error code 404 (NOT FOUND), which means vRO cannot find the host system with such ID, and that's why the input field is not pre-populated.

Could you list all HostSystem objects in this vRO with a GET request at https://orchestrator.domain.com:8281/vco/api/catalog/VC/HostSystem/  (eg. open this URL in a browser or use a client like Postman or cURL) to check if a host with such ID 115376 is in the list?

Also, could you check with a workflow with input field of different vCenter type (for example, Datacenter) to verify that the issue is not specific to host system type.

0 Kudos