VMware Cloud Community
NigelHarris
Contributor
Contributor
Jump to solution

Master of the integration - Compatibility Issue ?

I've been trying to follow the following blog post.  I've downloaded the package and installed into my environment.

http://blogs.vmware.com/orchestrator/2011/09/this-month-started-with-showing-a-great-example-of-vco-...

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 : 

resthost_config.png

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,

[2011-11-29 10:26:17.092] [I] Request: DynamicWrapper (Instance) : [RESTRequest]-[class com.vmware.o11n.plugin.rest.Request] -- VALUE : com.vmware.o11n.plugin.rest.Request@2e5d7378
[2011-11-29 10:26:17.092] [I] Request URL: https://10.9.184.20/api/org
[2011-11-29 10:26:17.212] [I] Response: DynamicWrapper (Instance) : [RESTResponse]-[class com.vmware.o11n.plugin.rest.Response] -- VALUE : com.vmware.o11n.plugin.rest.Response@3dc31757
[2011-11-29 10:26:17.213] [I] Status code: 403
[2011-11-29 10:26:17.214] [I] Content as string: <?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.rest.handlers.exceptions.UnauthorizedAccessRestApiException: Access is forbidden
   at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.getUnauthorizedRestApiException(ErrorHandler.java:77)
   at com.vmware.vcloud.api.rest.common.handlers.ErrorHandler.errorUnauthorisedAccess(ErrorHandler.java:52)
   at sun.reflect.GeneratedMethodAccessor2638.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
   at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:133)
   at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:82)
   at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
   at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
   at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
   at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
   at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
   at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
   at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:146)
   at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
   at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
   at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
   at com.vmware.vcloud.api.rest.jaxrs.servlet.CxfServlet.service(CxfServlet.java:163)
   at com.vmware.vcloud.api.rest.jaxrs.servlet.JaxRsDispatcherServlet.doService(JaxRsDispatcherServlet.java:97)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
   at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
   at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
   at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
   at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
   at org.springframework.security.web.firewall.RequestWrapper$FirewalledRequestAwareRequestDispatcher.forward(RequestWrapper.java:132)
   at com.vmware.vcloud.security.web.AuthenticationFilter.doFilter(AuthenticationFilter.java:165)
   at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:128)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
   at com.vmware.vcloud.api.rest.versioning.AcceptHeaderFilter.doFilter(AcceptHeaderFilter.java:115)
   at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:128)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
   at com.vmware.vcloud.security.web.ConversationFilter$1.run(ConversationFilter.java:39)
   at com.vmware.vcloud.security.web.ConversationFilter$1.run(ConversationFilter.java:37)
   at com.vmware.vcloud.common.persist.ConversationContextExecutor.execute(ConversationContextExecutor.java:38)
   at com.vmware.vcloud.security.web.ConversationFilter.doFilter(ConversationFilter.java:45)
   at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:128)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
   at com.vmware.vcloud.security.web.ThreadLocalCleanerFilter.doFilter(ThreadLocalCleanerFilter.java:65)
   at com.vmware.vcloud.api.rest.diagnostics.RestApiDiagnosticsInterceptor.doFilter(RestApiDiagnosticsInterceptor.java:128)
   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
   at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:78)
   at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:154)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
   at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
   at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
   at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
   at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
   at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   at org.mortbay.jetty.Server.handle(Server.java:326)
   at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
   at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
   at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
   at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:680)
   at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
" minorErrorCode="ACCESS_TO_RESOURCE_IS_FORBIDDEN" message="Access is forbidden" majorErrorCode="403" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.9.184.20/api/v1.5/schema/master.xsd"></Error>
[2011-11-29 10:26:17.229] [I] HTTPError: status code: 403 (Workflow:Invoke a REST operation / Check status code (item3)#1)
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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

Screen shot 2011-11-30 at 5.14.39 PM.png

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
9 Replies
NigelHarris
Contributor
Contributor
Jump to solution

Help, Help...

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
NigelHarris
Contributor
Contributor
Jump to solution

Thanks - will start looking into using the VCD plugin to retrieve vApp info from a blocked provisioning task

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
NigelHarris
Contributor
Contributor
Jump to solution

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,

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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

Screen shot 2011-11-30 at 5.14.39 PM.png

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
NigelHarris
Contributor
Contributor
Jump to solution

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: 

var props = subscription.retrieveLastOnMessageTrigger();
//if (!props) {
//System.log('props');
//}
//else {
//System.log('props is empty');
//}  will not work as this is a void function
var headers = props.get('headers');
System.log('=============================='); 
System.log('headers:');
System.log(headers);
System.log('=============================='); 
var messageBody = props.get('body');  
System.log('=============================='); 
System.log('messageBody:');
System.log(messageBody);
System.log('==============================');
var properties = props.get('properties');
System.log('=============================='); 
System.log('properties:');
System.log(properties);
System.log('==============================');
TargetBlockingTaskUUID = '';
TargetBlockingTaskUUID += headers.get("notification.entityUUID");
System.log('TargetBlockingTaskUUID is: ' + TargetBlockingTaskUUID);
//pull the message into the notification helper object and then print out each attribute it has
var notificationHelper = new VclNotificationHelper();
notificationHelper.setMessage(messageBody);
System.log('NotificationHelper is: ' + notificationHelper.getMessage());
System.log('NotificationHelper getBlockingTaskLink is: ' + notificationHelper.getBlockingTaskLink());
System.log('NotificationHelper getEntityLink is: ' + notificationHelper.getEntityLink());
System.log('NotificationHelper getEntityLinkType is: ' + notificationHelper.getEntityLinkType());
System.log('NotificationHelper getMessage is: ' + notificationHelper.getMessage());
System.log('NotificationHelper getNotification is: ' + notificationHelper.getNotification());
System.log('NotificationHelper getOrgLink is: ' + notificationHelper.getOrgLink());
System.log('NotificationHelper getTaskOwnerLink is: ' + notificationHelper.getTaskOwnerLink());
System.log('NotificationHelper getTaskOwnerLinkType is: ' + notificationHelper.getTaskOwnerLinkType());
System.log('NotificationHelper getUserLink is: ' + notificationHelper.getUserLink());
System.log('NotificationHelper isBlockingTask is: ' + notificationHelper.isBlockingTask());
System.log('==========================');
var vcdHost = new VclHost();
vcdHost = My_vCloudHost; //cast the vCloud config we set as an attribute into this local vcdHost variable
System.log('vCloud url is: ' + vcdHost.url);
System.log('vCloud cloudVersion is: ' + vcdHost.cloudVersion);
System.log('vCloud enabled is: ' + vcdHost.enabled);
System.log('vCloud id is: ' + vcdHost.id);
System.log('vCloud internalId is: ' + vcdHost.internalId);
System.log('vCloud maxConnections is: ' + vcdHost.maxConnections);
System.log('vCloud organization is: ' + vcdHost.organization);
System.log('vCloud sessionMode is: ' + vcdHost.sessionMode);
System.log('vCloud organizations are: ');
var myOrgs = vcdHost.getOrganizations();
System.log('****************************');
//Let's print out the elements of the array.
for (counter=0; counter<myOrgs.length; counter++)
{
var holder=myOrgs[counter];
//var printfriendly = vcdHost.getEntityById(holder.type, holder.id);
//System.log(printfriendly + ' ' );
System.log(holder + ' ' );
//holder='';
//printfriendly ='';
System.log('>');
}
;
//System.log('==========================');
//System.log('Other methods we can run against this object are:');
//System.log('get(String)');
//System.log('getEntityByid(string,string)');
//System.log('getEntityByReference(String, vclReference)');
//System.log('getOrganizations() returns an array of orgs');
//System.log('getUsername, login, logout, post, put');
//System.log('==========================');
System.log('==========================');
var vcdHost = new VclHost();
vcdHost = myitdev1_vCloudHost; //cast the myitdev1_vCloud config we set as an attribute into this local vcdHost variable
System.log('vCloud url is: ' + vcdHost.url);
System.log('vCloud cloudVersion is: ' + vcdHost.cloudVersion);
System.log('vCloud enabled is: ' + vcdHost.enabled);
System.log('vCloud id is: ' + vcdHost.id);
System.log('vCloud internalId is: ' + vcdHost.internalId);
System.log('vCloud maxConnections is: ' + vcdHost.maxConnections);
System.log('vCloud organization is: ' + vcdHost.organization);
System.log('vCloud sessionMode is: ' + vcdHost.sessionMode);
var organizationLink = notificationHelper.getOrgLink();
organization = vcdHost.getEntityById(organizationLink.type, organizationLink.id);
System.log('organization id is: ' + organization);
var blockingTask
if (notificationHelper.isBlockingTask() == true) {
    var blockingTaskLink = notificationHelper.getBlockingTaskLink();
    blockingTask == null;
    blockingTask = vcdHost.getEntityById(blockingTaskLink.type, blockingTaskLink.id);
}
System.log('blockingTask is : ' + blockingTask);

[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

0 Kudos
NigelHarris
Contributor
Contributor
Jump to solution

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:

var blockingTask
if (notificationHelper.isBlockingTask() == true) {
    System.log('its true.............');
    var blockingTaskLink = notificationHelper.getBlockingTaskLink();
    System.log(blockingTaskLink.type);
    System.log(blockingTaskLink.id);
    //blockingTask == null;
    blockingTask = vcdHost.getEntityById(blockingTaskLink.type, blockingTaskLink.id);
}

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

0 Kudos
aleksandarp
VMware Employee
VMware Employee
Jump to solution

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.