"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cinder/volume/drivers/dell_emc/powermax/common.py" between
cinder-15.0.1.tar.gz and cinder-15.1.0.tar.gz

About: OpenStack Cinder (Core Service: Block Storage) provides persistent block storage to running instances. Its pluggable driver architecture facilitates the creation and management of block storage devices.
The "Train" series (latest release).

common.py  (cinder-15.0.1):common.py  (cinder-15.1.0)
skipping to change at line 3182 skipping to change at line 3182
model_update = { model_update = {
'replication_status': rep_status, 'replication_status': rep_status,
'replication_driver_data': six.text_type(rep_driver_data)} 'replication_driver_data': six.text_type(rep_driver_data)}
# Retype the device on the source array # Retype the device on the source array
success, target_sg_name = self._retype_inuse_volume( success, target_sg_name = self._retype_inuse_volume(
array, srp, volume, device_id, extra_specs, array, srp, volume, device_id, extra_specs,
target_slo, target_workload, target_extra_specs, target_slo, target_workload, target_extra_specs,
is_compression_disabled) is_compression_disabled)
# Ensure that storage groups for metro volumes stay consistent
if not was_rep_enabled and is_rep_enabled and (
self.rep_config['mode'] is utils.REP_METRO):
async_sg = self.utils.get_async_rdf_managed_grp_name(
self.rep_config)
sg_exists = self.rest.get_storage_group(array, async_sg)
if not sg_exists:
self.rest.create_storage_group(
array, async_sg, extra_specs['srp'],
extra_specs['slo'], extra_specs['workload'],
extra_specs)
self.masking.add_volume_to_storage_group(
array, device_id, async_sg, volume_name, extra_specs,
True)
# If the volume was replication enabled both before and after # If the volume was replication enabled both before and after
# retype, the volume needs to be retyped on the remote array also # retype, the volume needs to be retyped on the remote array also
if was_rep_enabled and is_rep_enabled: if was_rep_enabled and is_rep_enabled:
success = self._retype_remote_volume( success = self._retype_remote_volume(
array, volume, device_id, volume_name, array, volume, device_id, volume_name,
rep_mode, is_rep_enabled, target_extra_specs) rep_mode, is_rep_enabled, target_extra_specs)
# Volume is not attached, retype as normal # Volume is not attached, retype as normal
else: else:
if was_rep_enabled: if was_rep_enabled:
skipping to change at line 3334 skipping to change at line 3349
"There was an issue retrieving attached host from volume " "There was an issue retrieving attached host from volume "
"%(volume_name)s, aborting storage-assisted migration.", "%(volume_name)s, aborting storage-assisted migration.",
{'volume_name': device_id}) {'volume_name': device_id})
return False, None return False, None
target_sg_name, __, __, __ = self.utils.get_child_sg_name( target_sg_name, __, __, __ = self.utils.get_child_sg_name(
attached_host, target_extra_specs) attached_host, target_extra_specs)
target_sg = self.rest.get_storage_group(array, target_sg_name) target_sg = self.rest.get_storage_group(array, target_sg_name)
if not target_sg: if not target_sg:
self.provision.create_storage_group(array, target_sg_name, srp, target_sg = self.provision.create_storage_group(
target_slo, array, target_sg_name, srp, target_slo, target_workload,
target_workload, target_extra_specs, is_compression_disabled)
target_extra_specs, parent_sg = source_sg.get('parent_storage_group')
is_compression_disabled) if parent_sg:
parent_sg = source_sg['parent_storage_group'][0] parent_sg = parent_sg[0]
self.masking.add_child_sg_to_parent_sg( self.masking.add_child_sg_to_parent_sg(
array, target_sg_name, parent_sg, target_extra_specs) array, target_sg_name, parent_sg, target_extra_specs)
target_sg = self.rest.get_storage_group(array, target_sg_name)
target_in_parent = self.rest.is_child_sg_in_parent_sg(
array, target_sg_name, target_sg['parent_storage_group'][0])
if target_sg and target_in_parent: if target_sg:
self.masking.move_volume_between_storage_groups( self.masking.move_volume_between_storage_groups(
array, device_id, source_sg_name, target_sg_name, array, device_id, source_sg_name, target_sg_name,
target_extra_specs) target_extra_specs)
success = self.rest.is_volume_in_storagegroup( success = self.rest.is_volume_in_storagegroup(
array, device_id, target_sg_name) array, device_id, target_sg_name)
if not success: if not success:
LOG.error( LOG.error(
"Volume: %(volume_name)s has not been " "Volume: %(volume_name)s has not been "
"added to target storage group %(storageGroup)s.", "added to target storage group %(storageGroup)s.",
skipping to change at line 3588 skipping to change at line 3599
:param extra_specs: the extra specifications :param extra_specs: the extra specifications
:return: replication_status -- str, replication_driver_data -- dict :return: replication_status -- str, replication_driver_data -- dict
rep_info_dict -- dict rep_info_dict -- dict
""" """
source_name = volume.name source_name = volume.name
LOG.debug('Starting replication setup ' LOG.debug('Starting replication setup '
'for volume: %s.', source_name) 'for volume: %s.', source_name)
rdf_group_no, remote_array = self.get_rdf_details(array) rdf_group_no, remote_array = self.get_rdf_details(array)
extra_specs['replication_enabled'] = '<is> True' extra_specs['replication_enabled'] = '<is> True'
extra_specs['rep_mode'] = self.rep_config['mode'] extra_specs['rep_mode'] = self.rep_config['mode']
group_details = self.rest.get_rdf_group(array, rdf_group_no)
volumes_in_group = group_details['numDevices']
async_sg = self.utils.get_async_rdf_managed_grp_name(self.rep_config)
rdf_vol_size = volume.size rdf_vol_size = volume.size
if rdf_vol_size == 0: if rdf_vol_size == 0:
rdf_vol_size = self.rest.get_size_of_device_on_array( rdf_vol_size = self.rest.get_size_of_device_on_array(
array, device_id) array, device_id)
target_name = self.utils.get_volume_element_name(volume.id) target_name = self.utils.get_volume_element_name(volume.id)
rep_extra_specs = self._get_replication_extra_specs( rep_extra_specs = self._get_replication_extra_specs(
extra_specs, self.rep_config) extra_specs, self.rep_config)
volume_dict = self._create_volume( rep_mode = self.rep_config['mode']
target_name, rdf_vol_size, rep_extra_specs, in_use=True)
if (volumes_in_group > 0) and (rep_mode is utils.REP_METRO or
rep_mode is utils.REP_ASYNC):
volume_dict = self._create_volume(
target_name, rdf_vol_size, rep_extra_specs)
sg_exists = self.rest.get_storage_group(remote_array, async_sg)
if not sg_exists:
self.rest.create_storage_group(
remote_array, async_sg, extra_specs['srp'],
extra_specs['slo'], extra_specs['workload'],
rep_extra_specs)
self.masking.add_volume_to_storage_group(
remote_array, volume_dict['device_id'], async_sg,
target_name, rep_extra_specs, True)
else:
volume_dict = self._create_volume(
target_name, rdf_vol_size, rep_extra_specs, in_use=True)
target_device_id = volume_dict['device_id'] target_device_id = volume_dict['device_id']
LOG.debug("Create volume replica: Target device: %(target)s " LOG.debug("Create volume replica: Target device: %(target)s "
"Source Device: %(source)s " "Source Device: %(source)s "
"Volume identifier: %(name)s.", "Volume identifier: %(name)s.",
{'target': target_device_id, {'target': target_device_id,
'source': device_id, 'source': device_id,
'name': target_name}) 'name': target_name})
self._sync_check(array, device_id, extra_specs, tgt_only=True) self._sync_check(array, device_id, extra_specs, tgt_only=True)
skipping to change at line 4458 skipping to change at line 4488
% {'volGrpName': grp_id, % {'volGrpName': grp_id,
'e': six.text_type(e)}) 'e': six.text_type(e)})
LOG.error(exception_message) LOG.error(exception_message)
raise exception.VolumeBackendAPIException( raise exception.VolumeBackendAPIException(
message=exception_message) message=exception_message)
for snapshot in snapshots: for snapshot in snapshots:
src_dev_id = self._get_src_device_id_for_group_snap(snapshot) src_dev_id = self._get_src_device_id_for_group_snap(snapshot)
extra_specs = self._initial_setup(snapshot.volume) extra_specs = self._initial_setup(snapshot.volume)
array = extra_specs['array'] array = extra_specs['array']
snapshot_model_dict = {
'id': snapshot.id,
'provider_location': six.text_type(
{'source_id': src_dev_id, 'snap_name': snap_name}),
'status': fields.SnapshotStatus.AVAILABLE}
snapshots_model_update.append( snapshot_model_dict = self.update_metadata(
{'id': snapshot.id, snapshot_model_dict, snapshot.metadata,
'provider_location': six.text_type(
{'source_id': src_dev_id, 'snap_name': snap_name}),
'status': fields.SnapshotStatus.AVAILABLE})
snapshots_model_update = self.update_metadata(
snapshots_model_update, snapshot.metadata,
self.get_snapshot_metadata( self.get_snapshot_metadata(
array, src_dev_id, snap_name)) array, src_dev_id, snap_name))
snapshots_model_update.append(snapshot_model_dict)
model_update = {'status': fields.GroupStatus.AVAILABLE} model_update = {'status': fields.GroupStatus.AVAILABLE}
return model_update, snapshots_model_update return model_update, snapshots_model_update
def _get_src_device_id_for_group_snap(self, snapshot): def _get_src_device_id_for_group_snap(self, snapshot):
"""Get the source device id for the provider_location. """Get the source device id for the provider_location.
:param snapshot: the snapshot object :param snapshot: the snapshot object
:return: src_device_id :return: src_device_id
""" """
skipping to change at line 4555 skipping to change at line 4586
# Get the volume group dict for getting the group name # Get the volume group dict for getting the group name
volume_group = (self._find_volume_group(array, source_group)) volume_group = (self._find_volume_group(array, source_group))
if volume_group and volume_group.get('name'): if volume_group and volume_group.get('name'):
vol_grp_name = volume_group['name'] vol_grp_name = volume_group['name']
if vol_grp_name is None: if vol_grp_name is None:
exception_message = ( exception_message = (
_("Cannot find generic volume group %(grp_id)s.") % _("Cannot find generic volume group %(grp_id)s.") %
{'group_id': source_group.id}) {'group_id': source_group.id})
raise exception.VolumeBackendAPIException( raise exception.VolumeBackendAPIException(
message=exception_message) message=exception_message)
# Check if the snapshot exists
if 'snapVXSnapshots' in volume_group: self.provision.delete_group_replica(
if snap_name in volume_group['snapVXSnapshots']: array, snap_name, vol_grp_name)
src_devs = self._get_snap_src_dev_list(array, snapshots)
self.provision.delete_group_replica(
array, snap_name, vol_grp_name, src_devs, extra_specs)
else:
# Snapshot has been already deleted, return successfully
LOG.error("Cannot find group snapshot %(snapId)s.",
{'snapId': group_snapshot.id})
model_update = {'status': fields.GroupSnapshotStatus.DELETED} model_update = {'status': fields.GroupSnapshotStatus.DELETED}
for snapshot in snapshots: for snapshot in snapshots:
snapshots_model_update.append( snapshots_model_update.append(
{'id': snapshot.id, {'id': snapshot.id,
'status': fields.SnapshotStatus.DELETED}) 'status': fields.SnapshotStatus.DELETED})
except Exception as e: except Exception as e:
LOG.error("Error deleting volume group snapshot." LOG.error("Error deleting volume group snapshot."
"Error received: %(e)s", {'e': e}) "Error received: %(e)s", {'e': e})
model_update = { model_update = {
'status': fields.GroupSnapshotStatus.ERROR_DELETING} 'status': fields.GroupSnapshotStatus.ERROR_DELETING}
skipping to change at line 4945 skipping to change at line 4970
def _rollback_create_group_from_src(self, array, rollback_dict): def _rollback_create_group_from_src(self, array, rollback_dict):
"""Performs rollback for create group from src in case of failure. """Performs rollback for create group from src in case of failure.
:param array: the array serial number :param array: the array serial number
:param rollback_dict: dict containing rollback details :param rollback_dict: dict containing rollback details
""" """
try: try:
# Delete the snapshot if required # Delete the snapshot if required
if rollback_dict.get("snap_name"): if rollback_dict.get("snap_name"):
try: try:
src_dev_ids = [
a for a, b in rollback_dict['list_volume_pairs']]
self.provision.delete_group_replica( self.provision.delete_group_replica(
array, rollback_dict["snap_name"], array, rollback_dict["snap_name"],
rollback_dict["source_group_name"], rollback_dict["source_group_name"])
src_dev_ids, rollback_dict['interval_retries_dict'])
except Exception as e: except Exception as e:
LOG.debug("Failed to delete group snapshot. Attempting " LOG.debug("Failed to delete group snapshot. Attempting "
"further rollback. Exception received: %(e)s.", "further rollback. Exception received: %(e)s.",
{'e': e}) {'e': e})
if rollback_dict.get('volumes'): if rollback_dict.get('volumes'):
# Remove any devices which were added to the target SG # Remove any devices which were added to the target SG
if rollback_dict['device_ids']: if rollback_dict['device_ids']:
self.masking.remove_volumes_from_storage_group( self.masking.remove_volumes_from_storage_group(
array, rollback_dict['device_ids'], array, rollback_dict['device_ids'],
rollback_dict['target_group_name'], rollback_dict['target_group_name'],
skipping to change at line 5341 skipping to change at line 5363
LOG.info("Reverted the volume to snapshot successfully") LOG.info("Reverted the volume to snapshot successfully")
except Exception as e: except Exception as e:
exception_message = (_( exception_message = (_(
"Failed to revert the volume to the snapshot. " "Failed to revert the volume to the snapshot. "
"Exception received was %(e)s") % {'e': six.text_type(e)}) "Exception received was %(e)s") % {'e': six.text_type(e)})
LOG.error(exception_message) LOG.error(exception_message)
raise exception.VolumeBackendAPIException( raise exception.VolumeBackendAPIException(
message=exception_message) message=exception_message)
def update_metadata( def update_metadata(
self, model_update, existing_metadata, object_metadata): self, model_update, existing_metadata, new_metadata):
"""Update volume metadata in model_update. """Update volume metadata in model_update.
:param model_update: existing model :param model_update: existing model
:param existing_metadata: existing metadata :param existing_metadata: existing metadata
:param object_metadata: object metadata :param new_metadata: new object metadata
:returns: dict -- updated model :returns: dict -- updated model
""" """
if new_metadata:
self._is_dict(new_metadata, 'new object metadata')
if model_update: if model_update:
self._is_dict(model_update, 'existing model')
if 'metadata' in model_update: if 'metadata' in model_update:
model_update['metadata'].update(object_metadata) model_update['metadata'].update(new_metadata)
else: else:
model_update.update({'metadata': object_metadata}) model_update.update({'metadata': new_metadata})
else: else:
model_update = {} model_update = {}
model_update.update({'metadata': object_metadata}) model_update.update({'metadata': new_metadata})
if existing_metadata: if existing_metadata:
self._is_dict(existing_metadata, 'existing metadata')
model_update['metadata'].update(existing_metadata) model_update['metadata'].update(existing_metadata)
return model_update return model_update
def _is_dict(self, input, description):
"""Check that the input is a dict
:param input: object for checking
:raises: VolumeBackendAPIException
"""
if not isinstance(input, dict):
exception_message = (_(
"Input %(desc)s is not a dict.") % {'desc': description})
LOG.error(exception_message)
raise exception.VolumeBackendAPIException(
message=exception_message)
def get_volume_metadata(self, array, device_id): def get_volume_metadata(self, array, device_id):
"""Get volume metadata for model_update. """Get volume metadata for model_update.
:param array: the array ID :param array: the array ID
:param device_id: the device ID :param device_id: the device ID
:returns: dict -- volume metadata :returns: dict -- volume metadata
""" """
vol_info = self.rest._get_private_volume(array, device_id) vol_info = self.rest._get_private_volume(array, device_id)
vol_header = vol_info['volumeHeader'] vol_header = vol_info['volumeHeader']
array_model, __ = self.rest.get_array_model_info(array) array_model, __ = self.rest.get_array_model_info(array)
 End of changes. 20 change blocks. 
41 lines changed or deleted 81 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)