Drop support for the Cinder v2 API
We deprecated support for the Cinder v2 API in Pike: Ice67d29f31aa5bd5c84fad4e828435d8552a9629 Enough time has passed that we can drop support for the v2 API and rely solely on the v3 API. Change-Id: Ibbc30b071f638114a4f0967a90c43b593bf47e1f
This commit is contained in:
parent
f91817aaf4
commit
eadbacbda6
@ -33,7 +33,7 @@ Possible values:
|
|||||||
* Format is separated values of the form:
|
* Format is separated values of the form:
|
||||||
<service_type>:<service_name>:<endpoint_type>
|
<service_type>:<service_name>:<endpoint_type>
|
||||||
|
|
||||||
Note: Nova does not support the Cinder v1 API since the Nova 15.0.0 Ocata
|
Note: Nova does not support the Cinder v2 API since the Nova 17.0.0 Queens
|
||||||
release.
|
release.
|
||||||
|
|
||||||
Related options:
|
Related options:
|
||||||
@ -48,9 +48,9 @@ this template for cinder endpoint
|
|||||||
Possible values:
|
Possible values:
|
||||||
|
|
||||||
* URL for cinder endpoint API
|
* URL for cinder endpoint API
|
||||||
e.g. http://localhost:8776/v2/%(project_id)s
|
e.g. http://localhost:8776/v3/%(project_id)s
|
||||||
|
|
||||||
Note: Nova does not support the Cinder v1 API since the Nova 15.0.0 Ocata
|
Note: Nova does not support the Cinder v2 API since the Nova 17.0.0 Queens
|
||||||
release.
|
release.
|
||||||
|
|
||||||
Related options:
|
Related options:
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from cinderclient.v2 import client as cinder_client_v2
|
from cinderclient.v3 import client as cinder_client_v3
|
||||||
import mock
|
import mock
|
||||||
from requests_mock.contrib import fixture
|
from requests_mock.contrib import fixture
|
||||||
|
|
||||||
@ -134,26 +134,45 @@ class CinderV1TestCase(test.NoDBTestCase):
|
|||||||
get_api_version.assert_called_once_with(get_endpoint.return_value)
|
get_api_version.assert_called_once_with(get_endpoint.return_value)
|
||||||
|
|
||||||
|
|
||||||
class CinderV2TestCase(BaseCinderTestCase, test.NoDBTestCase):
|
# NOTE(mriedem): This does not extend BaseCinderTestCase because Cinder v2 is
|
||||||
"""Test case for cinder volume v2 api."""
|
# no longer supported, this is just to test that trying to use v2 fails.
|
||||||
|
class CinderV2TestCase(test.NoDBTestCase):
|
||||||
|
|
||||||
URL = "http://localhost:8776/v2/project_id"
|
@mock.patch('nova.volume.cinder.cinder_client.get_volume_api_from_url',
|
||||||
|
return_value='2')
|
||||||
|
def test_cinderclient_unsupported_v2(self, get_api_version):
|
||||||
|
"""Tests that we fail if trying to use Cinder v2."""
|
||||||
|
self.flags(catalog_info='volumev2:cinderv2:publicURL', group='cinder')
|
||||||
|
# setup mocks
|
||||||
|
get_endpoint = mock.Mock(
|
||||||
|
return_value='http://localhost:8776/v2/%(project_id)s')
|
||||||
|
fake_session = mock.Mock(get_endpoint=get_endpoint)
|
||||||
|
ctxt = context.get_admin_context()
|
||||||
|
with mock.patch.object(cinder, '_SESSION', fake_session):
|
||||||
|
self.assertRaises(exception.UnsupportedCinderAPIVersion,
|
||||||
|
cinder.cinderclient, ctxt)
|
||||||
|
get_api_version.assert_called_once_with(get_endpoint.return_value)
|
||||||
|
|
||||||
|
|
||||||
|
class CinderV3TestCase(BaseCinderTestCase, test.NoDBTestCase):
|
||||||
|
"""Test case for cinder volume v3 api."""
|
||||||
|
|
||||||
|
URL = "http://localhost:8776/v3/project_id"
|
||||||
|
|
||||||
CATALOG = [{
|
CATALOG = [{
|
||||||
"type": "volumev2",
|
"type": "volumev3",
|
||||||
"name": "cinder",
|
"name": "cinderv3",
|
||||||
"endpoints": [{"publicURL": URL}]
|
"endpoints": [{"publicURL": URL}]
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CinderV2TestCase, self).setUp()
|
super(CinderV3TestCase, self).setUp()
|
||||||
CONF.set_override('catalog_info',
|
|
||||||
'volumev2:cinder:publicURL', group='cinder')
|
|
||||||
self.addCleanup(CONF.reset)
|
self.addCleanup(CONF.reset)
|
||||||
|
|
||||||
def create_client(self):
|
def create_client(self):
|
||||||
c = super(CinderV2TestCase, self).create_client()
|
c = super(CinderV3TestCase, self).create_client()
|
||||||
self.assertIsInstance(c, cinder_client_v2.Client)
|
self.assertIsInstance(c, cinder_client_v3.Client)
|
||||||
|
self.assertEqual('3.0', c.api_version.get_string())
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def stub_volume(self, **kwargs):
|
def stub_volume(self, **kwargs):
|
||||||
@ -176,9 +195,9 @@ class CinderV2TestCase(BaseCinderTestCase, test.NoDBTestCase):
|
|||||||
return volume
|
return volume
|
||||||
|
|
||||||
def test_cinder_endpoint_template(self):
|
def test_cinder_endpoint_template(self):
|
||||||
endpoint = 'http://other_host:8776/v2/%(project_id)s'
|
endpoint = 'http://other_host:8776/v3/%(project_id)s'
|
||||||
self.flags(endpoint_template=endpoint, group='cinder')
|
self.flags(endpoint_template=endpoint, group='cinder')
|
||||||
self.assertEqual('http://other_host:8776/v2/project_id',
|
self.assertEqual('http://other_host:8776/v3/project_id',
|
||||||
self.create_client().client.endpoint_override)
|
self.create_client().client.endpoint_override)
|
||||||
|
|
||||||
def test_get_non_existing_volume(self):
|
def test_get_non_existing_volume(self):
|
||||||
|
@ -840,17 +840,6 @@ class CinderClientTestCase(test.NoDBTestCase):
|
|||||||
get_volume_api.assert_called_once_with(
|
get_volume_api.assert_called_once_with(
|
||||||
self.mock_session.get_endpoint.return_value)
|
self.mock_session.get_endpoint.return_value)
|
||||||
|
|
||||||
@mock.patch('cinderclient.client.get_volume_api_from_url',
|
|
||||||
return_value='2')
|
|
||||||
def test_create_v2_client_with_microversion_fails(self, get_volume_api):
|
|
||||||
"""Tests that requesting a microversion against a v2 client will raise
|
|
||||||
an exception.
|
|
||||||
"""
|
|
||||||
self.assertRaises(exception.CinderAPIVersionNotAvailable,
|
|
||||||
cinder.cinderclient, self.ctxt, microversion='3.44')
|
|
||||||
get_volume_api.assert_called_once_with(
|
|
||||||
self.mock_session.get_endpoint.return_value)
|
|
||||||
|
|
||||||
@mock.patch('cinderclient.client.get_volume_api_from_url',
|
@mock.patch('cinderclient.client.get_volume_api_from_url',
|
||||||
return_value='3')
|
return_value='3')
|
||||||
@mock.patch('cinderclient.client.get_highest_client_server_version',
|
@mock.patch('cinderclient.client.get_highest_client_server_version',
|
||||||
|
@ -120,25 +120,17 @@ def cinderclient(context, microversion=None, skip_version_check=False):
|
|||||||
# values.
|
# values.
|
||||||
version = cinder_client.get_volume_api_from_url(url)
|
version = cinder_client.get_volume_api_from_url(url)
|
||||||
|
|
||||||
if version == '1':
|
if version != '3':
|
||||||
raise exception.UnsupportedCinderAPIVersion(version=version)
|
raise exception.UnsupportedCinderAPIVersion(version=version)
|
||||||
|
|
||||||
if version == '2':
|
version = '3.0'
|
||||||
if microversion is not None:
|
# Check to see a specific microversion is requested and if so, can it
|
||||||
# The Cinder v2 API does not support microversions.
|
# be handled by the backing server.
|
||||||
raise exception.CinderAPIVersionNotAvailable(version=microversion)
|
if microversion is not None:
|
||||||
LOG.warning("The support for the Cinder API v2 is deprecated, please "
|
if skip_version_check:
|
||||||
"upgrade to Cinder API v3.")
|
version = microversion
|
||||||
|
else:
|
||||||
if version == '3':
|
version = _check_microversion(url, microversion)
|
||||||
version = '3.0'
|
|
||||||
# Check to see a specific microversion is requested and if so, can it
|
|
||||||
# be handled by the backing server.
|
|
||||||
if microversion is not None:
|
|
||||||
if skip_version_check:
|
|
||||||
version = microversion
|
|
||||||
else:
|
|
||||||
version = _check_microversion(url, microversion)
|
|
||||||
|
|
||||||
return cinder_client.Client(version,
|
return cinder_client.Client(version,
|
||||||
session=_SESSION,
|
session=_SESSION,
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Nova no longer supports the Block Storage (Cinder) v2 API. Ensure the
|
||||||
|
following configuration options are set properly for Cinder v3:
|
||||||
|
|
||||||
|
- ``[cinder]/catalog_info`` - Already defaults to Cinder v3
|
||||||
|
- ``[cinder]/endpoint_template`` - Not used by default.
|
Loading…
Reference in New Issue
Block a user