I've been trying to follow the following blog post. I've downloaded the package and installed into my environment.
My environment is as follows:
VCO Appliance 4.2
HTTP-REST 1.0
VCD 1.5
VCD 1.5 plugin for VCO
Below is my adjusted config, which matches the config I found in the blog post by Christophe :
After configuring this by running the "Add a rest host" and "Set vCloud authentication to a rest host" workflows. SSL certs have been imported via orchestrator configuration. If I try to run any operation then I get a 403 error - see below. I've created a vco inventory configuration to point to an old vcd1.0 installation and I'm able to successfully execute REST operations against it without issue, so everything points to the VCD1.5 installation. I'm able to successfully write curl commands against the 1.5 environment from the command line. I've created the configuration ten times over so I know this isn't a simple pwd typo. Do not understand why I continue to get 403s ?
Is there a compatability issue ?
thanks,
You have all the broker / exchange / queues / bindings / subscriptions created. I have a workflow doing that.
Then i have a looping workflow listening to messages coming from subscription
The first box does this :
queueName = subscription.queues[0];
messageTrigger = broker.receiveAsync(queueName, 0);
(you need to have subscription / broker as inputs / attributes)
The run workflow run the workflow in which there is the code I posted in this thread previously:
var messageProperties = broker.retrieveLostTriggerProperties(messageTrigger);
if (messageProperties != null) {
messageBody = messageProperties.get("body");
var inputProperties = new Properties();
inputProperties.put("subscription", subscription);
inputProperties.put("messageBody", messageBody);
var token = wf.execute(inputProperties);
I am passing the subscription and the messageBody.
Getting the blocking task allows you to get access to the parent vCD task (in my case the task deploying a vApp from Template).
Having a blocking task object allows you to run the resume / abort / fail library workflows.
I will see if I can provide all the code on the communities.
Help, Help...
With vCD 1.5 plug-in you should not need the REST plug-in anymore. If only I had some time I would post an article with some sample code ...
Christophe.
Thanks - will start looking into using the VCD plugin to retrieve vApp info from a blocked provisioning task
Some sample code to get you started getting the message to vCD objects.
var notificationHelper = new VclNotificationHelper();
notificationHelper.setMessage(messageBody);
var organizationLink = notificationHelper.getOrgLink();
organization = vcdHost.getEntityById(organizationLink.type, organizationLink.id);
if (notificationHelper.isBlockingTask() == true) {
var blockingTaskLink = notificationHelper.getBlockingTaskLink();
blockingTask == null;
blockingTask = vcdHost.getEntityById(blockingTaskLink.type, blockingTaskLink.id);
}
Christophe.
At a high level what is the sequence of events you should execute to retrieve a message ? I cannot see how or where you specify to a script how to connect to vCloud - should that be an input to a workflow ?
In your code it looks like you are retrieving the message into an object and then checking BlockingTask() == true and if it is blocking, you run the vcdHost.getEntityById method. What does that return ? How can the results be used ?
Is there any documentation outside of the API explorer to get more information about the default javascript objects in the VCD 1.5 plugin ?
thanks,
You have all the broker / exchange / queues / bindings / subscriptions created. I have a workflow doing that.
Then i have a looping workflow listening to messages coming from subscription
The first box does this :
queueName = subscription.queues[0];
messageTrigger = broker.receiveAsync(queueName, 0);
(you need to have subscription / broker as inputs / attributes)
The run workflow run the workflow in which there is the code I posted in this thread previously:
var messageProperties = broker.retrieveLostTriggerProperties(messageTrigger);
if (messageProperties != null) {
messageBody = messageProperties.get("body");
var inputProperties = new Properties();
inputProperties.put("subscription", subscription);
inputProperties.put("messageBody", messageBody);
var token = wf.execute(inputProperties);
I am passing the subscription and the messageBody.
Getting the blocking task allows you to get access to the parent vCD task (in my case the task deploying a vApp from Template).
Having a blocking task object allows you to run the resume / abort / fail library workflows.
I will see if I can provide all the code on the communities.
I've been able to populate a helper object. Getting a NULL back when running vcdHost.getEntityById - any ideas what causes this ?
Ultimately, we want to get objects populated that contain the vApp and VM (we only have one) information from the blocking task. Seems painfully obtuse to achieve this. Appreciate you helping us along the way.
thanks,
Code:
[2011-11-30 15:53:20.000] [I] Started from policy : Subscription - vappblockdelete
[2011-11-30 15:53:20.708] [I] ==============================
[2011-11-30 15:53:20.708] [I] headers:
[2011-11-30 15:53:20.708] [I] Properties:1817900198
[2011-11-30 15:53:20.708] [I] ==============================
[2011-11-30 15:53:20.708] [I] ==============================
[2011-11-30 15:53:20.709] [I] messageBody:
[2011-11-30 15:53:20.709] [I] <?xml version="1.0" encoding="UTF-8"?>
<vmext:Notification xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" type="com/vmware/vcloud/event/blockingtask/create" eventId="51bb61ff-1506-4db5-a7e4-5c74c8a53082" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://10.9.184.20/api/v1.5/schema/vmwextensions.xsd">
<vmext:Link rel="entityResolver" href="https://10.9.184.20/api/entity/"/>
<vmext:EntityLink rel="entity" type="vcloud:blockingTask" name="vdcDeleteVapp" id="urn:vcloud:blockingTask:22bd3c39-4b90-4c49-98fc-3faf429b7764"/>
<vmext:EntityLink rel="down" type="vcloud:user" name="biscuits" id="urn:vcloud:user:51a1af44-3c08-4114-82b6-e5a0900a2e64"/>
<vmext:EntityLink rel="up" type="vcloud:org" name="itdev1" id="urn:vcloud:org:f300c1de-ce2c-417e-9525-f797642f1dae"/>
<vmext:EntityLink rel="task" type="vcloud:task" name="vdcDeleteVapp" id="urn:vcloud:task:5dc1f17e-f561-4ef6-a3db-5a519949e4e6"/>
<vmext:EntityLink rel="task:owner" type="vcloud:vapp" id="urn:vcloud:vapp:21ad7a1a-359f-4d13-a50b-ef3e5bd666c5"/>
<vmext:Timestamp>2011-11-30T15:39:11.990-06:00</vmext:Timestamp>
<vmext:OperationSuccess>true</vmext:OperationSuccess>
</vmext:Notification>
[2011-11-30 15:53:20.709] [I] ==============================
[2011-11-30 15:53:20.709] [I] ==============================
[2011-11-30 15:53:20.709] [I] properties:
[2011-11-30 15:53:20.710] [I] Properties:1198781917
[2011-11-30 15:53:20.710] [I] ==============================
[2011-11-30 15:53:20.710] [I] TargetBlockingTaskUUID is: 22bd3c39-4b90-4c49-98fc-3faf429b7764
[2011-11-30 15:53:20.711] [I] NotificationHelper is: <?xml version="1.0" encoding="UTF-8"?>
<vmext:Notification xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" type="com/vmware/vcloud/event/blockingtask/create" eventId="51bb61ff-1506-4db5-a7e4-5c74c8a53082" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://10.9.184.20/api/v1.5/schema/vmwextensions.xsd">
<vmext:Link rel="entityResolver" href="https://10.9.184.20/api/entity/"/>
<vmext:EntityLink rel="entity" type="vcloud:blockingTask" name="vdcDeleteVapp" id="urn:vcloud:blockingTask:22bd3c39-4b90-4c49-98fc-3faf429b7764"/>
<vmext:EntityLink rel="down" type="vcloud:user" name="biscuits" id="urn:vcloud:user:51a1af44-3c08-4114-82b6-e5a0900a2e64"/>
<vmext:EntityLink rel="up" type="vcloud:org" name="itdev1" id="urn:vcloud:org:f300c1de-ce2c-417e-9525-f797642f1dae"/>
<vmext:EntityLink rel="task" type="vcloud:task" name="vdcDeleteVapp" id="urn:vcloud:task:5dc1f17e-f561-4ef6-a3db-5a519949e4e6"/>
<vmext:EntityLink rel="task:owner" type="vcloud:vapp" id="urn:vcloud:vapp:21ad7a1a-359f-4d13-a50b-ef3e5bd666c5"/>
<vmext:Timestamp>2011-11-30T15:39:11.990-06:00</vmext:Timestamp>
<vmext:OperationSuccess>true</vmext:OperationSuccess>
</vmext:Notification>
[2011-11-30 15:53:20.713] [I] NotificationHelper getBlockingTaskLink is: DynamicWrapper (Instance) : [VclEntityLink]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink@4ccd958e
[2011-11-30 15:53:20.713] [I] NotificationHelper getEntityLink is: DynamicWrapper (Instance) : [VclEntityLink]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink@4ccd958e
[2011-11-30 15:53:20.713] [I] NotificationHelper getEntityLinkType is: DynamicWrapper (Instance) : [_VclEntityType]-[class com.vmware.vmo.plugin.vcloud.model.sdk.enumerations.EntityType] -- VALUE : vcloud:blockingTask
[2011-11-30 15:53:20.714] [I] NotificationHelper getMessage is: <?xml version="1.0" encoding="UTF-8"?>
<vmext:Notification xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" type="com/vmware/vcloud/event/blockingtask/create" eventId="51bb61ff-1506-4db5-a7e4-5c74c8a53082" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://10.9.184.20/api/v1.5/schema/vmwextensions.xsd">
<vmext:Link rel="entityResolver" href="https://10.9.184.20/api/entity/"/>
<vmext:EntityLink rel="entity" type="vcloud:blockingTask" name="vdcDeleteVapp" id="urn:vcloud:blockingTask:22bd3c39-4b90-4c49-98fc-3faf429b7764"/>
<vmext:EntityLink rel="down" type="vcloud:user" name="biscuits" id="urn:vcloud:user:51a1af44-3c08-4114-82b6-e5a0900a2e64"/>
<vmext:EntityLink rel="up" type="vcloud:org" name="itdev1" id="urn:vcloud:org:f300c1de-ce2c-417e-9525-f797642f1dae"/>
<vmext:EntityLink rel="task" type="vcloud:task" name="vdcDeleteVapp" id="urn:vcloud:task:5dc1f17e-f561-4ef6-a3db-5a519949e4e6"/>
<vmext:EntityLink rel="task:owner" type="vcloud:vapp" id="urn:vcloud:vapp:21ad7a1a-359f-4d13-a50b-ef3e5bd666c5"/>
<vmext:Timestamp>2011-11-30T15:39:11.990-06:00</vmext:Timestamp>
<vmext:OperationSuccess>true</vmext:OperationSuccess>
</vmext:Notification>
[2011-11-30 15:53:20.714] [I] NotificationHelper getNotification is: DynamicWrapper (Instance) : [VclNotification]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.extension.Notification] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.extension.Notification@495cfb12
[2011-11-30 15:53:20.715] [I] NotificationHelper getOrgLink is: DynamicWrapper (Instance) : [VclEntityLink]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink@2c1cd890
[2011-11-30 15:53:20.715] [I] NotificationHelper getTaskOwnerLink is: DynamicWrapper (Instance) : [VclEntityLink]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink@1e65ef2c
[2011-11-30 15:53:20.715] [I] NotificationHelper getTaskOwnerLinkType is: DynamicWrapper (Instance) : [_VclEntityType]-[class com.vmware.vmo.plugin.vcloud.model.sdk.enumerations.EntityType] -- VALUE : vcloud:vapp
[2011-11-30 15:53:20.716] [I] NotificationHelper getUserLink is: DynamicWrapper (Instance) : [VclEntityLink]-[class com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink] -- VALUE : com.vmware.vmo.plugin.vcloud.model.schema.objects.EntityLink@50855e75
[2011-11-30 15:53:20.716] [I] NotificationHelper isBlockingTask is: true
[2011-11-30 15:53:20.716] [I] ==========================
[2011-11-30 15:53:20.716] [I] vCloud url is: https://10.9.184.20:443
[2011-11-30 15:53:20.717] [I] vCloud cloudVersion is: 1.5
[2011-11-30 15:53:20.717] [I] vCloud enabled is: true
[2011-11-30 15:53:20.717] [I] vCloud id is: https://10.9.184.20:443
[2011-11-30 15:53:20.717] [I] vCloud internalId is: e7cce841-d9d3-44d8-932b-a81f31319c89
[2011-11-30 15:53:20.718] [I] vCloud maxConnections is: 600
[2011-11-30 15:53:20.718] [I] vCloud organization is: System
[2011-11-30 15:53:20.718] [I] vCloud sessionMode is: DynamicWrapper (Instance) : [_VclHostSessionMode]-[class com.vmware.vmo.plugin.vcloud.model.enumerations.VCloudHostSessionMode] -- VALUE : SHARED_SESSION
[2011-11-30 15:53:20.718] [I] vCloud organizations are:
[2011-11-30 15:53:20.729] [I] ****************************
[2011-11-30 15:53:20.729] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@14565148
[2011-11-30 15:53:20.729] [I] >
[2011-11-30 15:53:20.730] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@4187985f
[2011-11-30 15:53:20.730] [I] >
[2011-11-30 15:53:20.730] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@5c1eaac8
[2011-11-30 15:53:20.730] [I] >
[2011-11-30 15:53:20.730] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@b6e81804
[2011-11-30 15:53:20.731] [I] >
[2011-11-30 15:53:20.731] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@796aeec4
[2011-11-30 15:53:20.731] [I] >
[2011-11-30 15:53:20.731] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@74a46ae4
[2011-11-30 15:53:20.731] [I] >
[2011-11-30 15:53:20.732] [I] DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@d849cbb4
[2011-11-30 15:53:20.732] [I] >
[2011-11-30 15:53:20.732] [I] ==========================
[2011-11-30 15:53:20.732] [I] vCloud url is: https://10.9.184.20:443
[2011-11-30 15:53:20.733] [I] vCloud cloudVersion is: 1.5
[2011-11-30 15:53:20.733] [I] vCloud enabled is: true
[2011-11-30 15:53:20.733] [I] vCloud id is: https://10.9.184.20:443
[2011-11-30 15:53:20.734] [I] vCloud internalId is: 75ffb29d-83f5-4c12-b6b8-a4a6ae48b939
[2011-11-30 15:53:20.734] [I] vCloud maxConnections is: 600
[2011-11-30 15:53:20.734] [I] vCloud organization is: itdev1
[2011-11-30 15:53:20.734] [I] vCloud sessionMode is: DynamicWrapper (Instance) : [_VclHostSessionMode]-[class com.vmware.vmo.plugin.vcloud.model.enumerations.VCloudHostSessionMode] -- VALUE : SHARED_SESSION
[2011-11-30 15:53:21.208] [I] organization id is: DynamicWrapper (Instance) : [VclOrganization]-[class com.vmware.vmo.plugin.vcloud.model.Org] -- VALUE : com.vmware.vmo.plugin.vcloud.model.Org@5c1eaac8
[2011-11-30 15:53:21.222] [I] blockingTask is : null
I updated the code a little to add some debug - Isn't blockingtask supposed to be an object that is populated with attributes ? How can we test that ? Is one of the blockingtask attributes going to be a link to the vApp in question ?
code:
output:
[2011-11-30 16:06:34.551] [I] its true.............
[2011-11-30 16:06:34.552] [I] vcloud:blockingTask
[2011-11-30 16:06:34.552] [I] urn:vcloud:blockingTask:63605bea-d14c-4607-8dbd-857b7732432d
[2011-11-30 16:06:34.572] [I] blockingTask is : null
You could try this way:
var taskLink = myVclNotificationHelper.getEntityLink();
var blockingTask = vCloudHost.getEntityById(VclEntityType.BLOCKING_TASK, taskLink.id);
var vAppRef = blockingTask.taskOwner;
var vApp = vCloudHost.getEntityByReference ( VclEntityType.VAPP, vAppRef );
vApp.updateInternalState();
vms = vApp.getChildrenVms();
So I think the proper method for getting the blocking task link i s getEntityLink() since you are getting this part of the message XML:
<vmext:EntityLink rel="entity" type="vcloud:blockingTask" name="vdcDeleteVapp" id="urn:vcloud:blockingTask:22bd3c39-4b90-4c49-98fc-3faf429b7764"/>
Hope that this helps.