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.
-
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_storage_group_name
(srp_name, slo, workload)¶ 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
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
-
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_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
-
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
override_ratio
(max_over_sub_ratio, max_sub_ratio_from_per)¶ Override ratio if necessary.
The over subscription ratio will be overridden if the max subscription percent is less than the user supplied max oversubscription ratio. :param max_over_sub_ratio: user supplied over subscription ratio :param max_sub_ratio_from_per: property on the srp :returns: max_over_sub_ratio
-
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> :param 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
-