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

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_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

static get_default_storage_group_name(srp_name, slo, workload, is_compression_disabled=False, is_re=False)

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
Returns:

storage_group_name

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

static get_intervals_retries_dict(interval, retries)

Get the default intervals and retries.

Parameters:
  • interval – Interval in seconds between retries
  • retries – Retry count
Returns:

default_dict

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
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_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, extra specs dict list

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
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
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_admin_metadata(volumes_model_update, key, values)

Update the volume_model_updates with admin metadata.

Parameters:
  • volumes_model_update – List of volume model updates
  • key – Key to be updated in the admin_metadata
  • values – Dictionary of values per volume id
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.