From 1fcf319046e3b55b07c69d111867ce7a94025b95 Mon Sep 17 00:00:00 2001 From: Erno Kuvaja Date: Wed, 14 Dec 2016 16:08:25 +0000 Subject: [PATCH] Add OpenStack-image-import-methods header Adding OpenStack-image-import-methods header to the image create response to indicate that glance-direct Image Import method is available. Change-Id: Ie70abd0737e4ddf52fded941d7abc9d9d1eb285a --- glance/api/v2/images.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glance/api/v2/images.py b/glance/api/v2/images.py index a91ec6be9c..000826f5bf 100644 --- a/glance/api/v2/images.py +++ b/glance/api/v2/images.py @@ -807,6 +807,11 @@ class ResponseSerializer(wsgi.JSONResponseSerializer): response.status_int = http.CREATED self.show(response, image) response.location = self._get_image_href(image) + # TODO(jokke): make this configurable when swift-local is implemented + # and remove the if statement with the config option. + if CONF.enable_image_import: + import_methods = "OpenStack-image-import-methods: glance-direct" + response.headerlist.extend([import_methods]) def show(self, response, image): image_view = self._format_image(image)