The cinder.volume.drivers.san.hp.hp_3par_common Module

Volume driver common utilities for HP 3PAR Storage array

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

You will need to install the python hp3parclient. sudo pip install hp3parclient

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 hp3par_api_url, hp3par_username, hp3par_password for credentials to talk to the REST service on the 3PAR array.

class HP3PARCommon(config)

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 2.0.54 - Use same LUN ID for each VLUN path #1551994

CONVERT_TO_DEDUP = 3
CONVERT_TO_FULL = 2
CONVERT_TO_THIN = 1
DEDUP = 6
THIN = 2
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()
HP3PARCommon.VERSION = '2.0.54'
HP3PARCommon.VLUN_TYPE_EMPTY = 1
HP3PARCommon.VLUN_TYPE_HOST = 3
HP3PARCommon.VLUN_TYPE_HOST_SET = 5
HP3PARCommon.VLUN_TYPE_MATCHED_SET = 4
HP3PARCommon.VLUN_TYPE_PORT = 2
HP3PARCommon.attach_volume(volume, instance_uuid)

Save the instance UUID in the volume.

TODO: add support for multi-attach

HP3PARCommon.build_nsp(portPos)
HP3PARCommon.build_portPos(nsp)
HP3PARCommon.check_flags(options, required_flags)
HP3PARCommon.check_for_setup_error()
HP3PARCommon.clear_volume_key_value_pair(volume, key)

Clears key,value pairs metadata from virtual volume.

HP3PARCommon.client_login()
HP3PARCommon.client_logout()
HP3PARCommon.create_cgsnapshot(context, cgsnapshot)

Creates a cgsnapshot.

HP3PARCommon.create_cloned_volume(volume, src_vref)
HP3PARCommon.create_consistencygroup(context, group)

Creates a consistencygroup.

HP3PARCommon.create_consistencygroup_from_src(context, group, volumes, cgsnapshot=None, snapshots=None, source_cg=None, source_vols=None)
HP3PARCommon.create_snapshot(snapshot)
HP3PARCommon.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.

HP3PARCommon.create_volume(volume)
HP3PARCommon.create_volume_from_snapshot(volume, snapshot, snap_name=None, vvs_name=None)

Creates a volume from a snapshot.

HP3PARCommon.delete_cgsnapshot(context, cgsnapshot)

Deletes a cgsnapshot.

HP3PARCommon.delete_consistencygroup(context, group)

Deletes a consistency group.

HP3PARCommon.delete_snapshot(snapshot)
HP3PARCommon.delete_vlun(volume, hostname)
HP3PARCommon.delete_volume(volume)
HP3PARCommon.detach_volume(volume, attachment=None)

Remove the instance uuid from the volume.

TODO: add support for multi-attach.

HP3PARCommon.do_setup(context)
HP3PARCommon.extend_volume(volume, new_size)
HP3PARCommon.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.
HP3PARCommon.find_existing_vluns(volume, host)
HP3PARCommon.get_active_fc_target_ports()
HP3PARCommon.get_active_iscsi_target_ports()
HP3PARCommon.get_active_target_ports()
HP3PARCommon.get_cpg(volume, allowSnap=False)
HP3PARCommon.get_domain(cpg_name)
HP3PARCommon.get_flash_cache_policy(hp3par_keys)
HP3PARCommon.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’.

HP3PARCommon.get_persona_type(volume, hp3par_keys=None)
HP3PARCommon.get_ports()
HP3PARCommon.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:hp3par_keys, qos, volume_type, vvs_name
HP3PARCommon.get_version()
HP3PARCommon.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

HP3PARCommon.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

HP3PARCommon.get_volume_stats(refresh, filter_function=None, goodness_function=None)
HP3PARCommon.hp3par_valid_keys = ['cpg', 'snap_cpg', 'provisioning', 'persona', 'vvs', 'flash_cache']
HP3PARCommon.hp_qos_keys = ['minIOPS', 'maxIOPS', 'minBWS', 'maxBWS', 'latency', 'priority']
HP3PARCommon.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>}

HP3PARCommon.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>}

HP3PARCommon.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
HP3PARCommon.qos_priority_level = {'high': 3, 'low': 1, 'normal': 2}
HP3PARCommon.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.
HP3PARCommon.stats = {}
HP3PARCommon.terminate_connection(volume, hostname, wwn=None, iqn=None)

Driver entry point to unattach a volume from an instance.

HP3PARCommon.tune_vv(old_tpvv, new_tpvv, old_tdvv, new_tdvv, old_cpg, new_cpg, volume_name)

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.

HP3PARCommon.unmanage(volume)

Removes the specified volume from Cinder management.

HP3PARCommon.update_consistencygroup(context, group, add_volumes=None, remove_volumes=None)
HP3PARCommon.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.

HP3PARCommon.update_volume_key_value_pair(volume, key, value)

Updates key,value pair as metadata onto virtual volume.

If key already exists, the value will be replaced.

HP3PARCommon.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']
HP3PARCommon.valid_prov_values = ['thin', 'full', 'dedup']
HP3PARCommon.validate_cpg(cpg_name)
HP3PARCommon.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 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)

Previous topic

The cinder.volume.drivers.remotefs Module

Next topic

The cinder.volume.drivers.san.hp.hp_3par_fc Module

Project Source

This Page