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

class VMAXRest

Bases: object

Rest class based on Unisphere for VMAX Rest API.

add_child_sg_to_parent_sg(array, child_sg, parent_sg, extra_specs)

Add a storage group to a parent storage group.

This method adds an existing storage group to another storage group, i.e. cascaded storage groups. :param array: the array serial number :param child_sg: the name of the child sg :param parent_sg: the name of the parent sg :param extra_specs: the extra specifications

add_vol_to_sg(array, storagegroup_name, device_id, extra_specs)

Add a volume to a storage group.

Parameters:
  • array – the array serial number
  • storagegroup_name – storage group name
  • device_id – the device id
  • extra_specs – extra specifications
static check_status_code_success(operation, status_code, message)

Check if a status code indicates success.

Parameters:
  • operation – the operation
  • status_code – the status code
  • message – the server response
Raises:

VolumeBackendAPIException

create_initiator_group(array, init_group_name, init_list, extra_specs)

Create a new initiator group containing the given initiators.

Parameters:
  • array – the array serial number
  • init_group_name – the initiator group name
  • init_list – the list of initiators
  • extra_specs – extra specifications
create_masking_view(array, maskingview_name, storagegroup_name, port_group_name, init_group_name, extra_specs)

Create a new masking view.

Parameters:
  • array – the array serial number
  • maskingview_name – the masking view name
  • storagegroup_name – the storage group name
  • port_group_name – the port group
  • init_group_name – the initiator group
  • extra_specs – extra specifications
create_resource(array, category, resource_type, payload, private=”)

Create a provisioning resource.

Parameters:
  • array – the array serial number
  • category – the category
  • resource_type – the resource type
  • payload – the payload
  • private – empty string or ‘/private’ if private url
Returns:

status_code – int, message – string, server response

create_storage_group(array, storagegroup_name, srp, slo, workload, extra_specs)

Create the volume in the specified storage group.

Parameters:
  • array – the array serial number
  • storagegroup_name – the group name (String)
  • srp – the SRP (String)
  • slo – the SLO (String)
  • workload – the workload (String)
  • extra_specs – additional info
Returns:

storagegroup_name - string

create_volume_from_sg(array, volume_name, storagegroup_name, volume_size, extra_specs)

Create a new volume in the given storage group.

Parameters:
  • array – the array serial number
  • volume_name – the volume name (String)
  • storagegroup_name – the storage group name
  • volume_size – volume size (String)
  • extra_specs – the extra specifications
Returns:

dict – volume_dict - the volume dict

Raises:

VolumeBackendAPIException

create_volume_snap(array, snap_name, device_id, extra_specs)

Create a snapVx snapshot of a volume.

Parameters:
  • array – the array serial number
  • snap_name – the name of the snapshot
  • device_id – the source device id
  • extra_specs – the extra specifications
delete_initiator_group(array, initiatorgroup_name)

Delete an initiator group.

Parameters:
  • array – the array serial number
  • initiatorgroup_name – initiator group name
delete_masking_view(array, maskingview_name)

Delete a masking view.

Parameters:
  • array – the array serial number
  • maskingview_name – the masking view name
delete_resource(array, category, resource_type, resource_name, payload=None, private=”)

Delete a provisioning resource.

Parameters:
  • array – the array serial number
  • category – the resource category e.g. sloprovisioning
  • resource_type – the type of resource to be deleted
  • resource_name – the name of the resource to be deleted
  • payload – the payload, optional
  • private – empty string or ‘/private’ if private url
delete_storage_group(array, storagegroup_name)

Delete a storage group.

Parameters:
  • array – the array serial number
  • storagegroup_name – storage group name
delete_volume(array, device_id)

Deallocate and delete a volume.

Parameters:
  • array – the array serial number
  • device_id – volume device id
delete_volume_snap(array, snap_name, source_device_id)

Delete the snapshot of a volume.

Parameters:
  • array – the array serial number
  • snap_name – the name of the snapshot
  • source_device_id – the source device id
extend_volume(array, device_id, new_size, extra_specs)

Extend a VMAX volume.

Parameters:
  • array – the array serial number
  • device_id – volume device id
  • new_size – the new required size for the device
  • extra_specs – the extra specifications
find_mv_connections_for_vol(array, maskingview, device_id)

Find the host_lun_id for a volume in a masking view.

Parameters:
  • array – the array serial number
  • maskingview – the masking view name
  • device_id – the device ID
Returns:

host_lun_id – int

find_snap_vx_sessions(array, device_id, tgt_only=False)

Find all snapVX sessions for a device (source and target).

Parameters:
  • array – the array serial number
  • device_id – the device id
  • tgt_only – Flag - return only sessions where device is target
Returns:

list of snapshot dicts

find_volume_device_id(array, volume_name)

Given a volume identifier, find the corresponding device_id.

Parameters:
  • array – the array serial number
  • volume_name – the volume name (OS-<UUID>)
Returns:

device_id

find_volume_identifier(array, device_id)

Get the volume identifier of a VMAX volume.

Parameters:
  • array – array serial number
  • device_id – the device id
Returns:

the volume identifier – string

get_array_serial(array)

Get an array from its serial number.

Parameters:array – the array serial number
Returns:array_details – dict or None
get_common_masking_views(array, portgroup_name, ig_name)

Get common masking views for a given portgroup and initiator group.

Parameters:
  • array – the array serial number
  • portgroup_name – the port group name
  • ig_name – the initiator group name
Returns:

masking view list

get_element_from_masking_view(array, maskingview_name, portgroup=False, host=False, storagegroup=False)

Return the name of the specified element from a masking view.

Parameters:
  • array – the array serial number
  • maskingview_name – the masking view name
  • portgroup – the port group name - optional
  • host – the host name - optional
  • storagegroup – the storage group name - optional
Returns:

name of the specified element – string

Raises:

VolumeBackendAPIException

get_headroom_capacity(array, srp, slo, workload)

Get capacity of the different slo/ workload combinations.

Parameters:
  • array – the array serial number
  • srp – the storage resource srp
  • slo – the service level
  • workload – the workload

:return remaining_capacity – string, or None

get_in_use_initiator_list_from_array(array)

Get the list of initiators which are in-use from the array.

Gets the list of initiators from the array which are in hosts/ initiator groups. :param array: the array serial number :return: init_list

get_initiator(array, initiator_id)

Retrieve initaitor details from the array.

Parameters:
  • array – the array serial number
  • initiator_id – the initiator id
Returns:

initiator dict, or None

get_initiator_group(array, initiator_group=None, params=None)

Retrieve initiator group details from the array.

Parameters:
  • array – the array serial number
  • initiator_group – the initaitor group name
  • params – optional filter parameters
Returns:

initiator group dict, or None

get_initiator_group_from_initiator(array, initiator)

Given an initiator, get its corresponding initiator group, if any.

Parameters:
  • array – the array serial number
  • initiator – the initiator id
Returns:

found_init_group_name – string

get_initiator_list(array, params=None)

Retrieve initaitor list from the array.

Parameters:
  • array – the array serial number
  • params – dict of optional params
Returns:

list of initiators

get_iscsi_ip_address_and_iqn(array, port_id)

Get the IPv4Address from the director port.

Parameters:
  • array – the array serial number
  • port_id – the director port identifier
Returns:

(list of ip_addresses, iqn)

get_masking_view(array, masking_view_name)

Get details of a masking view.

Parameters:
  • array – array serial number
  • masking_view_name – the masking view name
Returns:

masking view dict

get_masking_view_list(array, params)

Get a list of masking views from the array.

Parameters:
  • array – array serial number
  • params – optional GET parameters
Returns:

masking view list

get_masking_views_by_initiator_group(array, initiatorgroup_name)

Given initiator group, retrieve the masking view instance name.

Retrieve the list of masking view instances associated with the given initiator group. :param array: the array serial number :param initiatorgroup_name: the name of the initiator group :returns: list of masking view names

get_masking_views_from_storage_group(array, storagegroup)

Return any masking views associated with a storage group.

Parameters:
  • array – the array serial number
  • storagegroup – the storage group name
Returns:

masking view list

get_num_vols_in_sg(array, storage_group_name)

Get the number of volumes in a storage group.

Parameters:
  • array – the array serial number
  • storage_group_name – the storage group name
Returns:

num_vols – int

get_port(array, port_id)

Get director port details.

Parameters:
  • array – the array serial number
  • port_id – the port id
Returns:

port dict, or None

get_port_ids(array, portgroup)

Get a list of port identifiers from a port group.

Parameters:
  • array – the array serial number
  • portgroup – the name of the portgroup
Returns:

list of port ids, e.g. [‘FA-3D:35’, ‘FA-4D:32’]

get_portgroup(array, portgroup)

Get a portgroup from the array.

Parameters:
  • array – array serial number
  • portgroup – the portgroup name
Returns:

portgroup dict or None

get_replication_capabilities(array)

Check what replication features are licensed and enabled.

Example return value for this method: {“symmetrixId”: “000197800128”,

“snapVxCapable”: true, “rdfCapable”: true}
Param:array
Returns:capabilities dict for the given array
get_resource(array, category, resource_type, resource_name=None, params=None, private=”)

Get resource details from array.

Parameters:
  • array – the array serial number
  • category – the resource category e.g. sloprovisioning
  • resource_type – the resource type e.g. maskingview
  • resource_name – the name of a specific resource
  • params – query parameters
  • private – empty string or ‘/private’ if private url
Returns:

resource object – dict or None

get_size_of_device_on_array(array, device_id)

Get the size of the volume from the array.

Parameters:
  • array – the array serial number
  • device_id – the volume device id
Returns:

size – or None

get_slo_list(array)

Returns the list of service levels associated with an srp.

Parameters:array – the array serial number

:return slo_list – list of service level names

get_snap_linked_device_list(array, source_device_id, snap_name)

Get the list of linked devices for a particular snapVx snapshot.

Parameters:
  • array – the array serial number
  • source_device_id – source device id
  • snap_name – the snapshot name
Returns:

linked_device_list

get_srp_by_name(array, srp=None)

Returns the details of a storage pool.

Parameters:
  • array – the array serial number
  • srp – the storage resource pool name
Returns:

SRP_details – dict or None

get_storage_group(array, storage_group_name)

Given a name, return storage group details.

Parameters:
  • array – the array serial number
  • storage_group_name – the name of the storage group
Returns:

storage group dict or None

get_storage_group_list(array, params=None)

“Return a list of storage groups.

Parameters:
  • array – the array serial number
  • params – optional filter parameters
Returns:

storage group list

get_storage_groups_from_volume(array, device_id)

Returns all the storage groups for a particular volume.

Parameters:
  • array – the array serial number
  • device_id – the volume device id
Returns:

storagegroup_list

get_target_wwns(array, portgroup)

Get the director ports’ wwns.

Parameters:
  • array – the array serial number
  • portgroup – portgroup
Returns:

target_wwns – the list of target wwns for the masking view

get_vmax_default_storage_group(array, srp, slo, workload)

Get the default storage group.

Parameters:
  • array – the array serial number
  • srp – the pool name
  • slo – the SLO
  • workload – the workload
Returns:

the storage group dict (or None), the storage group name

get_volume(array, device_id)

Get a VMAX volume from array.

Parameters:
  • array – the array serial number
  • device_id – the volume device id
Returns:

volume dict

Raises:

VolumeBackendAPIException

get_volume_list(array, params)

Get a filtered list of VMAX volumes from array.

Filter parameters are required as the unfiltered volume list could be very large and could affect performance if called often. :param array: the array serial number :param params: filter parameters :return: device_ids – list

get_volume_snap(array, device_id, snap_name)

Given a volume snap info, retrieve the snapVx object.

Parameters:
  • array – the array serial number
  • device_id – the source volume device id
  • snap_name – the name of the snapshot
Returns:

snapshot dict, or None

get_volume_snap_info(array, source_device_id)

Get snapVx information associated with a volume.

Parameters:
  • array – the array serial number
  • source_device_id – the source volume device ID
Returns:

message – dict, or None

get_volume_snapshot_list(array, source_device_id)

Get a list of snapshot details for a particular volume.

Parameters:
  • array – the array serial number
  • source_device_id – the osurce device id
Returns:

snapshot list or None

get_workload_settings(array)

Get valid workload options from array.

Parameters:array – the array serial number
Returns:workload_setting – list of workload names
is_child_sg_in_parent_sg(array, child_name, parent_name)

Check if a child storage group is a member of a parent group.

Parameters:
  • array – the array serial number
  • child_name – the child sg name
  • parent_name – the parent sg name
Returns:

bool

is_snapvx_licensed(array)

Check if the snapVx feature is licensed and enabled.

Parameters:array – the array serial number
Returns:True if licensed and enabled; False otherwise.
is_sync_complete(array, source_device_id, target_device_id, snap_name, extra_specs)

Check if a sync session is complete.

Parameters:
  • array – the array serial number
  • source_device_id – source device id
  • target_device_id – target device id
  • snap_name – snapshot name
  • extra_specs – extra specifications
Returns:

bool

is_vol_in_rep_session(array, device_id)

Check if a volume is in a replication session.

Parameters:
  • array – the array serial number
  • device_id – the device id
Returns:

snapvx_tgt – bool, snapvx_src – bool, rdf_grp – list or None

is_volume_in_storagegroup(array, device_id, storagegroup)

See if a volume is a member of the given storage group.

Parameters:
  • array – the array serial number
  • device_id – the device id
  • storagegroup – the storage group name
Returns:

bool

modify_resource(array, category, resource_type, payload, resource_name=None, private=”)

Modify a resource.

Parameters:
  • array – the array serial number
  • category – the category
  • resource_type – the resource type
  • payload – the payload
  • resource_name – the resource name
  • private – empty string or ‘/private’ if private url
Returns:

status_code – int, message – string (server response)

modify_storage_group(array, storagegroup, payload)

Modify a storage group (PUT operation).

Parameters:
  • array – the array serial number
  • storagegroup – storage group name
  • payload – the request payload
Returns:

status_code – int, message – string, server response

modify_volume_snap(array, source_id, target_id, snap_name, extra_specs, link=False, unlink=False)

Link or unlink a snapVx to or from a target volume.

Parameters:
  • array – the array serial number
  • source_id – the source device id
  • target_id – the target device id
  • snap_name – the snapshot name
  • extra_specs – extra specifications
  • link – Flag to indicate action = Link
  • unlink – Flag to indicate action = Unlink
remove_child_sg_from_parent_sg(array, child_sg, parent_sg, extra_specs)

Remove a storage group from its parent storage group.

This method removes a child storage group from its parent group. :param array: the array serial number :param child_sg: the name of the child sg :param parent_sg: the name of the parent sg :param extra_specs: the extra specifications

remove_vol_from_sg(*args, **kwargs)

Remove a volume from a storage group.

Parameters:
  • array – the array serial number
  • storagegroup_name – storage group name
  • device_id – the device id
  • extra_specs – the extra specifications
rename_volume(array, device_id, new_name)

Rename a volume.

Parameters:
  • array – the array serial number
  • device_id – the volume device id
  • new_name – the new name for the volume
request(target_uri, method, params=None, request_object=None)

Sends a request (GET, POST, PUT, DELETE) to the target api.

Parameters:
  • target_uri – target uri (string)
  • method – The method (GET, POST, PUT, or DELETE)
  • params – Additional URL parameters
  • request_object – request payload (dict)
Returns:

server response object (dict)

Raises:

VolumeBackendAPIException

set_rest_credentials(array_info)

Given the array record set the rest server credentials.

Parameters:array_info – record
wait_for_job(operation, status_code, job, extra_specs)

Check if call is async, wait for it to complete.

Parameters:
  • operation – the operation being performed
  • status_code – the status code
  • job – the job
  • extra_specs – the extra specifications
Returns:

task – list of dicts detailing tasks in the job

Raises:

VolumeBackendAPIException

wait_for_job_complete(job, extra_specs)

Given the job wait for it to complete.

Parameters:
  • job – the job dict
  • extra_specs – the extra_specs dict.
:return rc – int, result – string, status – string,
task – list of dicts detailing tasks in the job
Raises:VolumeBackendAPIException