From 811395c6453c59abffadc9fd0c08e887b1a8b996 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Fri, 5 May 2017 08:57:13 -0700 Subject: [PATCH] Deprecate osapi_volume_base_url duplicate option This option duplicates what public_endpoint does. Change-Id: I2a74af7906d14cbc49b8cf0a88c344ca30fcbd26 --- cinder/api/common.py | 15 +++++++++------ cinder/api/views/versions.py | 3 ++- ...te_osapi_volume_base_url-b6984886a902a562.yaml | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/deprecate_osapi_volume_base_url-b6984886a902a562.yaml diff --git a/cinder/api/common.py b/cinder/api/common.py index f67b6eb7b..33095c158 100644 --- a/cinder/api/common.py +++ b/cinder/api/common.py @@ -37,9 +37,11 @@ api_common_opts = [ help='The maximum number of items that a collection ' 'resource returns in a single response'), cfg.StrOpt('osapi_volume_base_URL', - help='Base URL that will be presented to users in links ' - 'to the OpenStack Volume API', - deprecated_name='osapi_compute_link_prefix'), + help='DEPRECATED: Base URL that will be presented to users in ' + 'links to the OpenStack Volume API', + deprecated_name='osapi_compute_link_prefix', + deprecated_since='Pike', + deprecated_reason='Duplicate config option.'), cfg.StrOpt('resource_query_filters_file', default='/etc/cinder/resource_filters.json', help="Json file indicating user visible filter " @@ -59,6 +61,7 @@ api_common_opts = [ ] CONF = cfg.CONF +CONF.import_opt('public_endpoint', 'cinder.api.views.versions') CONF.register_opts(api_common_opts) LOG = logging.getLogger(__name__) @@ -297,7 +300,7 @@ class ViewBuilder(object): params = request.params.copy() params["marker"] = identifier prefix = self._update_link_prefix(get_request_url(request), - CONF.osapi_volume_base_URL) + CONF.public_endpoint) url = os.path.join(prefix, request.environ["cinder.context"].project_id, collection_name) @@ -306,7 +309,7 @@ class ViewBuilder(object): def _get_href_link(self, request, identifier): """Return an href string pointing to this object.""" prefix = self._update_link_prefix(get_request_url(request), - CONF.osapi_volume_base_URL) + CONF.public_endpoint) return os.path.join(prefix, request.environ["cinder.context"].project_id, self._collection_name, @@ -316,7 +319,7 @@ class ViewBuilder(object): """Create a URL that refers to a specific resource.""" base_url = remove_version_from_href(get_request_url(request)) base_url = self._update_link_prefix(base_url, - CONF.osapi_volume_base_URL) + CONF.public_endpoint) return os.path.join(base_url, request.environ["cinder.context"].project_id, self._collection_name, diff --git a/cinder/api/views/versions.py b/cinder/api/views/versions.py index 873f5d918..bf0fd434a 100644 --- a/cinder/api/views/versions.py +++ b/cinder/api/views/versions.py @@ -27,7 +27,8 @@ versions_opts = [ "is None, which will use the request's host_url " "attribute to populate the URL base. If Cinder is " "operating behind a proxy, you will want to change " - "this to represent the proxy's URL."), + "this to represent the proxy's URL.", + deprecated_name='osapi_volume_base_URL'), ] CONF = cfg.CONF diff --git a/releasenotes/notes/deprecate_osapi_volume_base_url-b6984886a902a562.yaml b/releasenotes/notes/deprecate_osapi_volume_base_url-b6984886a902a562.yaml new file mode 100644 index 000000000..1c5d365af --- /dev/null +++ b/releasenotes/notes/deprecate_osapi_volume_base_url-b6984886a902a562.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - Instead of using osapi_volume_base_url use public_endpoint. Both do the + same thing.