Browse Source

Merge "NetApp SolidFire: Fix retype to SolidFire" into stable/ussuri

changes/67/737267/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
51ecb0ab6c
3 changed files with 42 additions and 1 deletions
  1. +29
    -0
      cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py
  2. +8
    -1
      cinder/volume/drivers/solidfire.py
  3. +5
    -0
      releasenotes/notes/bug-1859652-netapp-fix-retype-attached-volume-to-solidfire-1933f03673ff078d.yaml

+ 29
- 0
cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py View File

@@ -1342,6 +1342,35 @@ class SolidFireVolumeTestCase(test.TestCase):
self.assertTrue(migrated)
self.assertEqual({}, updates)

@data(None, 'Success', 'Error', f'target:{f_uuid[0]}')
@mock.patch.object(solidfire.SolidFireDriver, '_get_sf_volume')
@mock.patch.object(solidfire.SolidFireDriver, '_get_sfaccount')
def test_attach_volume(self, mig_status, mock_get_sfaccount,
mock_get_sf_volume):
mock_get_sfaccount.return_value = self.fake_sfaccount
i_uuid = 'fake_instance_uuid'
ctx = context.get_admin_context()
type_fields = {}
vol_type = fake_volume.fake_volume_type_obj(ctx, **type_fields)
utc_now = timeutils.utcnow().isoformat()
vol_fields = {
'id': f_uuid[0],
'created_at': utc_now,
'volume_type': vol_type,
'volume_type_id': vol_type.id,
'migration_status': mig_status,
}
vol = fake_volume.fake_volume_obj(ctx, **vol_fields)
sf_vol = self.fake_sfvol
mock_get_sf_volume.return_value = sf_vol

sfv = solidfire.SolidFireDriver(configuration=self.configuration)
sfv.attach_volume(ctx, vol, i_uuid, 'fake_host', '/dev/sdf')
self.assertEqual(sf_vol['attributes']['attached_to'],
i_uuid)
mock_get_sfaccount.assert_called()
mock_get_sf_volume.assert_called()

def test_retype_with_qos_spec(self):
test_type = {'name': 'sf-1',
'qos_specs_id': 'fb0576d7-b4b5-4cad-85dc-ca92e6a497d1',


+ 8
- 1
cinder/volume/drivers/solidfire.py View File

@@ -2086,7 +2086,14 @@ class SolidFireDriver(san.SanISCSIDriver):
sfaccount = self._get_sfaccount(volume['project_id'])
params = {'accountID': sfaccount['accountID']}

sf_vol = self._get_sf_volume(volume['id'], params)
# In a retype of an attached volume scenario, the volume id will be
# as a target on 'migration_status', otherwise it'd be None.
migration_status = volume.get('migration_status')
if migration_status and 'target' in migration_status:
__, vol_id = migration_status.split(':')
else:
vol_id = volume['id']
sf_vol = self._get_sf_volume(vol_id, params)
if sf_vol is None:
LOG.error("Volume ID %s was not found on "
"the SolidFire Cluster while attempting "


+ 5
- 0
releasenotes/notes/bug-1859652-netapp-fix-retype-attached-volume-to-solidfire-1933f03673ff078d.yaml View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed `bug #1859652 <https://bugs.launchpad.net/cinder/+bug/1859652>`_
to allow retyping an attached volume to SolidFire.

Loading…
Cancel
Save