diff --git a/openstack_dashboard/api/cinder.py b/openstack_dashboard/api/cinder.py index 7cf18ca4e4..4fe9792498 100644 --- a/openstack_dashboard/api/cinder.py +++ b/openstack_dashboard/api/cinder.py @@ -74,7 +74,6 @@ class BaseCinderAPIResourceWrapper(base.APIResourceWrapper): def name(self): # If a volume doesn't have a name, use its id. return (getattr(self._apiresource, 'name', None) or - getattr(self._apiresource, 'display_name', None) or getattr(self._apiresource, 'id', None)) @property @@ -249,15 +248,6 @@ def get_microversion(request, features): 'cinder', features, api_versions.APIVersion, min_ver, max_ver)) -def _replace_v2_parameters(data): - if VERSIONS.active < 2: - data['display_name'] = data['name'] - data['display_description'] = data['description'] - del data['name'] - del data['description'] - return data - - def version_get(): api_version = VERSIONS.get_active_version() return api_version['version'] @@ -365,7 +355,6 @@ def volume_create(request, size, name, description, volume_type, 'imageRef': image_id, 'availability_zone': availability_zone, 'source_volid': source_volid} - data = _replace_v2_parameters(data) volume = cinderclient(request).volumes.create(size, **data) return Volume(volume) @@ -398,7 +387,6 @@ def volume_set_bootable(request, volume_id, bootable): def volume_update(request, volume_id, name, description): vol_data = {'name': name, 'description': description} - vol_data = _replace_v2_parameters(vol_data) return cinderclient(request).volumes.update(volume_id, **vol_data) @@ -493,7 +481,6 @@ def volume_snapshot_create(request, volume_id, name, data = {'name': name, 'description': description, 'force': force} - data = _replace_v2_parameters(data) return VolumeSnapshot(cinderclient(request).volume_snapshots.create( volume_id, **data)) @@ -508,7 +495,6 @@ def volume_snapshot_delete(request, snapshot_id): def volume_snapshot_update(request, snapshot_id, name, description): snapshot_data = {'name': name, 'description': description} - snapshot_data = _replace_v2_parameters(snapshot_data) return cinderclient(request).volume_snapshots.update(snapshot_id, **snapshot_data) diff --git a/openstack_dashboard/test/test_data/cinder_data.py b/openstack_dashboard/test/test_data/cinder_data.py index 0e028dbb28..d6b57d1d16 100644 --- a/openstack_dashboard/test/test_data/cinder_data.py +++ b/openstack_dashboard/test/test_data/cinder_data.py @@ -87,7 +87,7 @@ def data(TEST): {'id': "11023e92-8008-4c8b-8059-7f2293ff3887", 'status': 'available', 'size': 40, - 'display_name': 'Volume name', + 'name': 'Volume name', 'display_description': 'Volume description', 'created_at': '2014-01-27 10:30:00', 'volume_type': None, @@ -97,7 +97,7 @@ def data(TEST): {"id": "4b069dd0-6eaa-4272-8abc-5448a68f1cce", "status": 'available', "size": 10, - "display_name": '', + "name": '', "display_description": '', "device": "/dev/hda", "created_at": '2010-11-21 18:34:25', @@ -108,7 +108,7 @@ def data(TEST): {'id': "21023e92-8008-1234-8059-7f2293ff3889", 'status': 'in-use', 'size': 10, - 'display_name': u'my_volume', + 'name': u'my_volume', 'display_description': '', 'created_at': '2013-04-01 10:30:00', 'volume_type': None, @@ -120,7 +120,7 @@ def data(TEST): 'name': 'my_volume2', 'status': 'in-use', 'size': 10, - 'display_name': u'my_volume2', + 'name': u'my_volume2', 'display_description': '', 'created_at': '2013-04-01 10:30:00', 'volume_type': 'vol_type_2', @@ -131,7 +131,7 @@ def data(TEST): {'id': "21023e92-8008-1234-8059-7f2293ff3890", 'status': 'in-use', 'size': 10, - 'display_name': u'my_volume', + 'name': u'my_volume', 'display_description': '', 'created_at': '2013-04-01 10:30:00', 'volume_type': None, @@ -471,7 +471,7 @@ def data(TEST): {'id': "11023e92-8008-4c8b-8059-7f2293ff3881", 'status': 'available', 'size': 40, - 'display_name': 'Volume name', + 'name': 'Volume name', 'display_description': 'Volume description', 'created_at': '2014-01-27 10:30:00', 'volume_type': 'vol_type_1', diff --git a/openstack_dashboard/test/unit/api/test_cinder.py b/openstack_dashboard/test/unit/api/test_cinder.py index 13762067a3..491bec7c14 100644 --- a/openstack_dashboard/test/unit/api/test_cinder.py +++ b/openstack_dashboard/test/unit/api/test_cinder.py @@ -496,7 +496,6 @@ class CinderApiVersionTests(test.TestCase): # Get a v2 volume volume = self.cinder_volumes.get(name="v2_volume") self.assertTrue(hasattr(volume._apiresource, 'name')) - self.assertFalse(hasattr(volume._apiresource, 'display_name')) name = "A v2 test volume name" description = "A v2 volume description" @@ -534,17 +533,4 @@ class CinderApiVersionTests(test.TestCase): def test_get_id_for_nameless_volume(self): volume = self.cinder_volumes.first() - setattr(volume._apiresource, 'display_name', "") - self.assertEqual(volume.id, volume.name) - - def test_adapt_dictionary_to_v2(self): - volume = self.cinder_volumes.first() - data = {'name': volume.name, - 'description': volume.description, - 'size': volume.size} - - ret_data = api.cinder._replace_v2_parameters(data) - self.assertIn('name', ret_data.keys()) - self.assertIn('description', ret_data.keys()) - self.assertNotIn('display_name', ret_data.keys()) - self.assertNotIn('display_description', ret_data.keys()) + self.assertEqual('Volume name', volume.name) diff --git a/releasenotes/notes/remove-cinder-v1-api-support-7cec9a556945a5c5.yaml b/releasenotes/notes/remove-cinder-v1-api-support-7cec9a556945a5c5.yaml new file mode 100644 index 0000000000..2acd53ff46 --- /dev/null +++ b/releasenotes/notes/remove-cinder-v1-api-support-7cec9a556945a5c5.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + Remove deprecated Cinder API V1 support. Cinder V1 API was deprecated for + a while and removed in Queens release. If you need to enable Cinder support + you should update the `OPENSTACK_API_VERSIONS` configuration option to use + Cinder V2 or V3 API.