Julio_Navarro
Jul 18, 2019Cirrostratus
Using an asynchronous task | Creating UCS File
Hi,
I am trying the following REST URL to create a task to generate a UCS File:
Method: Post
URI: mgmt/tm/task/sys/ucs/
Body: { "command": "save", "name": "UCS01" }
So, I get back:
{
"_taskId": 1563464422689504,
"_taskState": "STARTED",
"_taskTimeInStateMs": 0,
"_taskResultLink": "https://localhost/mgmt/tm/task/sys/ucs/1563464422689504/result?ver=12.1.3.4",
"selfLink": "https://localhost/mgmt/tm/task/sys/ucs/1563464422689504?ver=12.1.3.4"
}
Now, when I do check the status:
Method: Get
URI: /mgmt/tm/task/sys/ucs/1563464422689504
I gel back:
{
"selfLink": "https://localhost/mgmt/tm/task/sys/ucs/1563464422689504?ver=12.1.3.4",
"_taskId": 1563464422689504,
"_taskState": "COMPLETED",
"_taskTimeInStateMs": 5000,
"_taskResultLink": "https://localhost/mgmt/tm/task/sys/ucs/1563464422689504/result?ver=12.1.3.4"
}
When I go to /var/local/ucs, I don't see the UCS created.
** Maybe I am missing something. Please advise **
----------- If I don't use the "task" option, then it will worked. But I would like to use the task option to take advantage of asynchronous tasks ----
Thank you
; to close the loop on this one, it appears that you the part that was missing in your request is the -X PUT request, to set the state to 'VALIDATING'
# curl -k -u admin:admin -H 'Content-Type: application/json' -X PUT -d '{"_taskState":"VALIDATING"}' https://localhost/mgmt/tm/task/sys/ucs/1563478591515657?ver=12.1.3.4 { "code":202, "message":"Task will execute asynchronously.", "errorStack":[] }
That is the request which is necessary to cause any task to begin processing. Until then, the task is waiting for any number of additional tasks to be added together.