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
-
COMPRESSION_LIC
= ‘Compression’¶
-
CONVERT_TO_DEDUP
= 3¶
-
CONVERT_TO_FULL
= 2¶
-
CONVERT_TO_THIN
= 1¶
-
DEDUP
= 6¶
-
DEFAULT_REP_MODE
= ‘periodic’¶
-
DEFAULT_SYNC_PERIOD
= 900¶
-
EXTRA_SPEC_REP_MODE
= ‘replication:mode’¶
-
EXTRA_SPEC_REP_SYNC_PERIOD
= ‘replication:sync_period’¶
-
FAILBACK_VALUE
= ‘default’¶
-
PERIODIC
= 2¶
-
PRIORITY_OPT_LIC
= ‘Priority Optimization’¶
-
RC_ACTION_CHANGE_TO_PRIMARY
= 7¶
-
RC_GROUP_STARTED
= 3¶
-
REMOTE_COPY_LIC
= ‘Remote Copy’¶
-
SYNC
= 1¶
-
SYNC_STATUS_COMPLETED
= 3¶
-
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.
-
wait_for_task
()¶
-
-
VERSION
= ‘3.0.34’¶
-
VLUN_TYPE_EMPTY
= 1¶
-
VLUN_TYPE_HOST
= 3¶
-
VLUN_TYPE_HOST_SET
= 5¶
-
VLUN_TYPE_MATCHED_SET
= 4¶
-
VLUN_TYPE_PORT
= 2¶
-
build_nsp
(portPos)¶
-
build_portPos
(nsp)¶
-
check_flags
(options, required_flags)¶
-
check_for_setup_error
()¶
-
check_replication_flags
(options, required_flags)¶
-
client_login
()¶
-
client_logout
()¶
-
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_snapshot
(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
(volume)¶
-
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_snapshot
(snapshot)¶
-
delete_vlun
(volume, hostname)¶
-
delete_volume
(volume)¶
-
do_setup
(context, timeout=None, stats=None)¶
-
extend_volume
(volume, new_size)¶
-
failover_host
(context, volumes, secondary_backend_id)¶ Force failover to a secondary replication target.
-
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.
Parameters: - volume – A dictionary describing a volume.
- host – A dictionary describing a host.
-
find_existing_vluns
(volume, host)¶
-
get_active_fc_target_ports
()¶
-
get_active_iscsi_target_ports
()¶
-
get_active_target_ports
()¶
-
get_compression_policy
(hpe3par_keys)¶
-
get_cpg
(volume, allowSnap=False)¶
-
get_domain
(cpg_name)¶
-
get_flash_cache_policy
(hpe3par_keys)¶
-
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_ports
()¶
-
get_type_info
(type_id)¶ 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_version
()¶
-
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).
Parameters: - volume –
- host – Optional host to use for default pool.
Returns: dict
-
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).
Parameters: - type_id – id of type to get settings for
- pool – CPG to use if type does not have one set
Returns: dict
-
get_volume_stats
(refresh, filter_function=None, goodness_function=None)¶
-
hpe3par_valid_keys
= [‘cpg’, ‘snap_cpg’, ‘provisioning’, ‘persona’, ‘vvs’, ‘flash_cache’, ‘compression’]¶
-
hpe_qos_keys
= [‘minIOPS’, ‘maxIOPS’, ‘minBWS’, ‘maxBWS’, ‘latency’, ‘priority’]¶
-
is_volume_group_snap_type
(volume_type)¶
-
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.
Parameters: - 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.
Returns: (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.
Parameters: - 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.
-
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.
-
unmanage
(volume)¶ Removes the specified volume from Cinder management.
-
unmanage_snapshot
(snapshot)¶ 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_cpg
(cpg_name)¶
-
validate_persona
(persona_value)¶ Validate persona value.
If the passed in persona_value is not valid, raise InvalidInput, otherwise return the persona ID.
Parameters: persona_value – Raises: exception.InvalidInput – 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)¶
-