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

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

class VMAXUtils

Bases: object

Utility class for Rest based VMAX volume drivers.

This Utility class is for VMAX volume drivers based on Unisphere Rest API.

static add_legacy_pools(pools)

Add legacy pools to allow extending a volume after upgrade.

Parameters:pools – the pool list
Returns:pools - the updated pool list
change_compression_type(is_source_compr_disabled, new_type)

Check if volume type have different compression types

Parameters:
  • is_source_compr_disabled – from source
  • new_type – from target
Returns:

boolean

static check_rep_status_enabled(group)

Check replication status for group.

Group status must be enabled before proceeding with certain operations.

Parameters:group – the group object
Raises:InvalidInput
check_replication_matched(volume, extra_specs)

Check volume type and group type.

This will make sure they do not conflict with each other.

Parameters:
  • volume – volume to be checked
  • extra_specs – the extra specifications
Raises:

InvalidInput

does_vol_need_rdf_management_group(extra_specs)

Determine if a volume is a Metro or Async.

Parameters:extra_specs – the extra specifications
Returns:bool
generate_unique_trunc_host(host_name)

Create a unique short host name under 16 characters.

Parameters:host_name – long host name
Returns:truncated host name
static get_array_and_device_id(volume, external_ref)

Helper function for manage volume to get array name and device ID.

Parameters:
  • volume – volume object from API
  • external_ref – the existing volume object to be manged
Returns:

string value of the array name and device ID

static get_async_rdf_managed_grp_name(rep_config)

Get the name of the group used for async replication management.

Parameters:rep_config – the replication configuration
Returns:group name
static get_default_oversubscription_ratio(max_over_sub_ratio)

Override ratio if necessary.

The over subscription ratio will be overridden if the user supplied max oversubscription ratio is less than 1. :param max_over_sub_ratio: user supplied over subscription ratio :returns: max_over_sub_ratio

get_default_storage_group_name(srp_name, slo, workload, is_compression_disabled=False, is_re=False, rep_mode=None)

Determine default storage group from extra_specs.

Parameters:
  • srp_name – the name of the srp on the array
  • slo – the service level string e.g Bronze
  • workload – the workload string e.g DSS
  • is_compression_disabled – flag for disabling compression
  • is_re – flag for replication
  • rep_mode – flag to indicate replication mode
Returns:

storage_group_name

static get_grp_volume_model_update(volume, volume_dict, group_id)

Create and return the volume model update on creation.

Parameters:
  • volume – volume object
  • volume_dict – the volume dict
  • group_id – consistency group id
Returns:

model_update

get_host_short_name(host_name)

Returns the short name for a given qualified host name.

Checks the host name to see if it is the fully qualified host name and returns part before the dot. If there is no dot in the host name the full host name is returned. :param host_name: the fully qualified host name :returns: string – the short host_name

get_pg_short_name(portgroup_name)

Create a unique port group name under 12 characters.

Parameters:portgroup_name – long portgroup_name
Returns:truncated portgroup_name
static get_replication_config(rep_device_list)

Gather necessary replication configuration info.

Parameters:rep_device_list – the replication device list from cinder.conf
Returns:rep_config, replication configuration dict
static get_replication_prefix(rep_mode)

Get the replication prefix.

Replication prefix for storage group naming is based on whether it is synchronous, asynchronous, or metro replication mode.

Parameters:rep_mode – flag to indicate if replication is async
Returns:prefix
static get_short_protocol_type(protocol)

Given the protocol type, return I for iscsi and F for fc.

Parameters:protocol – iscsi or fc
Returns:string – ‘I’ for iscsi or ‘F’ for fc
get_temp_snap_name(clone_name, source_device_id)

Construct a temporary snapshot name for clone operation.

Parameters:
  • clone_name – the name of the clone
  • source_device_id – the source device id
Returns:

snap_name

static get_time_delta(start_time, end_time)

Get the delta between start and end time.

Parameters:
  • start_time – the start time
  • end_time – the end time
Returns:

string – delta in string H:MM:SS

static get_volume_element_name(volume_id)

Get volume element name follows naming convention, i.e. ‘OS-UUID’.

Parameters:volume_id – Openstack volume ID containing uuid
Returns:volume element name in format of OS-UUID
get_volume_group_utils(group, interval, retries)

Standard utility for generic volume groups.

Parameters:
  • group – the generic volume group object to be created
  • interval – Interval in seconds between retries
  • retries – Retry count
Returns:

array, intervals_retries_dict

Raises:

VolumeBackendAPIException

static get_volumetype_extra_specs(volume, volume_type_id=None)

Gets the extra specs associated with a volume type.

Parameters:
  • volume – the volume dictionary
  • volume_type_id – Optional override for volume.volume_type_id
Returns:

dict – extra_specs - the extra specs

Raises:

VolumeBackendAPIException

static is_compression_disabled(extra_specs)

Check is compression is to be disabled.

Parameters:extra_specs – extra specifications
Returns:boolean
is_metro_device(rep_config, extra_specs)

Determine if a volume is a Metro enabled device.

Parameters:
  • rep_config – the replication configuration
  • extra_specs – the extra specifications
Returns:

bool

static is_replication_enabled(extra_specs)

Check if replication is to be enabled.

Parameters:extra_specs – extra specifications
Returns:bool - true if enabled, else false
static is_volume_failed_over(volume)

Check if a volume has been failed over.

Parameters:volume – the volume object
Returns:bool
static modify_snapshot_prefix(snapshot_name, manage=False, unmanage=False)

Modify a Snapshot prefix on VMAX backend.

Prepare a snapshot name for manage/unmanage snapshot process either by adding or removing ‘OS-‘ prefix.

Parameters:
  • snapshot_name – the old snapshot backend display name
  • manage – (bool) if the operation is managing a snapshot
  • unmanage – (bool) if the operation is unmanaging a snapshot
Returns:

snapshot name ready for backend VMAX assignment

parse_file_to_get_array_map(file_name)

Parses a file and gets array map.

Given a file, parse it to get array and pool(srp).

<EMC>
<RestServerIp>10.108.246.202</RestServerIp>
<RestServerPort>8443</RestServerPort>
<RestUserName>smc</RestUserName>
<RestPassword>smc</RestPassword>
<SSLCert>/path/client.cert</SSLCert>
<SSLVerify>/path/to/certfile.pem</SSLVerify>
<PortGroups>
    <PortGroup>OS-PORTGROUP1-PG</PortGroup>
</PortGroups>
<Array>000198700439</Array>
<SRP>SRP_1</SRP>
</EMC>
Parameters:file_name – the configuration file
Returns:list
static truncate_string(str_to_truncate, max_num)

Truncate a string by taking first and last characters.

Parameters:
  • str_to_truncate – the string to be truncated
  • max_num – the maximum number of characters
Returns:

string – truncated string or original string

static update_extra_specs(extraspecs)

Update extra specs.

Parameters:extraspecs – the additional info
Returns:extraspecs
update_volume_group_name(group)

Format id and name consistency group.

Parameters:group – the generic volume group object
Returns:group_name – formatted name + id
static update_volume_model_updates(volume_model_updates, volumes, group_id, status='available')

Update the volume model’s status and return it.

Parameters:
  • volume_model_updates – list of volume model update dicts
  • volumes – volumes object api
  • group_id – consistency group id
  • status – string value reflects the status of the member volume
Returns:

volume_model_updates - updated volumes

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.