diff --git a/api-ref/source/v2/images-images-v2.inc b/api-ref/source/v2/images-images-v2.inc index 1570fa0019..44bcb8b040 100644 --- a/api-ref/source/v2/images-images-v2.inc +++ b/api-ref/source/v2/images-images-v2.inc @@ -314,6 +314,48 @@ Response Example :language: json +Show tasks associated with image +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. rest_method:: GET /v2/images/{image_id}/tasks + +Shows tasks associated with an image. +*(Since Image API v2.12)* + +The response body contains list of tasks, possibly empty, associated +with the specified image. + +Preconditions + +- The image must exist. + +Normal response codes: 200 + +Error response codes: 404 + + +Request +------- + +.. rest_parameters:: images-parameters.yaml + + - image_id: image_id-in-path + + +Response Parameters +------------------- + +.. rest_parameters:: images-parameters.yaml + + - tasks: tasks + +Response Example +---------------- + +.. literalinclude:: samples/image-tasks-show-response.json + :language: json + + List images ~~~~~~~~~~~ diff --git a/api-ref/source/v2/images-parameters.yaml b/api-ref/source/v2/images-parameters.yaml index 1e960c063b..0106857f17 100644 --- a/api-ref/source/v2/images-parameters.yaml +++ b/api-ref/source/v2/images-parameters.yaml @@ -650,6 +650,12 @@ tags-in-request: in: body required: false type: array +tasks: + description: | + A list of *task* objects, associated with the given image. + in: body + required: true + type: array updated_at: description: | The date and time when the resource was updated. diff --git a/api-ref/source/v2/samples/image-tasks-show-response.json b/api-ref/source/v2/samples/image-tasks-show-response.json new file mode 100644 index 0000000000..82ca3e28bb --- /dev/null +++ b/api-ref/source/v2/samples/image-tasks-show-response.json @@ -0,0 +1,37 @@ +{ + "tasks": [ + { + "id": "ee22890e-8948-4ea6-9668-831f973c84f5", + "image_id": "dddddddd-dddd-dddd-dddd-dddddddddddd", + "request-id": "rrrrrrr-rrrr-rrrr-rrrr-rrrrrrrrrrrr", + "user": "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu", + "type": "api_image_import", + "status": "processing", + "owner": "64f0efc9955145aeb06f297a8a6fe402", + "expires_at": null, + "created_at": "2020-12-18T05:20:38.000000", + "updated_at": "2020-12-18T05:25:39.000000", + "deleted_at": null, + "deleted": false, + "input": { + "image_id": "829c729b-ebc4-4cc7-a164-6f43f1149b17", + "import_req": { + "method": { + "name": "copy-image" + }, + "all_stores": true, + "all_stores_must_succeed": false + }, + "backend": [ + "fast", + "cheap", + "slow", + "reliable", + "common" + ] + }, + "result": null, + "message": "Copied 15 MiB" + } + ] +} diff --git a/releasenotes/notes/image-tasks-api-f21b42eab91c2079.yaml b/releasenotes/notes/image-tasks-api-f21b42eab91c2079.yaml new file mode 100644 index 0000000000..07041d8571 --- /dev/null +++ b/releasenotes/notes/image-tasks-api-f21b42eab91c2079.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + While fixing race condition issue during victoria we started + updating 'message' property of the task which helps calculate + time based on last updated time of task to burst the lock as well + as show how much data has been copied of that image. As glance + task API's are restricted from use by normal users we are adding + new API /v2/images/{image_id}/tasks which will return all tasks + associated with that image. In addition to task information + this API will also return `request-id` and `user-id` to help + users in debugging.