From d23e6fdf4774c351c75d4847990936759636bcae Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 7 Aug 2017 14:42:17 +0000 Subject: [PATCH] Drop v1 API in Pike+ Drop the v1 Cinder API for Pike+ since it is deprecated and no longer maintained in the upstream code base. Change-Id: I99e604916f6147b181f45a773c20f3adf2306788 --- config.yaml | 12 ++++---- hooks/cinder_hooks.py | 51 +++++++++++++++++---------------- unit_tests/test_cinder_hooks.py | 10 ------- 3 files changed, 33 insertions(+), 40 deletions(-) diff --git a/config.yaml b/config.yaml index 747c0095..0211655d 100644 --- a/config.yaml +++ b/config.yaml @@ -336,8 +336,8 @@ options: os-public-hostname set to 'cinder.example.com' with ssl enabled will create two public endpoints for cinder: . - https://cinder.example.com:443/v1/$(tenant_id)s and - https://cinder.example.com:443/v2/$(tenant_id)s + https://cinder.example.com:443/v2/$(tenant_id)s and + https://cinder.example.com:443/v3/$(tenant_id)s os-internal-hostname: type: string default: @@ -349,8 +349,8 @@ options: os-internal-hostname set to 'cinder.internal.example.com' with ssl enabled will create two internal endpoints for cinder: . - https://cinder.internal.example.com:443/v1/$(tenant_id)s and - https://cinder.internal.example.com:443/v2/$(tenant_id)s + https://cinder.internal.example.com:443/v2/$(tenant_id)s and + https://cinder.internal.example.com:443/v3/$(tenant_id)s os-admin-hostname: type: string default: @@ -362,8 +362,8 @@ options: os-admin-hostname set to 'cinder.admin.example.com' with ssl enabled will create two admin endpoints for cinder: . - https://cinder.admin.example.com:443/v1/$(tenant_id)s and - https://cinder.admin.example.com:443/v2/$(tenant_id)s + https://cinder.admin.example.com:443/v2/$(tenant_id)s and + https://cinder.admin.example.com:443/v3/$(tenant_id)s prefer-ipv6: type: boolean default: False diff --git a/hooks/cinder_hooks.py b/hooks/cinder_hooks.py index c0cb86a4..476121d2 100755 --- a/hooks/cinder_hooks.py +++ b/hooks/cinder_hooks.py @@ -306,34 +306,37 @@ def amqp_departed(): @hooks.hook('identity-service-relation-joined') def identity_joined(rid=None): + settings = {} + if not service_enabled('api'): juju_log('api service not enabled; skipping endpoint registration') return - public_url = '{}:{}/v1/$(tenant_id)s'.format( - canonical_url(CONFIGS, PUBLIC), - config('api-listening-port') - ) - internal_url = '{}:{}/v1/$(tenant_id)s'.format( - canonical_url(CONFIGS, INTERNAL), - config('api-listening-port') - ) - admin_url = '{}:{}/v1/$(tenant_id)s'.format( - canonical_url(CONFIGS, ADMIN), - config('api-listening-port') - ) - settings = { - 'region': None, - 'service': None, - 'public_url': None, - 'internal_url': None, - 'admin_url': None, - 'cinder_region': config('region'), - 'cinder_service': 'cinder', - 'cinder_public_url': public_url, - 'cinder_internal_url': internal_url, - 'cinder_admin_url': admin_url, - } + if CompareOpenStackReleases(os_release('cinder-common')) < 'pike': + public_url = '{}:{}/v1/$(tenant_id)s'.format( + canonical_url(CONFIGS, PUBLIC), + config('api-listening-port') + ) + internal_url = '{}:{}/v1/$(tenant_id)s'.format( + canonical_url(CONFIGS, INTERNAL), + config('api-listening-port') + ) + admin_url = '{}:{}/v1/$(tenant_id)s'.format( + canonical_url(CONFIGS, ADMIN), + config('api-listening-port') + ) + settings.update({ + 'region': None, + 'service': None, + 'public_url': None, + 'internal_url': None, + 'admin_url': None, + 'cinder_region': config('region'), + 'cinder_service': 'cinder', + 'cinder_public_url': public_url, + 'cinder_internal_url': internal_url, + 'cinder_admin_url': admin_url, + }) if CompareOpenStackReleases(os_release('cinder-common')) >= 'icehouse': # NOTE(jamespage) register v2 endpoint as well public_url = '{}:{}/v2/$(tenant_id)s'.format( diff --git a/unit_tests/test_cinder_hooks.py b/unit_tests/test_cinder_hooks.py index bc00dc9b..3a8cb3cd 100644 --- a/unit_tests/test_cinder_hooks.py +++ b/unit_tests/test_cinder_hooks.py @@ -546,16 +546,6 @@ class TestJoinedHooks(CharmTestCase): _canonical_url.return_value = 'http://cindernode1' hooks.hooks.execute(['hooks/identity-service-relation-joined']) expected = { - 'region': None, - 'service': None, - 'public_url': None, - 'internal_url': None, - 'admin_url': None, - 'cinder_service': 'cinder', - 'cinder_region': 'RegionOne', - 'cinder_public_url': 'http://cindernode1:8776/v1/$(tenant_id)s', - 'cinder_admin_url': 'http://cindernode1:8776/v1/$(tenant_id)s', - 'cinder_internal_url': 'http://cindernode1:8776/v1/$(tenant_id)s', 'cinderv2_service': 'cinderv2', 'cinderv2_region': 'RegionOne', 'cinderv2_public_url': 'http://cindernode1:8776/v2/$(tenant_id)s',