The cinder.volume.drivers.dell_emc.vmax.common Module

class VMAXCommon(prtcl, version, configuration=None, active_backend_id=None)

Bases: object

Common class for SMI-S based EMC volume drivers.

This common class is for EMC volume drivers based on SMI-S. It supports VNX and VMAX arrays.

VERSION = '2.0.0'
add_to_default_SG(conn, volumeInstance, storageSystemName, targetFastPolicyName, volumeName, extraSpecs)

For FAST, add volume to default storage group.

Parameters:
  • conn – connection info to ECOM
  • volumeInstance – the volume instance
  • storageSystemName – the storage system name
  • targetFastPolicyName – the target FAST policy name
  • volumeName – the volume Name
  • extraSpecs – extra specifications
add_volume_to_replication_group(conn, controllerConfigService, volumeInstance, volumeName, extraSpecs)

Add a volume to the default replication group.

SE_ReplicationGroups are actually VMAX storage groups under the covers, so we can use our normal storage group operations. :param conn: the connection to the ecom served :param controllerConfigService: the controller config service :param volumeInstance: the volume instance :param volumeName: the name of the volume :param extraSpecs: extra specifications :return: storageGroupInstanceName

break_rdf_relationship(conn, repServiceInstanceName, syncInstanceName, extraSpecs)
check_ig_instance_name(initiatorGroupInstanceName)

Check if an initiator group instance is on the array.

Parameters:initiatorGroupInstanceName – initiator group instance name
Returns:initiator group name, or None if deleted
cleanup_lun_replication(conn, volume, volumeName, sourceInstance, extraSpecs)

Cleanup target volume on delete.

Extra logic if target is last in group. :param conn: the connection to the ecom server :param volume: the volume object :param volumeName: the volume name :param sourceInstance: the source volume instance :param extraSpecs: extra specification

create_cgsnapshot(context, cgsnapshot, snapshots)

Creates a cgsnapshot.

Parameters:
  • context – the context
  • cgsnapshot – the consistency group snapshot to be created
  • snapshots – snapshots
Returns:

dict – modelUpdate

Returns:

list – list of snapshots

Raises:

VolumeBackendAPIException

create_cloned_volume(cloneVolume, sourceVolume)

Creates a clone of the specified volume.

Parameters:
  • cloneVolume – clone volume Object
  • sourceVolume – volume object
Returns:

model_update, dict

create_consistencygroup(context, group)

Creates a consistency group.

Parameters:
  • context – the context
  • group – the group object to be created
Returns:

dict – modelUpdate = {‘status’: ‘available’}

Raises:

VolumeBackendAPIException

create_consistencygroup_from_src(context, group, volumes, cgsnapshot, snapshots, source_cg, source_vols)

Creates the consistency group from source.

Parameters:
  • context – the context
  • group – the consistency group object to be created
  • volumes – volumes in the consistency group
  • cgsnapshot – the source consistency group snapshot
  • snapshots – snapshots of the source volumes
  • source_cg – the source consistency group
  • source_vols – the source vols
Returns:

model_update, volumes_model_update model_update is a dictionary of cg status volumes_model_update is a list of dictionaries of volume update

create_remote_replica(conn, repServiceInstanceName, rdfGroupInstance, sourceVolume, sourceInstance, targetInstance, extraSpecs, rep_config)

Create a replication relationship with a target volume.

Parameters:
  • conn – the connection to the ecom server
  • repServiceInstanceName – the replication service
  • rdfGroupInstance – the SRDF group instance
  • sourceVolume – the source volume object
  • sourceInstance – the source volume instance
  • targetInstance – the target volume instance
  • extraSpecs – extra specifications
  • rep_config – the replication configuration
Returns:

rc, rdfDict - the target volume dictionary

create_snapshot(snapshot, volume)

Creates a snapshot.

For VMAX, replace snapshot with clone.

Parameters:
  • snapshot – snapshot object
  • volume – volume Object to create snapshot from
Returns:

dict – the cloned volume dictionary

create_volume(volume)

Creates a EMC(VMAX) volume from a pre-existing storage pool.

For a concatenated compositeType: If the volume size is over 240GB then a composite is created EMCNumberOfMembers > 1, otherwise it defaults to a non composite

For a striped compositeType: The user must supply an extra spec to determine how many metas will make up the striped volume. If the meta size is greater than 240GB an error is returned to the user. Otherwise the EMCNumberOfMembers is what the user specifies.

Parameters:volume – volume Object
Returns:model_update, dict
create_volume_from_snapshot(volume, snapshot)

Creates a volume from a snapshot.

For VMAX, replace snapshot with clone.

Parameters:
  • volume – volume Object
  • snapshot – snapshot object
Returns:

model_update, dict

Raises:

VolumeBackendAPIException

delete_cgsnapshot(context, cgsnapshot, snapshots)

Delete a cgsnapshot.

Parameters:
  • context – the context
  • cgsnapshot – the consistency group snapshot to be created
  • snapshots – snapshots
Returns:

dict – modelUpdate

Returns:

list – list of snapshots

Raises:

VolumeBackendAPIException

delete_consistencygroup(context, group, volumes)

Deletes a consistency group.

Parameters:
  • context – the context
  • group – the group object to be deleted
  • volumes – the list of volumes in the consisgroup to be deleted
Returns:

dict – modelUpdate

Returns:

list – list of volume objects

Raises:

VolumeBackendAPIException

delete_snapshot(snapshot, volume)

Deletes a snapshot.

Parameters:
  • snapshot – snapshot object
  • volume – volume Object to create snapshot from
delete_volume(volume)

Deletes a EMC(VMAX) volume.

Parameters:volume – volume Object
extend_volume(volume, newSize)

Extends an existing volume.

Prequisites: 1. The volume must be composite e.g StorageVolume.EMCIsComposite=True 2. The volume can only be concatenated e.g StorageExtent.IsConcatenated=True

Params volume:the volume Object
Params newSize:the new size to increase the volume to
Returns:dict – modifiedVolumeDict - the extended volume Object
Raises:VolumeBackendAPIException
extend_volume_is_replicated(volume, volumeInstance, volumeName, newSize, extraSpecs)

Extend a replication-enabled volume.

Cannot extend volumes in a synchronization pair. Must first break the relationship, extend them separately, then recreate the pair :param volume: the volume objcet :param volumeInstance: the volume instance :param volumeName: the volume name :param newSize: the new size the volume should be :param extraSpecs: extra specifications :return: rc, volumeDict

failover_host(context, volumes, secondary_id=None)

Fails over the volume back and forth.

Driver needs to update following info for failed-over volume: 1. provider_location: update array details 2. replication_status: new status for replication-enabled volume :param context: the context :param volumes: the list of volumes to be failed over :param secondary_id: the target backend :return: secondary_id, volume_update_list

find_device_number(volume, host)

Given the volume dict find a device number.

Find a device number that a host can see for a volume.

Parameters:
  • volume – the volume dict
  • host – host from connector
Returns:

dict – the data dict

get_initiator_group_from_masking_view(maskingViewInstanceName)

Get the initiator group in a masking view.

Parameters:maskingViewInstanceName – masking view instance name
Returns:initiatorGroupInstanceName
get_ip_and_iqn(conn, endpoint, ipendpointinstancename)

Get ip and iqn from the endpoint.

Parameters:
  • conn – ecom connection
  • endpoint – end point
  • ipendpointinstancename – ip endpoint
Returns:

endpoint

get_masking_view_by_volume(volume, connector)

Given volume, retrieve the masking view instance name.

Parameters:
  • volume – the volume
  • connector – the connector object
Returns:

maskingviewInstanceName

get_masking_views_by_initiator_group(initiatorGroupInstanceName)

Given initiator group, retrieve the masking view instance name.

Parameters:initiatorGroupInstanceName – initiator group instance name
Returns:list – maskingViewInstanceNames
get_masking_views_by_port_group(portGroupInstanceName)

Given port group, retrieve the masking view instance name.

Parameters:portGroupInstanceName – port group instance name
Returns:list – maskingViewInstanceNames
get_num_volumes_mapped(volume, connector)

Returns how many volumes are in the same zone as the connector.

Find out how many volumes are mapped to a host associated to the LunMaskingSCSIProtocolController.

Parameters:
  • volume – volume object to be deleted
  • connector – volume object to be deleted
Returns:

int – numVolumesMapped

Raises:

VolumeBackendAPIException

get_port_group_from_masking_view(maskingViewInstanceName)

Get the port groups in a masking view.

Parameters:maskingViewInstanceName – masking view instance name
Returns:portGroupInstanceName
get_rdf_details(conn, storageSystem)

Retrieves an SRDF group instance.

Parameters:
  • conn – connection to the ecom server
  • storageSystem – the storage system name
Returns:

get_secondary_stats_info(rep_config, arrayInfo)

On failover, report on secondary array statistics.

Parameters:
  • rep_config – the replication configuration
  • arrayInfo – the array info
Returns:

secondaryInfo - dict

get_target_instance(sourceVolume, rep_config, rdf_vol_size, targetName, extraSpecs)

Create a replication target for a given source volume.

Parameters:
  • sourceVolume – the source volume
  • rep_config – the replication configuration
  • rdf_vol_size – the size of the volume
  • targetName – the Element Name for the new volume
  • extraSpecs – the extra specifications
Returns:

the target instance

get_target_wwns(storageSystem, connector)

Find target WWNs.

Parameters:
  • storageSystem – the storage system name
  • connector – the connector dict
Returns:

list – targetWwns, the target WWN list

Raises:

VolumeBackendAPIException

get_target_wwns_from_masking_view(storageSystem, volume, connector)

Find target WWNs via the masking view.

Parameters:
  • storageSystem – the storage system name
  • volume – volume to be attached
  • connector – the connector dict
Returns:

list – the target WWN list

initialize_connection(volume, connector)

Initializes the connection and returns device and connection info.

The volume may be already mapped, if this is so the deviceInfo tuple is returned. If the volume is not already mapped then we need to gather information to either 1. Create an new masking view or 2. Add the volume to an existing storage group within an already existing maskingview.

The naming convention is the following:

initiatorGroupName = OS-<shortHostName>-<shortProtocol>-IG
                     e.g OS-myShortHost-I-IG
storageGroupName = OS-<shortHostName>-<poolName>-<shortProtocol>-SG
                   e.g OS-myShortHost-SATA_BRONZ1-I-SG
portGroupName = OS-<target>-PG  The portGroupName will come from
                the EMC configuration xml file.
                These are precreated. If the portGroup does not
                exist then an error will be returned to the user
maskingView  = OS-<shortHostName>-<poolName>-<shortProtocol>-MV
               e.g OS-myShortHost-SATA_BRONZ1-I-MV
Parameters:
  • volume – volume Object
  • connector – the connector Object
Returns:

dict – deviceInfoDict - device information dict

Raises:

VolumeBackendAPIException

manage_existing(volume, external_ref)

Manages an existing VMAX Volume (import to Cinder).

Renames the existing volume to match the expected name for the volume. Also need to consider things like QoS, Emulation, account/tenant.

Parameters:
  • volume – the volume object including the volume_type_id
  • external_ref – reference to the existing volume
Returns:

dict – model_update

Raises:

VolumeBackendAPIException

manage_existing_get_size(volume, external_ref)

Return size of an existing VMAX volume to manage_existing.

Parameters:
  • self – reference to class
  • volume – the volume object including the volume_type_id
  • external_ref – reference to the existing volume
Returns:

size of the volume in GB

migrate_volume(ctxt, volume, host, new_type=None)

Migrate volume to another host.

Parameters:
  • ctxt – context
  • volume – the volume object including the volume_type_id
  • host – the host dict holding the relevant target(destination) information
  • new_type – None
Returns:

boolean – Always returns True

Returns:

dict – Empty dict {}

pool_info = {'arrays_info': {}, 'config_file': None, 'backend_name': None, 'reserved_percentage': None, 'max_over_subscription_ratio': None, 'replication_enabled': False}
recover_volumes_on_failback(volume)

Recover volumes on failback.

On failback, attempt to recover non RE(replication enabled) volumes from primary array.

Parameters:volume
Returns:volume_update
remove_from_default_SG(conn, volumeInstance, storageSystemName, sourceFastPolicyName, volumeName, extraSpecs)

For FAST, remove volume from default storage group.

Parameters:
  • conn – connection info to ECOM
  • volumeInstance – the volume instance
  • storageSystemName – the storage system name
  • sourceFastPolicyName – the source FAST policy name
  • volumeName – the volume Name
  • extraSpecs – extra specifications
Raises:

VolumeBackendAPIException

retype(ctxt, volume, new_type, diff, host)

Migrate volume to another host using retype.

Parameters:
  • ctxt – context
  • volume – the volume object including the volume_type_id
  • new_type – the new volume type.
  • diff – Unused parameter.
  • host – The host dict holding the relevant target(destination) information
Returns:

boolean – True if retype succeeded, False if error

setup_volume_replication(conn, sourceVolume, volumeDict, extraSpecs, targetInstance=None)

Setup replication for volume, if enabled.

Called on create volume, create cloned volume, create volume from snapshot, manage_existing, and re-establishing a replication relationship after extending.

Parameters:
  • conn – the connection to the ecom server
  • sourceVolume – the source volume object
  • volumeDict – the source volume dict (the provider_location)
  • extraSpecs – extra specifications
  • targetInstance – optional, target on secondary array
Returns:

rep_update - dict

stats = {'driver_version': '1.0', 'total_capacity_gb': 0, 'replication_enabled': False, 'replication_targets': None, 'reserved_percentage': 0, 'vendor_name': 'EMC', 'volume_backend_name': None, 'storage_protocol': None, 'free_capacity_gb': 0}
terminate_connection(volume, connector)

Disallow connection from connector.

Params volume:the volume Object
Params connector:
 the connector Object
unmanage(volume)

Export VMAX volume from Cinder.

Leave the volume intact on the backend array.

Parameters:volume – the volume object
Raises:VolumeBackendAPIException
update_consistencygroup(group, add_volumes, remove_volumes)

Updates LUNs in consistency group.

Parameters:
  • group – storage configuration service instance
  • add_volumes – the volumes uuids you want to add to the CG
  • remove_volumes – the volumes uuids you want to remove from the CG
update_volume_stats()

Retrieve stats info.