Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Multiple vCloud Hosts, choose one using REST

$
0
0

Hello,

This is my first post so please bear with me as I learn all the proper terminology.

 

I have gone through Orchestrator training and know a little about workflows and vApps etc.. Now I am trying to control the workflows using the REST API through Java.

 

My problem stems from the fact that my current vCloud has multiple Hosts on the same host and port, the only difference is the Name of the Host

 

Using Chrome to hit the Orchestrator REST site when I go to

https://orch-00:8281/api/catalog/vCloud

I see this response

<inventory-itemxmlns="http://www.vmware.com/vco"href="https://orch-00-ah:8281/api/catalog/vCloud/">

 

<relations>

 

<linkrel="down"href="https://orch-00-ah:8281/api/catalog/vCloud/Host/561028bce25f7c284438cd9b3d41b0c8e91617fc96774299788a1156c7b%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%253A443/">

 

<attributes>

<attributename="enabled"value="true"/>

<attributename="organization"value="test-org"/>

<attributename="maxConnections"value="600"/>

<attributename="username"value="morade"/>

<attributename="sessionMode"value="SHARED_SESSION"/>

<attributename="useSamlAuthentication"value="false"/>

<attributename="connectionTimeout"value="20000"/>

<attributename="@type"value="Host"/>

<attributename="name"value="https://vcdirectort-01-ah.mathworks.com:443 (morade@test-org)"/>

<attributename="dunesId"value="561028bce25f7c284438cd9b3d41b0c8e91617fc96774299788a1156c7b////https://vcdirectort-01-ah.mathworks.com:443"/>

<attributename="type"value="Host"/>

<attributename="url"value="https://vcdirectort-01-ah.mathworks.com:443"/>

</attributes>

 

</link>

 

 

<linkrel="down"href="https://orch-00-ah:8281/api/catalog/vCloud/Host/a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%253A443/">

 

<attributes>

<attributename="enabled"value="true"/>

<attributename="organization"value="development_QE"/>

<attributename="maxConnections"value="600"/>

<attributename="username"value="morade"/>

<attributename="sessionMode"value="SHARED_SESSION"/>

<attributename="useSamlAuthentication"value="false"/>

<attributename="connectionTimeout"value="20000"/>

<attributename="@type"value="Host"/>

<attributename="name"value="https://vcdirectort-01-ah.mathworks.com:443 (morade@development_QE)"/>

<attributename="dunesId"value="a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a////https://vcdirectort-01-ah.mathworks.com:443"/>

<attributename="type"value="Host"/>

<attributename="url"value="https://vcdirectort-01-ah.mathworks.com:443"/>

</attributes>

 

</link>

 

</relations>

 

 

 

<attributes>

<attributename="name"value="vCloud Director"/>

</attributes>

 

 

 

</inventory-item>


 

As you can see there are 2 vClouds with different dunesID, different names, etc.

 

Sometimes when I hit

https://orch-00-ah:8281/api/catalog/vCloud/vApp

I will get the vApps from one of the Hosts

<inventory-items xmlns="http://www.vmware.com/vco" total="14">

<link rel="down" href="https://orch-00-ah:8281/api/catalog/vCloud/VApp/a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%252Fapi%252FvApp%252Fvapp-7c4f60f9-46a9-469e-aa4a-6a4e73e0eaeb/">

<attributes>

<attribute name="id" value="urn:vcloud:vapp:7c4f60f9-46a9-469e-aa4a-6a4e73e0eaeb"/>

<attribute name="status" value="8"/>

<attribute name="description" value=" IT training"/>

<attribute name="@type" value="VApp"/>

<attribute name="name" value="vApp_IT_training"/>

<attribute name="dunesId" value="a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a////https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-7c4f60f9-46a9-469e-aa4a-6a4e73e0eaeb"/>

<attribute name="deployed" value="false"/>

<attribute name="dateCreated" value="2013-05-06T13:54:39.640-04:00"/>

<attribute name="vappStatusDescription" value="The object is powered off."/>

<attribute name="type" value="application/vnd.vmware.vcloud.vApp+xml"/>

<attribute name="href" value="https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-7c4f60f9-46a9-469e-aa4a-6a4e73e0eaeb"/>

<attribute name="inMaintenanceMode" value="false"/>

</attributes>

</link>

<link rel="down" href="https://orch-00-ah:8281/api/catalog/vCloud/VApp/a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%252Fapi%252FvApp%252Fvapp-b07e13b0-0083-4e0e-a9cd-dd9e8dacf794/">

<attributes>

<attribute name="id" value="urn:vcloud:vapp:b07e13b0-0083-4e0e-a9cd-dd9e8dacf794"/>

<attribute name="status" value="8"/>

<attribute name="description" value=""/>

<attribute name="@type" value="VApp"/>

<attribute name="name" value="vApp_pvasudev_16"/>

<attribute name="dunesId" value="a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a////https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-b07e13b0-0083-4e0e-a9cd-dd9e8dacf794"/>

<attribute name="deployed" value="false"/>

<attribute name="dateCreated" value="2013-06-20T13:46:13.217-04:00"/>

<attribute name="vappStatusDescription" value="The object is powered off."/>

<attribute name="type" value="application/vnd.vmware.vcloud.vApp+xml"/>

<attribute name="href" value="https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-b07e13b0-0083-4e0e-a9cd-dd9e8dacf794"/>

<attribute name="inMaintenanceMode" value="false"/>

</attributes>

</link>

<link rel="down" href="https://orch-00-ah:8281/api/catalog/vCloud/VApp/a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%252Fapi%252FvApp%252Fvapp-e2315f11-ec68-48aa-bdc0-b3ac018c0c6c/">

<attributes>

<attribute name="id" value="urn:vcloud:vapp:e2315f11-ec68-48aa-bdc0-b3ac018c0c6c"/>

<attribute name="status" value="8"/>

<attribute name="description" value=""/>

<attribute name="@type" value="VApp"/>

<attribute name="name" value="vApp_mltest"/>

<attribute name="dunesId" value="a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a////https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-e2315f11-ec68-48aa-bdc0-b3ac018c0c6c"/>

<attribute name="deployed" value="false"/>

<attribute name="dateCreated" value="2013-05-14T13:37:25.760-04:00"/>

<attribute name="vappStatusDescription" value="The object is powered off."/>

<attribute name="type" value="application/vnd.vmware.vcloud.vApp+xml"/>

<attribute name="href" value="https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-e2315f11-ec68-48aa-bdc0-b3ac018c0c6c"/>

<attribute name="inMaintenanceMode" value="false"/>

</attributes>

</link>

<...> and many more</...>

Sometimes when I visit the same URL I get the other Host's vApps

<inventory-items xmlns="http://www.vmware.com/vco" total="1">

<link rel="down" href="https://orch-00-ah:8281/api/catalog/vCloud/VApp/561028bce25f7c284438cd9b3d41b0c8e91617fc96774299788a1156c7b%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%252Fapi%252FvApp%252Fvapp-ae108620-27a7-4928-878f-af9440e08c79/">

<attributes>

<attribute name="id" value="urn:vcloud:vapp:ae108620-27a7-4928-878f-af9440e08c79"/>

<attribute name="status" value="4"/>

<attribute name="description" value=""/>

<attribute name="@type" value="VApp"/>

<attribute name="name" value="win7test"/>

<attribute name="dunesId" value="561028bce25f7c284438cd9b3d41b0c8e91617fc96774299788a1156c7b////https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-ae108620-27a7-4928-878f-af9440e08c79"/>

<attribute name="deployed" value="true"/>

<attribute name="dateCreated" value="2013-07-09T17:53:06.980-04:00"/>

<attribute name="vappStatusDescription" value="The object is powered on."/>

<attribute name="type" value="application/vnd.vmware.vcloud.vApp+xml"/>

<attribute name="href" value="https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-ae108620-27a7-4928-878f-af9440e08c79"/>

<attribute name="inMaintenanceMode" value="false"/>

</attributes>

</link>

</inventory-items>

 

I don't know how to tell the REST API to get the vApps from one specific Host or another.

 

From my Java code I am creating a com.vmware.o11n.sdk.rest.client.stubs.SdkObject and populating it with ID, TYPE and HREF.

com.vmware.o11n.sdk.rest.client.stubs.SdkObject O = new SdkObject();        O.setHref("https://orch-00-ah:8281/api/catalog/vCloud/VApp/a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a%252F%252F%252F%252Fhttps%253A%252F%252Fvcdirectort-01-ah.mathworks.com%252Fapi%252FvApp%252Fvapp-97dc7e62-453d-480f-a833-a705c912f617/");        O.setId("a0fd15b787b056aec0db1954d6ad294923dd1ab447af1d2ef69ad1aa4775328a////https://vcdirectort-01-ah.mathworks.com/api/vApp/vapp-97dc7e62-453d-480f-a833-a705c912f617");        O.setType("vCloud:VApp");

 

When the Java call to the REST API to start a Workflow with a specific vApp gets the correct HOST then the vApp is found and the workflow executes.  When the wrong HOST is chosen then the vApp is not found and the workflow fails.  As you can see from the code above I AM passing the full ID, with HOST-prefix.  Adding this information does not matter to the REST API, if the wrong Host is selected then the vApp will not be found.

 

I have looked at

http://pubs.vmware.com/vcloud-api-1-5/wwhelp/wwhimpl/js/html/wwhelp.htm#href=api_prog/GUID-DD7395C3-C69F-41FE-A768-9DC06…

and

VMware vSphere 5.1

and I can not find any information that might help resolve this issue.

 

Thank you for you assistance

Erik


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>