VMAX Driver - Place volume in SG as part of unmanage volume

A cinder unmanage operation using the VMAX driver doesn't place
the volume in any storage group on the array. This leads to querying
information about the volume very difficult. The volume being unmanaged
should be placed in some storage group as part of the unmanage
operation

Change-Id: I4fd5370005848205e1bbc9d58d8452f38719dac8
Closes-bug: 1792888
This commit is contained in:
Kumar Prashant 2018-09-18 11:32:57 +05:30 committed by Helen Walsh
parent 70f331228a
commit 2780283903
4 changed files with 37 additions and 0 deletions

View File

@ -4979,6 +4979,15 @@ class VMAXCommonTest(test.TestCase):
self.rest.rename_volume.assert_called_once_with(
self.data.array, self.data.device_id,
self.data.test_volume.id)
# Test for success when create storage group fails
with mock.patch.object(self.rest, 'rename_volume'):
with mock.patch.object(
self.provision, 'create_storage_group',
side_effect=exception.VolumeBackendAPIException):
self.common.unmanage(volume)
self.rest.rename_volume.assert_called_once_with(
self.data.array, self.data.device_id,
self.data.test_volume.id)
def test_unmanage_device_not_found(self):
volume = self.data.test_volume

View File

@ -2163,6 +2163,24 @@ class VMAXCommon(object):
# Rename the volume to volumeId, thus remove the 'OS-' prefix.
self.rest.rename_volume(
extra_specs[utils.ARRAY], device_id, volume_id)
# First check/create the unmanaged sg
# Don't fail if we fail to create the SG
try:
self.provision.create_storage_group(
extra_specs[utils.ARRAY], utils.UNMANAGED_SG,
extra_specs[utils.SRP], None,
None, extra_specs=extra_specs)
except Exception as e:
msg = ("Exception creating %(sg)s. "
"Exception received was %(e)s."
% {'sg': utils.UNMANAGED_SG,
'e': six.text_type(e)})
LOG.warning(msg)
return
# Try to add the volume
self.masking._check_adding_volume_to_storage_group(
extra_specs[utils.ARRAY], device_id, utils.UNMANAGED_SG,
volume_id, extra_specs)
def manage_existing_snapshot(self, snapshot, existing_ref):
"""Manage an existing VMAX Snapshot (import to Cinder).

View File

@ -81,6 +81,9 @@ OTHER_PARENT_SG = 'other_parent_sg_name'
FAST_SG = 'fast_managed_sg'
NO_SLO_SG = 'no_slo_sg'
# SG for unmanaged volumes
UNMANAGED_SG = 'OS-Unmanaged'
# Cinder.conf vmax configuration
VMAX_SERVER_IP = 'san_ip'
VMAX_USER_NAME = 'san_login'

View File

@ -0,0 +1,7 @@
---
other:
- |
This PowerMax driver now puts the unmanaged "orphan" volume in a storage
group called OS-Unmanaged. It is not possible to query a volume's
associated snapvx snapshots using the PowerMax management software, unless
it belongs to a storage group.