The cinder.volume.drivers.hpe.hpe_3par_common Module

The cinder.volume.drivers.hpe.hpe_3par_common Module

Volume driver common utilities for HPE 3PAR Storage array

The 3PAR drivers requires 3.1.3 firmware on the 3PAR array.

You will need to install the python hpe3parclient module. sudo pip install python-3parclient

The drivers uses both the REST service and the SSH command line to correctly operate. Since the ssh credentials and the REST credentials can be different we need to have settings for both.

The drivers requires the use of the san_ip, san_login, san_password settings for ssh connections into the 3PAR array. It also requires the setting of hpe3par_api_url, hpe3par_username, hpe3par_password for credentials to talk to the REST service on the 3PAR array.

class HPE3PARCommon(config, active_backend_id=None)

Bases: object

Class that contains common code for the 3PAR drivers.

Version history:

1.2.0 - Updated hp3parclient API use to 2.0.x
1.2.1 - Check that the VVS exists
1.2.2 - log prior to raising exceptions
1.2.3 - Methods to update key/value pair bug #1258033
1.2.4 - Remove deprecated config option hp3par_domain
1.2.5 - Raise Ex when deleting snapshot with dependencies bug #1250249
1.2.6 - Allow optional specifying n:s:p for vlun creation bug #1269515
        This update now requires 3.1.2 MU3 firmware
1.3.0 - Removed all SSH code.  We rely on the hp3parclient now.
2.0.0 - Update hp3parclient API uses 3.0.x
2.0.1 - Updated to use qos_specs, added new qos settings and personas
2.0.2 - Add back-end assisted volume migrate
2.0.3 - Allow deleting missing snapshots bug #1283233
2.0.4 - Allow volumes created from snapshots to be larger bug #1279478
2.0.5 - Fix extend volume units bug #1284368
2.0.6 - use loopingcall.wait instead of time.sleep
2.0.7 - Allow extend volume based on snapshot bug #1285906
2.0.8 - Fix detach issue for multiple hosts bug #1288927
2.0.9 - Remove unused 3PAR driver method bug #1310807
2.0.10 - Fixed an issue with 3PAR vlun location bug #1315542
2.0.11 - Remove hp3parclient requirement from unit tests #1315195
2.0.12 - Volume detach hangs when host is in a host set bug #1317134
2.0.13 - Added support for managing/unmanaging of volumes
2.0.14 - Modified manage volume to use standard 'source-name' element.
2.0.15 - Added support for volume retype
2.0.16 - Add a better log during delete_volume time. Bug #1349636
2.0.17 - Added iSCSI CHAP support
         This update now requires 3.1.3 MU1 firmware
         and hp3parclient 3.1.0
2.0.18 - HP 3PAR manage_existing with volume-type support
2.0.19 - Update default persona from Generic to Generic-ALUA
2.0.20 - Configurable SSH missing key policy and known hosts file
2.0.21 - Remove bogus invalid snapCPG=None exception
2.0.22 - HP 3PAR drivers should not claim to have 'infinite' space
2.0.23 - Increase the hostname size from 23 to 31  Bug #1371242
2.0.24 - Add pools (hp3par_cpg now accepts a list of CPGs)
2.0.25 - Migrate without losing type settings bug #1356608
2.0.26 - Don't ignore extra-specs snap_cpg when missing cpg #1368972
2.0.27 - Fixing manage source-id error bug #1357075
2.0.28 - Removing locks bug #1381190
2.0.29 - Report a limitless cpg's stats better bug #1398651
2.0.30 - Update the minimum hp3parclient version bug #1402115
2.0.31 - Removed usage of host name cache #1398914
2.0.32 - Update LOG usage to fix translations.  bug #1384312
2.0.33 - Fix host persona to match WSAPI mapping bug #1403997
2.0.34 - Fix log messages to match guidelines. bug #1411370
2.0.35 - Fix default snapCPG for manage_existing bug #1393609
2.0.36 - Added support for dedup provisioning
2.0.37 - Added support for enabling Flash Cache
2.0.38 - Add stats for hp3par goodness_function and filter_function
2.0.39 - Added support for updated detach_volume attachment.
2.0.40 - Make the 3PAR drivers honor the pool in create  bug #1432876
2.0.41 - Only log versions at startup.  bug #1447697
2.0.42 - Fix type for snapshot config settings. bug #1461640
2.0.43 - Report the capability of supporting multiattach
2.0.44 - Update help strings to reduce the 3PAR user role requirements
2.0.45 - Python 3 fixes
2.0.46 - Improved VLUN creation and deletion logic. #1469816
2.0.47 - Changed initialize_connection to use getHostVLUNs. #1475064
2.0.48 - Adding changes to support 3PAR iSCSI multipath.
2.0.49 - Added client CPG stats to driver volume stats. bug #1482741
2.0.50 - Add over subscription support
2.0.51 - Adds consistency group support
2.0.52 - Added update_migrated_volume. bug #1492023
2.0.53 - Fix volume size conversion. bug #1513158
3.0.0 - Rebranded HP to HPE.
3.0.1 - Fixed find_existing_vluns bug #1515033
3.0.2 - Python 3 support
3.0.3 - Remove db access for consistency groups
3.0.4 - Adds v2 managed replication support
3.0.5 - Adds v2 unmanaged replication support
3.0.6 - Adding manage/unmanage snapshot support
3.0.7 - Enable standard capabilities based on 3PAR licenses
3.0.8 - Optimize array ID retrieval
3.0.9 - Bump minimum API version for volume replication
3.0.10 - Added additional volumes checks to the manage snapshot API
3.0.11 - Fix the image cache capability bug #1491088
3.0.12 - Remove client version checks for replication
3.0.13 - Support creating a cg from a source cg
3.0.14 - Comparison of WWNs now handles case difference. bug #1546453
3.0.15 - Update replication to version 2.1
3.0.16 - Use same LUN ID for each VLUN path #1551994
3.0.17 - Don't fail on clearing 3PAR object volume key. bug #1546392
3.0.18 - create_cloned_volume account for larger size.  bug #1554740
3.0.19 - Remove metadata that tracks the instance ID. bug #1572665
3.0.20 - Fix lun_id of 0 issue. bug #1573298
3.0.21 - Driver no longer fails to initialize if
         System Reporter license is missing. bug #1568078
3.0.22 - Rework delete_vlun. Bug #1582922
3.0.23 - Fix CG create failures with long display name or special
         characters. bug #1573647
3.0.24 - Fix terminate connection on failover
3.0.25 - Fix delete volume when online clone is active. bug #1349639
3.0.26 - Fix concurrent snapshot delete conflict. bug #1600104
3.0.27 - Fix snapCPG error during backup of attached volume.
         Bug #1646396 and also ,Fix backup of attached ISCSI
         and CHAP enabled volume.bug #1644238.
3.0.28 - Remove un-necessary snapshot creation of source volume
         while doing online copy in create_cloned_volume call.
         Bug #1661541
3.0.29 - Fix convert snapshot volume to base volume type. bug #1656186
3.0.30 - Handle manage and unmanage hosts present. bug #1648067
3.0.31 - Enable HPE-3PAR Compression Feature.
3.0.32 - Add consistency group capability to generic volume group
         in HPE-3APR
3.0.33 - Added replication feature in retype flow. bug #1680313
3.0.34 - Add cloned volume to vvset in online copy. bug #1664464
3.0.35 - Add volume to consistency group if flag enabled. bug #1702317
3.0.36 - Swap volume name in migration. bug #1699733
3.0.37 - Fixed image cache enabled capability. bug #1686985
3.0.38 - Fixed delete operation of replicated volume which is part
         of QOS. bug #1717875
3.0.39 - Add support for revert to snapshot.
4.0.0 - Code refactor.
4.0.1 - Added check to modify host after volume detach. bug #1730720
4.0.2 - Added Tiramisu feature on 3PAR.
4.0.3 - Fixed create group from source functionality in case of
        tiramisu. bug #1742092.
4.0.4 - Fixed setting of sync_period value in rcopygroup. bug #1746235
4.0.5 - Fixed volume created and added in cloned group,
        differs from volume present in the source group in terms of
        extra-specs. bug #1744025
4.0.6 - Monitor task of promoting a virtual copy. bug #1749642
4.0.7 - Handle force detach case. bug #1686745
COMPRESSION_LIC = 'Compression'
DEFAULT_REP_MODE = 'periodic'
EXTRA_SPEC_REP_MODE = 'replication:mode'
EXTRA_SPEC_REP_SYNC_PERIOD = 'replication:sync_period'
FAILBACK_VALUE = 'default'
PRIORITY_OPT_LIC = 'Priority Optimization'
REMOTE_COPY_LIC = 'Remote Copy'
SYNC = 1
SYSTEM_REPORTER_LIC = 'System Reporter'
THIN = 2
THIN_PROV_LIC = 'Thin Provisioning'
class TaskWaiter(client, task_id, interval=1, initial_delay=0)

Bases: object

TaskWaiter waits for task to be not active and returns status.

VERSION = '4.0.7'
check_flags(options, required_flags)
check_replication_flags(options, required_flags)
create_cloned_volume(volume, src_vref)
create_group(context, group)

Creates a group.

create_group_from_src(context, group, volumes, group_snapshot=None, snapshots=None, source_group=None, source_vols=None)
create_group_snapshot(context, group_snapshot, snapshots)

Creates a group snapshot.

create_vlun(volume, host, nsp=None, lun_id=None)

Create a VLUN.

In order to export a volume on a 3PAR box, we have to create a VLUN.

create_volume_from_snapshot(volume, snapshot, snap_name=None, vvs_name=None)

Creates a volume from a snapshot.

delete_group(context, group, volumes)

Deletes a group.

delete_group_snapshot(context, group_snapshot, snapshots)

Deletes a group snapshot.

delete_vlun(volume, hostname, wwn=None, iqn=None)
disable_replication(context, group, volumes)

Disable replication for a group.

  • context – the context
  • group – the group object
  • volumes – the list of volumes

model_update, None

do_setup(context, timeout=None, stats=None)
enable_replication(context, group, volumes)

Enable replication for a group.

  • context – the context
  • group – the group object
  • volumes – the list of volumes

model_update, None

extend_volume(volume, new_size)
failover_host(context, volumes, secondary_backend_id, groups)

Force failover to a secondary replication target.

failover_replication(context, group, volumes, secondary_backend_id=None, host=False)

Failover replication for a group.

  • context – the context
  • group – the group object
  • volumes – the list of volumes
  • secondary_backend_id – the secondary backend id - default None
  • host – flag to indicate if whole host is being failed over

model_update, None

find_existing_vlun(volume, host)

Finds an existing VLUN for a volume on a host.

Returns an existing VLUN’s information. If no existing VLUN is found, None is returned.

  • volume – A dictionary describing a volume.
  • host – A dictionary describing a host.
find_existing_vluns(volume, host)
get_cpg(volume, allowSnap=False)
get_next_word(s, search_string)

Return the next word.

Search ‘s’ for ‘search_string’, if found return the word preceding ‘search_string’ from ‘s’.

get_persona_type(volume, hpe3par_keys=None)

Get 3PAR type info for the given type_id.

Reconciles VV Set, old-style extra-specs, and QOS specs and returns commonly used info about the type.

Returns:hpe3par_keys, qos, volume_type, vvs_name
get_volume_settings_from_type(volume, host=None)

Get 3PAR volume settings given a volume.

Combines type info and config settings to return a dictionary describing the 3PAR volume settings. Does some validation (CPG and persona).

  • volume
  • host – Optional host to use for default pool.


get_volume_settings_from_type_id(type_id, pool)

Get 3PAR volume settings given a type_id.

Combines type info and config settings to return a dictionary describing the 3PAR volume settings. Does some validation (CPG). Uses pool as the default cpg (when not specified in volume type specs).

  • type_id – id of type to get settings for
  • pool – CPG to use if type does not have one set


get_volume_stats(refresh, filter_function=None, goodness_function=None)
hpe3par_valid_keys = ['cpg', 'snap_cpg', 'provisioning', 'persona', 'vvs', 'flash_cache', 'compression', 'group_replication']
hpe_qos_keys = ['minIOPS', 'maxIOPS', 'minBWS', 'maxBWS', 'latency', 'priority']
manage_existing(volume, existing_ref)

Manage an existing 3PAR volume.

existing_ref is a dictionary of the form: {‘source-name’: <name of the virtual volume>}

manage_existing_get_size(volume, existing_ref)

Return size of volume to be managed by manage_existing.

existing_ref is a dictionary of the form: {‘source-name’: <name of the virtual volume>}

manage_existing_snapshot(snapshot, existing_ref)

Manage an existing 3PAR snapshot.

existing_ref is a dictionary of the form: {‘source-name’: <name of the snapshot>}

manage_existing_snapshot_get_size(snapshot, existing_ref)

Return size of snapshot to be managed by manage_existing_snapshot.

existing_ref is a dictionary of the form: {‘source-name’: <name of the snapshot>}

migrate_volume(volume, host)

Migrate directly if source and dest are managed by same storage.

  • volume – A dictionary describing the volume to migrate
  • host – A dictionary describing the host to migrate to, where host[‘host’] is its name, and host[‘capabilities’] is a dictionary of its reported capabilities.

(False, None) if the driver does not support migration, (True, model_update) if successful

qos_priority_level = {'high': 3, 'low': 1, 'normal': 2}
retype(volume, new_type, diff, host)

Convert the volume to be of the new type.

Returns True if the retype was successful. Uses taskflow to revert changes if errors occur.

  • volume – A dictionary describing the volume to retype
  • new_type – A dictionary describing the volume type to convert to
  • diff – A dictionary with the difference between the two types
  • host – A dictionary describing the host, where host[‘host’] is its name, and host[‘capabilities’] is a dictionary of its reported capabilities. Host validation is just skipped if host is None.
revert_to_snapshot(volume, snapshot)

Revert volume to snapshot.

  • volume – A dictionary describing the volume to revert
  • snapshot – A dictionary describing the latest snapshot
stats = {}
terminate_connection(volume, hostname, wwn=None, iqn=None)

Driver entry point to unattach a volume from an instance.

tune_vv(old_tpvv, new_tpvv, old_tdvv, new_tdvv, old_cpg, new_cpg, volume_name, new_compression)

Tune the volume to change the userCPG and/or provisioningType.

The volume will be modified/tuned/converted to the new userCPG and provisioningType, as needed.

TaskWaiter is used to make this function wait until the 3PAR task is no longer active. When the task is no longer active, then it must either be done or it is in a state that we need to treat as an error.


Removes the specified volume from Cinder management.


Removes the specified snapshot from Cinder management.

update_group(context, group, add_volumes=None, remove_volumes=None)
update_migrated_volume(context, volume, new_volume, original_volume_status)

Rename the new (temp) volume to it’s original name.

This method tries to rename the new volume to it’s original name after the migration has completed.

valid_persona_values = ['2 - Generic-ALUA', '1 - Generic', '3 - Generic-legacy', '4 - HPUX-legacy', '5 - AIX-legacy', '6 - EGENERA', '7 - ONTAP-legacy', '8 - VMware', '9 - OpenVMS', '10 - HPUX', '11 - WindowsServer']
valid_prov_values = ['thin', 'full', 'dedup']

Validate persona value.

If the passed in persona_value is not valid, raise InvalidInput, otherwise return the persona ID.

Returns:persona ID
class ModifySpecsTask(action)

Bases: cinder.flow_utils.CinderTask

Set/unset the QOS settings and/or VV set for the volume’s new type.

This is a task for changing the QOS settings and/or VV set. It is intended for use during retype(). If changes are made during execute(), then they need to be undone if revert() is called (i.e., if a later task fails).

For 3PAR, we ignore QOS settings if a VVS is explicitly set, otherwise we create a VV set and use that for QOS settings. That is why they are lumped together here. Most of the decision-making about VVS vs. QOS settings vs. old-style scoped extra-specs is handled in existing reusable code. Here we mainly need to know what old stuff to remove before calling the function that knows how to set the new stuff.

Basic task flow is as follows: Remove the volume from the old externally created VVS (when appropriate), delete the old cinder-created VVS, call the function that knows how to set a new VVS or QOS settings.

If any changes are made during execute, then revert needs to reverse them.

execute(common, volume_name, volume, old_cpg, new_cpg, old_vvs, new_vvs, old_qos, new_qos, old_flash_cache, new_flash_cache)
revert(common, volume_name, volume, old_vvs, new_vvs, old_qos, old_cpg, **kwargs)
class ModifyVolumeTask(action)

Bases: cinder.flow_utils.CinderTask

Task to change a volume’s snapCPG and comment.

This is a task for changing the snapCPG and comment. It is intended for use during retype(). These changes are done together with a single modify request which should be fast and easy to revert.

Because we do not support retype with existing snapshots, we can change the snapCPG without using a keepVV. If snapshots exist, then this will fail, as desired.

This task does not change the userCPG or provisioningType. Those changes may require tunevv, so they are done by the TuneVolumeTask.

The new comment will contain the new type, VVS and QOS information along with whatever else was in the old comment dict.

The old comment and snapCPG are restored if revert is called.

execute(common, volume_name, old_snap_cpg, new_snap_cpg, old_comment, new_vvs, new_qos, new_type_name, new_type_id)
revert(common, volume_name, old_snap_cpg, new_snap_cpg, old_comment, **kwargs)
class ReplicateVolumeTask(action, **kwargs)

Bases: cinder.flow_utils.CinderTask

Task to replicate a volume.

This is a task for adding/removing the replication feature to volume. It is intended for use during retype(). This task has no revert. # TODO(sumit): revert back to original volume extra-spec

execute(common, volume, new_type_id)
class TuneVolumeTask(action, **kwargs)

Bases: cinder.flow_utils.CinderTask

Task to change a volume’s CPG and/or provisioning type.

This is a task for changing the CPG and/or provisioning type. It is intended for use during retype().

This task has no revert. The current design is to do this task last and do revert-able tasks first. Un-doing a tunevv can be expensive and should be avoided.

execute(common, old_tpvv, new_tpvv, old_tdvv, new_tdvv, old_cpg, new_cpg, volume_name, new_compression)
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.