VMware Cloud Community
Mansie
Contributor
Contributor
Jump to solution

How to check if entity is in "Busy" state

Hi,

I am trying to add a new vm to a vApp, using recomposevApp. At the same time several other threads also try to recompose and add a vm to the same vApp. And then I delete the vApp from which the vm was added. This is causing several exceptions.

  • No access to entity
  • Entity is Busy completing an operation.
  • The operation is not allowed, please contact ur vcloud administrator.

I want to know, how I can check if the vApp to which a vm is to be added, is in busy state or not?

I want to check if the vapp is in stable condition before adding a vm to it.

Any other ideas are welcome. Please help asap.

Thanks in advance.

Mansie

Reply
0 Kudos
1 Solution

Accepted Solutions
Todor_Todorov
Hot Shot
Hot Shot
Jump to solution

You can check whether a vApp is busy in two ways:

1) get the vApp, observe the <Tasks> element inside the vApp and check for any tasks in 'running' state: if there's a running task then the vApp is busy and cannot be recomposed

2) using the query service you can execute a vApp query (GET /api/query?type=adminVApp) to get all vApps (or filter by name to get the vApp you're interested in): inside the query results there's a boolean field called 'isBusy' showing whether the vApp is busy or not.

Regards,

Todor Todorov

View solution in original post

Reply
0 Kudos
2 Replies
ndalal
VMware Employee
VMware Employee
Jump to solution

recomposeVApp operation shoudl return you TaskType.

In TaskType there is a field call 'status', which has one of following values:

The execution status of the task. One of:
queued (The task has been queued for execution)
preRunning (The task is awaiting preprocessing or                             administrative action.)
running (The task is running.)
success (The task completed with a status of                             success.)
error (The task encountered an error while                             running.)
canceled (The task was canceled by the owner or an                             administrator.)
aborted (The task was aborted by an administrative                             action.)

Todor_Todorov
Hot Shot
Hot Shot
Jump to solution

You can check whether a vApp is busy in two ways:

1) get the vApp, observe the <Tasks> element inside the vApp and check for any tasks in 'running' state: if there's a running task then the vApp is busy and cannot be recomposed

2) using the query service you can execute a vApp query (GET /api/query?type=adminVApp) to get all vApps (or filter by name to get the vApp you're interested in): inside the query results there's a boolean field called 'isBusy' showing whether the vApp is busy or not.

Regards,

Todor Todorov

Reply
0 Kudos