iancollins
Contributor
Contributor

Getting the task object from a blocking task for vdcRecomposeVapp (create a new VM)

Hi,

I have a workflow that gets a blocking task message from AMQP and attempts to get the actual task details.  The code looks like:-

task = document..EntityLink.(@type == "vcloud:task").@id;

System.log("task: "+task);

var taskObject = vcdHost.getEntityById(VclFinderType.TASK,task);

This works fine when deleting a VM from a vApp and when copying a VM to a vApp.  However, when i create a new VM in a vApp, it fails to get the task object.  I have checked that the task reference retrived from the message is the same as the task reference shown in vDC blocking tasks.

Am i doing somethng wrong, or for a create do i have to do something different?

Thanks

Ian...

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee

Just to clarify, does it fails on line 1 (cannot determine task ID) in the code above, or on line 3 (cannot find a task with a given ID)?

If on line 1, then maybe the document content is different and you'll need a different selector expression to fetch task ID. Could you dump the content of the document to check what are the differences in both cases?

0 Kudos
iancollins
Contributor
Contributor

Hi Ilian,

It runs line 1 fine, and i have chacked the id against the blocking task as shown in vCD.  Its line 3, where it tried to get the task object using the id that fails.

But, its odd, because if the blocking task is to delete a VM or to copy an existing Vm then the code works.  It only fails if its is a task to create a new VM.

Thanks

Ian...

0 Kudos