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.
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
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
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.)
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