Skip to content

Commit 544cfed

Browse files
committed
Remove MIN_COMPUTE_MULTIATTACH conditions in API
nova-compute service version 27 was added in Queens [1] and the API started relying on it in Queens [2] when creating a server with a multi-attach volume. We are long past supporting computes older than Queens so we can drop that minimum service version check code from the server create API flow and related error handling. Note that when attaching a multi-attach volume to a server the version compatibility was handled in the compute RPC API reserve_block_device_name method, but that code was removed in Rocky [3]. However, the volume attach API still has to handle the MultiattachSupportNotYetAvailable exception if using cells v1 because it is raised from ComputeCellsAPI._attach_volume. [1] Ieec2bbd8a23c861c89bf9922517fa6a5562f1937 [2] I02120ef8767c3f9c9497bff67101e57e204ed6f4 [3] Ibcb6bf912b3fb69c8631665fef2832906ba338aa Change-Id: I7700f66fd590b617333ae99c1b42986278b36263
1 parent 2e5d0ed commit 544cfed

File tree

4 files changed

+2
-39
lines changed

4 files changed

+2
-39
lines changed

nova/api/openstack/compute/servers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ def create(self, req, body):
750750
exception.InstanceExists,
751751
exception.NetworkAmbiguous,
752752
exception.NoUniqueMatch,
753-
exception.MultiattachSupportNotYetAvailable,
754753
exception.VolumeTypeSupportNotYetAvailable,
755754
exception.CertificateValidationNotYetAvailable) as error:
756755
raise exc.HTTPConflict(explanation=error.format_message())

nova/compute/api.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
AGGREGATE_ACTION_DELETE = 'Delete'
106106
AGGREGATE_ACTION_ADD = 'Add'
107107
CINDER_V3_ATTACH_MIN_COMPUTE_VERSION = 24
108-
MIN_COMPUTE_MULTIATTACH = 27
109108
MIN_COMPUTE_TRUSTED_CERTS = 31
110109
MIN_COMPUTE_ABORT_QUEUED_LIVE_MIGRATION = 34
111110
MIN_COMPUTE_VOLUME_TYPE = 36
@@ -1564,8 +1563,7 @@ def _validate_bdm(self, context, instance, instance_type,
15641563
bdm.attachment_id = None
15651564
except (exception.CinderConnectionFailed,
15661565
exception.InvalidVolume,
1567-
exception.MultiattachNotSupportedOldMicroversion,
1568-
exception.MultiattachSupportNotYetAvailable):
1566+
exception.MultiattachNotSupportedOldMicroversion):
15691567
raise
15701568
except exception.InvalidInput as exc:
15711569
raise exception.InvalidVolume(reason=exc.format_message())
@@ -4122,11 +4120,6 @@ def _check_attach_and_reserve_volume(self, context, volume, instance,
41224120
min_compute_version = \
41234121
objects.service.get_minimum_version_all_cells(
41244122
context, ['nova-compute'])
4125-
# Check to see if the computes have been upgraded to support
4126-
# booting from a multiattach volume.
4127-
if (volume['multiattach'] and
4128-
min_compute_version < MIN_COMPUTE_MULTIATTACH):
4129-
raise exception.MultiattachSupportNotYetAvailable()
41304123

41314124
if min_compute_version >= CINDER_V3_ATTACH_MIN_COMPUTE_VERSION:
41324125
# Attempt a new style volume attachment, but fallback to old-style

nova/tests/unit/api/openstack/compute/test_serversV21.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6418,17 +6418,6 @@ def test_create_server_with_multiattach_fails_old_microversion(self):
64186418
self.assertIn('Multiattach volumes are only supported starting with '
64196419
'compute API version 2.60', six.text_type(ex))
64206420

6421-
@mock.patch('nova.objects.service.get_minimum_version_all_cells',
6422-
return_value=compute_api.MIN_COMPUTE_MULTIATTACH - 1)
6423-
def test_create_server_with_multiattach_fails_not_available(
6424-
self, mock_get_min_version_all_cells):
6425-
"""Tests the case that the user tries to boot from volume with a
6426-
multiattach volume but before the deployment is fully upgraded.
6427-
"""
6428-
ex = self.assertRaises(webob.exc.HTTPConflict, self._post_server)
6429-
self.assertIn('Multiattach volume support is not yet available',
6430-
six.text_type(ex))
6431-
64326421

64336422
class ServersControllerCreateTestV263(ServersControllerCreateTest):
64346423
def _create_instance_req(self, certs=None):

nova/tests/unit/compute/test_compute_api.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6618,26 +6618,8 @@ def test_check_attach_and_reserve_volume_multiattach_old_version(self):
66186618
self.context, volume, instance, bdm,
66196619
supports_multiattach=False)
66206620

6621-
@mock.patch('nova.objects.service.get_minimum_version_all_cells',
6622-
return_value=compute_api.MIN_COMPUTE_MULTIATTACH - 1)
6623-
def test_check_attach_and_reserve_volume_multiattach_new_inst_old_compute(
6624-
self, get_min_version):
6625-
"""Tests that _check_attach_and_reserve_volume fails if trying
6626-
to use a multiattach volume to create a new instance but the computes
6627-
are not all upgraded yet.
6628-
"""
6629-
instance = self._create_instance_obj()
6630-
delattr(instance, 'id')
6631-
volume = {'id': uuids.volumeid, 'multiattach': True}
6632-
bdm = objects.BlockDeviceMapping(volume_id=uuids.volumeid,
6633-
instance_uuid=instance.uuid)
6634-
self.assertRaises(exception.MultiattachSupportNotYetAvailable,
6635-
self.compute_api._check_attach_and_reserve_volume,
6636-
self.context, volume, instance, bdm,
6637-
supports_multiattach=True)
6638-
66396621
@mock.patch('nova.objects.Service.get_minimum_version',
6640-
return_value=compute_api.MIN_COMPUTE_MULTIATTACH)
6622+
return_value=compute_api.CINDER_V3_ATTACH_MIN_COMPUTE_VERSION)
66416623
@mock.patch('nova.volume.cinder.API.get',
66426624
return_value={'id': uuids.volumeid, 'multiattach': True})
66436625
@mock.patch('nova.volume.cinder.is_microversion_supported',

0 commit comments

Comments
 (0)