diff --git a/api-ref/source/v2/cache-manage.inc b/api-ref/source/v2/cache-manage.inc index 93379f434a..00156ab9d3 100644 --- a/api-ref/source/v2/cache-manage.inc +++ b/api-ref/source/v2/cache-manage.inc @@ -47,7 +47,7 @@ Queue image Queues image for caching. *(Since Image API v2.14)* -Normal response codes: 200 +Normal response codes: 202 Error response codes: 400, 401, 403, 404 diff --git a/glance/api/v2/cached_images.py b/glance/api/v2/cached_images.py index 002b8cf9bf..812ddb3cda 100644 --- a/glance/api/v2/cached_images.py +++ b/glance/api/v2/cached_images.py @@ -238,7 +238,9 @@ class CachedImageDeserializer(wsgi.JSONRequestDeserializer): class CachedImageSerializer(wsgi.JSONResponseSerializer): - pass + + def queue_image_from_api(self, response, result): + response.status_int = 202 def create_resource(): diff --git a/glance/tests/functional/v2/test_cache_api.py b/glance/tests/functional/v2/test_cache_api.py index bd3048aef5..4865c6d4f9 100644 --- a/glance/tests/functional/v2/test_cache_api.py +++ b/glance/tests/functional/v2/test_cache_api.py @@ -79,7 +79,7 @@ class TestImageCache(functional.SynchronousAPIBase): if response.status_code == 200: return response.json - def cache_queue(self, image_id, expected_code=200): + def cache_queue(self, image_id, expected_code=202): # Queue image for prefetching path = '/v2/cache/%s' % image_id response = self.api_put(path)