The BlockingTask element includes links that you can use to take action on a blocking task.

A BlockingTask element is primarily a collection of Link elements that allow you to take action on the task. When a user requests an operation that is configured to create a blocking task, the system sends a message about the task to the configured AMQP broker, and also creates a reference to the task in the cloud's BlockingTaskReferences container. A system administrator can retrieve the list of BlockingTask elements by making a GET request to the system's extension/blockingTasks link. See Monitor Blocking Tasks.

After authenticating to the cloud as a system administrator, the AMQP client can retrieve a blocking task. The AMQP client makes a GET request to a URL that the task creates by appending the value of the id attribute of the task to the entityResolver URL in the Notification. See Notification Message Format.

The following actions are allowed:

resume
Unblock the task and allow it to continue.
abort
End the task, cleaning up any transient objects that it created. Task status is set to ABORTED.
fail
End the task, setting the status of any transient objects that it created to ERROR. Task status is set to ERROR.
updateProgress
Reset the timeout value and timeout action for an active task. Use this action to keep the task alive when it might become subject to a timeout action.

Prerequisites

This operation is restricted to system administrators.

Procedure

  1. Retrieve the list of active blocking tasks.
    See Monitor Blocking Tasks. If you are using an AMQP client to handle blocking tasks, skip this step. Each blocking task creates its own AMQP message, which contains a reference to the BlockingTask.
  2. Retrieve an individual BlockingTask.
    See the request portion of Handling a Blocking Task.
  3. Make a request.
    Action Request
    resume POST a BlockingTaskOperationParams element to the Link where rel="resume"
    abort POST a BlockingTaskOperationParams element to the Link where rel="abort"
    fail POST a BlockingTaskOperationParams element to the Link where rel="fail"
    updateProgress POST a BlockingTaskUpdateProgressParams element to the Link where rel="updateProgress"

Example: Handling a Blocking Task

This request shows how to retrieve a blocking task without using an AMQP client. Notification Message Format shows how to retrieve the same task using information in the AMQP message.

Request:
GET https://vcloud.example.com/api/admin/extension/blockingTask/25
Response:
200 OK
Content-Type: application/vnd.vmware.admin.blockingTask+xml
...
<vmext:BlockingTask
   xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   status="active"
   timeoutDate="2011-05-07T16:25:18.857+03:00"
   timeoutAction="abort"
   createdTime="2011-05-02T16:25:18.857+03:00"
   name="importSingletonTemplate"
   id="urn:vcloud:blockingTask:25"
   type="application/vnd.vmware.admin.blockingTask+xml"
   href="https://vcloud.example.com/api/admin/extension/blockingTask/25">
   <vcloud:Link
      rel="resume"
      type="application/vnd.vmware.admin.blockingTaskOperationParams+xml"
      href="https://vcloud.example.com/api/admin/extension/blockingTask/25/action/resume" />
   <vcloud:Link
      rel="abort"
      type="application/vnd.vmware.admin.blockingTaskOperationParams+xml"
      href="https://vcloud.example.com/api/admin/extension/blockingTask/25/action/abort" />
   <vcloud:Link
      rel="fail"
      type="application/vnd.vmware.admin.blockingTaskOperationParams+xml"
      href="https://vcloud.example.com/api/admin/extension/blockingTask/25/action/fail" />
   <vcloud:Link
      rel="updateProgress"
      type="application/vnd.vmware.admin.BlockingTaskUpdateProgressOperationParams+xml"
      href="https://vcloud.example.com/api/admin/extension/blockingTask/25/action/updateProgress" />
   <vcloud:Link
      rel="up"
      type="application/vnd.vmware.vcloud.task+xml"
      href="https://vcloud.example.com/api/task/42" />
   <vcloud:Organization
      type="application/vnd.vmware.admin.organization+xml"
      name="example"
      href="https://vcloud.example.com/api/admin/org/97" />
   <vcloud:User
      type="application/vnd.vmware.admin.user+xml"
      name="system"
      href="https://vcloud.example.com/api/admin/user/80" />
   <vcloud:TaskOwner
      type="application/vnd.vmware.vcloud.vAppTemplate+xml"
      name=""
      href="https://vcloud.example.com/api/vAppTemplate/vappTemplate-89" />
</vmext:BlockingTask>
The following request allows the task to resume with a message indicating administrative approval.
POST https://vcloud.example.com/api/admin/extension/blockingTask/25/action/resume
Content-Type: application/vnd.vmware.admin.blockingTaskOperationParams+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<BlockingTaskOperationParams
   xmlns="http://www.vmware.com/vcloud/extension/v1.5" >
   <Message>Approved by system administrator.</Message>
</BlockingTaskOperationParams>