Merge "PowerMax Driver - Allowing for default volume type in group" into stable/train

This commit is contained in:
Zuul 2020-04-23 04:49:10 +00:00 committed by Gerrit Code Review
commit 8e1445d659
6 changed files with 64 additions and 25 deletions

View File

@ -3126,3 +3126,17 @@ class PowerMaxCommonTest(test.TestCase):
exception.VolumeBackendAPIException,
self.common.update_metadata, model_update, existing_metadata,
object_metadata)
@mock.patch.object(utils.PowerMaxUtils, 'get_volume_group_utils',
return_value=(None, {'interval': 1, 'retries': 1}))
def test_get_volume_group_info(self, mock_group_utils):
self.common.interval = 1
self.common.retries = 1
with mock.patch.object(
self.common, '_get_configuration_value') as mock_array:
self.common._get_volume_group_info(
self.data.test_group_1)
mock_group_utils.assert_called_once_with(
self.data.test_group_1, self.common.interval,
self.common.retries)
mock_array.assert_called_once()

View File

@ -4263,8 +4263,7 @@ class PowerMaxCommon(object):
vol_grp_name = self.utils.update_volume_group_name(group)
try:
array, interval_retries_dict = self.utils.get_volume_group_utils(
group, self.interval, self.retries)
array, interval_retries_dict = self._get_volume_group_info(group)
self.provision.create_volume_group(
array, vol_grp_name, interval_retries_dict)
if group.is_replicated:
@ -4313,8 +4312,7 @@ class PowerMaxCommon(object):
:returns: model_update, volumes_model_update
"""
volumes_model_update = []
array, interval_retries_dict = self.utils.get_volume_group_utils(
group, self.interval, self.retries)
array, interval_retries_dict = self._get_volume_group_info(group)
vol_grp_name = None
volume_group = self._find_volume_group(
@ -4521,8 +4519,8 @@ class PowerMaxCommon(object):
:param source_group: the group object
:param snap_name: the name of the snapshot
"""
array, interval_retries_dict = self.utils.get_volume_group_utils(
source_group, self.interval, self.retries)
array, interval_retries_dict = self._get_volume_group_info(
source_group)
vol_grp_name = None
volume_group = (
self._find_volume_group(array, source_group))
@ -4574,8 +4572,8 @@ class PowerMaxCommon(object):
vol_grp_name = None
try:
# Get the array serial
array, extra_specs = self.utils.get_volume_group_utils(
source_group, self.interval, self.retries)
array, extra_specs = self._get_volume_group_info(
source_group)
# Get the volume group dict for getting the group name
volume_group = (self._find_volume_group(array, source_group))
if volume_group and volume_group.get('name'):
@ -4664,8 +4662,7 @@ class PowerMaxCommon(object):
and not group.is_replicated):
raise NotImplementedError()
array, interval_retries_dict = self.utils.get_volume_group_utils(
group, self.interval, self.retries)
array, interval_retries_dict = self._get_volume_group_info(group)
model_update = {'status': fields.GroupStatus.AVAILABLE}
add_vols = [vol for vol in add_volumes] if add_volumes else []
add_device_ids = self._get_volume_device_ids(add_vols, array)
@ -4793,8 +4790,7 @@ class PowerMaxCommon(object):
tgt_name = self.utils.update_volume_group_name(group)
rollback_dict = {}
array, interval_retries_dict = self.utils.get_volume_group_utils(
group, self.interval, self.retries)
array, interval_retries_dict = self._get_volume_group_info(group)
source_sg = self._find_volume_group(array, actual_source_grp)
if source_sg is not None:
src_grp_name = (source_sg['name']
@ -5283,6 +5279,27 @@ class PowerMaxCommon(object):
return_value = self.configuration.safe_get(second_key)
return return_value
def _get_volume_group_info(self, group):
"""Get the volume group array, retries and intervals
:param group: the group object
:returns: array -- str
interval_retries_dict -- dict
"""
array, interval_retries_dict = self.utils.get_volume_group_utils(
group, self.interval, self.retries)
if not array:
array = self._get_configuration_value(
utils.VMAX_ARRAY, utils.POWERMAX_ARRAY)
if not array:
exception_message = _(
"Cannot get the array serial_number")
LOG.error(exception_message)
raise exception.VolumeBackendAPIException(
message=exception_message)
return array, interval_retries_dict
def _get_unlink_configuration_value(self, first_key, second_key):
"""Get the configuration value of snapvx_unlink_limit

View File

@ -120,9 +120,10 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
4.1.2 - Volume group delete fix (bug #1853589)
4.1.3 - Retype attached replication fix (#1851371)
4.1.4 - Legacy volume not found fix (#1867163)
4.1.5 - Allowing for default volume type in group (#1866871)
"""
VERSION = "4.1.4"
VERSION = "4.1.5"
# ThirdPartySystems wiki
CI_WIKI_NAME = "EMC_VMAX_CI"

View File

@ -125,9 +125,10 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
4.1.2 - Volume group delete fix (bug #1853589)
4.1.3 - Retype attached replication fix (#1851371)
4.1.4 - Legacy volume not found fix (#1867163)
4.1.5 - Allowing for default volume type in group (#1866871)
"""
VERSION = "4.1.4"
VERSION = "4.1.5"
# ThirdPartySystems wiki
CI_WIKI_NAME = "EMC_VMAX_CI"

View File

@ -559,28 +559,28 @@ class PowerMaxUtils(object):
"""
arrays = set()
# Check if it is a generic volume group instance
intervals_retries_dict = {INTERVAL: interval, RETRIES: retries}
if isinstance(group, Group):
for volume_type in group.volume_types:
extra_specs = self.update_extra_specs(volume_type.extra_specs)
arrays.add(extra_specs[ARRAY])
try:
arrays.add(extra_specs[ARRAY])
except KeyError:
return None, intervals_retries_dict
else:
msg = (_("Unable to get volume type ids."))
LOG.error(msg)
raise exception.VolumeBackendAPIException(message=msg)
if len(arrays) != 1:
if not arrays:
msg = (_("Failed to get an array associated with "
"volume group: %(groupid)s.")
% {'groupid': group.id})
else:
msg = (_("There are multiple arrays "
"associated with volume group: %(groupid)s.")
% {'groupid': group.id})
if len(arrays) > 1:
msg = (_("There are multiple arrays "
"associated with volume group: %(groupid)s.")
% {'groupid': group.id})
LOG.error(msg)
raise exception.VolumeBackendAPIException(message=msg)
array = arrays.pop()
intervals_retries_dict = {INTERVAL: interval, RETRIES: retries}
LOG.debug("Serial number %s retrieved from the volume type extra "
"specs.", array)
return array, intervals_retries_dict
def update_volume_group_name(self, group):

View File

@ -0,0 +1,6 @@
---
fixes:
- |
PowerMax Driver - Allowing for default volume type in group operations
where the array serial number is retrieved from the cinder.conf instead
of the pool_name on the extra specs.