Browse Source

Merge "Remove Cinder API v1 compatibility"

tags/14.0.0.0b2^0
Zuul 1 year ago
parent
commit
b118c2f043

+ 0
- 14
openstack_dashboard/api/cinder.py View File

@@ -74,7 +74,6 @@ class BaseCinderAPIResourceWrapper(base.APIResourceWrapper):
74 74
     def name(self):
75 75
         # If a volume doesn't have a name, use its id.
76 76
         return (getattr(self._apiresource, 'name', None) or
77
-                getattr(self._apiresource, 'display_name', None) or
78 77
                 getattr(self._apiresource, 'id', None))
79 78
 
80 79
     @property
@@ -249,15 +248,6 @@ def get_microversion(request, features):
249 248
         'cinder', features, api_versions.APIVersion, min_ver, max_ver))
250 249
 
251 250
 
252
-def _replace_v2_parameters(data):
253
-    if VERSIONS.active < 2:
254
-        data['display_name'] = data['name']
255
-        data['display_description'] = data['description']
256
-        del data['name']
257
-        del data['description']
258
-    return data
259
-
260
-
261 251
 def version_get():
262 252
     api_version = VERSIONS.get_active_version()
263 253
     return api_version['version']
@@ -365,7 +355,6 @@ def volume_create(request, size, name, description, volume_type,
365 355
             'imageRef': image_id,
366 356
             'availability_zone': availability_zone,
367 357
             'source_volid': source_volid}
368
-    data = _replace_v2_parameters(data)
369 358
 
370 359
     volume = cinderclient(request).volumes.create(size, **data)
371 360
     return Volume(volume)
@@ -398,7 +387,6 @@ def volume_set_bootable(request, volume_id, bootable):
398 387
 def volume_update(request, volume_id, name, description):
399 388
     vol_data = {'name': name,
400 389
                 'description': description}
401
-    vol_data = _replace_v2_parameters(vol_data)
402 390
     return cinderclient(request).volumes.update(volume_id,
403 391
                                                 **vol_data)
404 392
 
@@ -493,7 +481,6 @@ def volume_snapshot_create(request, volume_id, name,
493 481
     data = {'name': name,
494 482
             'description': description,
495 483
             'force': force}
496
-    data = _replace_v2_parameters(data)
497 484
 
498 485
     return VolumeSnapshot(cinderclient(request).volume_snapshots.create(
499 486
         volume_id, **data))
@@ -508,7 +495,6 @@ def volume_snapshot_delete(request, snapshot_id):
508 495
 def volume_snapshot_update(request, snapshot_id, name, description):
509 496
     snapshot_data = {'name': name,
510 497
                      'description': description}
511
-    snapshot_data = _replace_v2_parameters(snapshot_data)
512 498
     return cinderclient(request).volume_snapshots.update(snapshot_id,
513 499
                                                          **snapshot_data)
514 500
 

+ 6
- 6
openstack_dashboard/test/test_data/cinder_data.py View File

@@ -87,7 +87,7 @@ def data(TEST):
87 87
         {'id': "11023e92-8008-4c8b-8059-7f2293ff3887",
88 88
          'status': 'available',
89 89
          'size': 40,
90
-         'display_name': 'Volume name',
90
+         'name': 'Volume name',
91 91
          'display_description': 'Volume description',
92 92
          'created_at': '2014-01-27 10:30:00',
93 93
          'volume_type': None,
@@ -97,7 +97,7 @@ def data(TEST):
97 97
         {"id": "4b069dd0-6eaa-4272-8abc-5448a68f1cce",
98 98
          "status": 'available',
99 99
          "size": 10,
100
-         "display_name": '',
100
+         "name": '',
101 101
          "display_description": '',
102 102
          "device": "/dev/hda",
103 103
          "created_at": '2010-11-21 18:34:25',
@@ -108,7 +108,7 @@ def data(TEST):
108 108
         {'id': "21023e92-8008-1234-8059-7f2293ff3889",
109 109
          'status': 'in-use',
110 110
          'size': 10,
111
-         'display_name': u'my_volume',
111
+         'name': u'my_volume',
112 112
          'display_description': '',
113 113
          'created_at': '2013-04-01 10:30:00',
114 114
          'volume_type': None,
@@ -120,7 +120,7 @@ def data(TEST):
120 120
          'name': 'my_volume2',
121 121
          'status': 'in-use',
122 122
          'size': 10,
123
-         'display_name': u'my_volume2',
123
+         'name': u'my_volume2',
124 124
          'display_description': '',
125 125
          'created_at': '2013-04-01 10:30:00',
126 126
          'volume_type': 'vol_type_2',
@@ -131,7 +131,7 @@ def data(TEST):
131 131
         {'id': "21023e92-8008-1234-8059-7f2293ff3890",
132 132
          'status': 'in-use',
133 133
          'size': 10,
134
-         'display_name': u'my_volume',
134
+         'name': u'my_volume',
135 135
          'display_description': '',
136 136
          'created_at': '2013-04-01 10:30:00',
137 137
          'volume_type': None,
@@ -471,7 +471,7 @@ def data(TEST):
471 471
         {'id': "11023e92-8008-4c8b-8059-7f2293ff3881",
472 472
          'status': 'available',
473 473
          'size': 40,
474
-         'display_name': 'Volume name',
474
+         'name': 'Volume name',
475 475
          'display_description': 'Volume description',
476 476
          'created_at': '2014-01-27 10:30:00',
477 477
          'volume_type': 'vol_type_1',

+ 1
- 15
openstack_dashboard/test/unit/api/test_cinder.py View File

@@ -496,7 +496,6 @@ class CinderApiVersionTests(test.TestCase):
496 496
         # Get a v2 volume
497 497
         volume = self.cinder_volumes.get(name="v2_volume")
498 498
         self.assertTrue(hasattr(volume._apiresource, 'name'))
499
-        self.assertFalse(hasattr(volume._apiresource, 'display_name'))
500 499
 
501 500
         name = "A v2 test volume name"
502 501
         description = "A v2 volume description"
@@ -534,17 +533,4 @@ class CinderApiVersionTests(test.TestCase):
534 533
 
535 534
     def test_get_id_for_nameless_volume(self):
536 535
         volume = self.cinder_volumes.first()
537
-        setattr(volume._apiresource, 'display_name', "")
538
-        self.assertEqual(volume.id, volume.name)
539
-
540
-    def test_adapt_dictionary_to_v2(self):
541
-        volume = self.cinder_volumes.first()
542
-        data = {'name': volume.name,
543
-                'description': volume.description,
544
-                'size': volume.size}
545
-
546
-        ret_data = api.cinder._replace_v2_parameters(data)
547
-        self.assertIn('name', ret_data.keys())
548
-        self.assertIn('description', ret_data.keys())
549
-        self.assertNotIn('display_name', ret_data.keys())
550
-        self.assertNotIn('display_description', ret_data.keys())
536
+        self.assertEqual('Volume name', volume.name)

+ 7
- 0
releasenotes/notes/remove-cinder-v1-api-support-7cec9a556945a5c5.yaml View File

@@ -0,0 +1,7 @@
1
+---
2
+upgrade:
3
+  - |
4
+    Remove deprecated Cinder API V1 support. Cinder V1 API was deprecated for
5
+    a while and removed in Queens release. If you need to enable Cinder support
6
+    you should update the `OPENSTACK_API_VERSIONS` configuration option to use
7
+    Cinder V2 or V3 API.

Loading…
Cancel
Save