hp3parclient Package

hp3parclient Package

HP 3PAR Client.

Author:Walter A. Boring IV
Author:Kurt Martin
Copyright:Copyright 2012-2016, Hewlett Packard Development Company, L.P.
License:Apache v2.0
hp3parclient.__init__.get_version_string()[source]

Current version of HP3PARClient.

client Module

HP3PAR REST Client.

Author:Walter A. Boring IV
Description:This is the 3PAR Client that talks to 3PAR’s REST WSAPI Service.

It provides the ability to provision 3PAR volumes, VLUNs, CPGs. This version also supports running actions on the 3PAR that use SSH.

This client requires and works with 3PAR InForm 3.1.3 MU1 firmware

class hp3parclient.client.HP3ParClient(api_url, debug=False, secure=False, suppress_ssl_warnings=False)[source]

Bases: object

The 3PAR REST API Client.

Parameters:api_url (str) – The url to the WSAPI service on 3PAR ie. http://<3par server>:8080/api/v1
CHAP_INITIATOR = 1
CHAP_OPERATION_MODE_INITIATOR = 1
CHAP_OPERATION_MODE_TARGET = 2
CHAP_TARGET = 2
CPG_CHUNKLET_POS_PREF_FIRST = 1
CPG_CHUNKLET_POS_PREF_LAST = 2
CPG_DISK_TYPE_FC = 1
CPG_DISK_TYPE_NL = 2
CPG_DISK_TYPE_SSD = 3
CPG_HA_CAGE = 2
CPG_HA_MAG = 3
CPG_HA_PORT = 1
CPG_RAID_R0 = 1
CPG_RAID_R1 = 2
CPG_RAID_R5 = 3
CPG_RAID_R6 = 4
FLASH_CACHE_DISABLED = 2
FLASH_CACHE_ENABLED = 1
GROW_VOLUME = 3
HOST_EDIT_ADD = 1
HOST_EDIT_REMOVE = 2
HOST_PERSONA_AIX_LEGACY = 5
HOST_PERSONA_EGENERA = 6
HOST_PERSONA_GENERIC = 1
HOST_PERSONA_GENERIC_ALUA = 2
HOST_PERSONA_GENERIC_LEGACY = 3
HOST_PERSONA_HPUX = 10
HOST_PERSONA_HPUX_LEGACY = 4
HOST_PERSONA_ONTAP_LEGACY = 7
HOST_PERSONA_OPENVMS = 9
HOST_PERSONA_VMWARE = 8
HOST_PERSONA_WINDOWS_SERVER = 11
HP3PAR_WS_MIN_BUILD_VERSION = 30103230
HP3PAR_WS_MIN_BUILD_VERSION_DESC = '3.1.3 MU1'
HP3PAR_WS_MIN_BUILD_VERSION_VLUN_QUERY = 30201292
HP3PAR_WS_MIN_BUILD_VERSION_VLUN_QUERY_DESC = '3.2.1 MU2'
PORT_MODE_INITIATOR = 3
PORT_MODE_PEER = 4
PORT_MODE_TARGET = 2
PORT_PROTO_FC = 1
PORT_PROTO_FCOE = 3
PORT_PROTO_IP = 4
PORT_PROTO_ISCSI = 2
PORT_PROTO_SAS = 5
PORT_STATE_OFFLINE = 10
PORT_STATE_READY = 4
PORT_STATE_SYNC = 5
PORT_TYPE_CNA = 9
PORT_TYPE_DISK = 2
PORT_TYPE_FREE = 3
PORT_TYPE_HOST = 1
PORT_TYPE_IPORT = 4
PORT_TYPE_ISCSI = 8
PORT_TYPE_PEER = 6
PORT_TYPE_RCFC = 5
PORT_TYPE_RCIP = 7
PRIORITY_HIGH = 3
PRIORITY_LOW = 1
PRIORITY_NORMAL = 2
RESYNC_PHYSICAL_COPY = 2
SET_MEM_ADD = 1
SET_MEM_REMOVE = 2
SET_RESYNC_PHYSICAL_COPY = 3
SET_STOP_PHYSICAL_COPY = 4
STOP_PHYSICAL_COPY = 1
TARGET_TYPE_SYS = 2
TARGET_TYPE_VVSET = 1
TASK_ACTIVE = 2
TASK_CANCELLED = 3
TASK_DONE = 1
TASK_FAILED = 4
TASK_TYPE_BACKGROUND_TASK = 16
TASK_TYPE_CHECK_VV = 13
TASK_TYPE_COMPACT_CPG = 10
TASK_TYPE_COMPACT_IDS = 11
TASK_TYPE_CONVERT_VV = 19
TASK_TYPE_IMPORT_VV = 17
TASK_TYPE_MOVE_REGIONS = 3
TASK_TYPE_ONLINE_COPY = 18
TASK_TYPE_PHYS_COPY_RESYNC = 2
TASK_TYPE_PROMOTE_SV = 4
TASK_TYPE_REMOTE_COPY_FAILOVER = 7
TASK_TYPE_REMOTE_COPY_RECOVER = 8
TASK_TYPE_REMOTE_COPY_RESTORE = 9
TASK_TYPE_REMOTE_COPY_REVERSE = 6
TASK_TYPE_REMOTE_COPY_SYNC = 5
TASK_TYPE_SCHEDULED_TASK = 14
TASK_TYPE_SNAPSHOT_ACCOUNTING = 12
TASK_TYPE_SYSTEM_TASK = 15
TASK_TYPE_VV_COPY = 1
VLUN_MULTIPATH_FAILOVER = 3
VLUN_MULTIPATH_ROUND_ROBIN = 2
VLUN_MULTIPATH_UNKNOWN = 1
VLUN_TYPE_EMPTY = 1
VLUN_TYPE_HOST = 3
VLUN_TYPE_HOST_SET = 5
VLUN_TYPE_MATCHED_SET = 4
VLUN_TYPE_PORT = 2
addHostToHostSet(set_name, name)[source]

This adds a host to a host set.

Parameters:
  • set_name (str) – the host set name
  • name (str) – the host name to add
Returns:

headers - dict of HTTP Response headers. Upon successful modification of a host set HTTP code 200 OK is returned and the URI of the updated host set will be returned in the location portion of the headers.

Returns:

body - the body of the response. None if successful.

addVolumeToVolumeSet(set_name, name)[source]

This adds a volume to a volume set

Parameters:
  • set_name (str) – the volume set name
  • name (str) – the volume name to add
copyVolume(src_name, dest_name, dest_cpg, optional=None)[source]

Copy/Clone a volume.

Parameters:
  • src_name (str) – the source volume name
  • dest_name (str) – the destination volume name
  • dest_cpg (str) – the destination CPG
  • optional (dict) – Dictionary of optional params
optional = {
    'online': False,                # should physical copy be
                                    # performed online?
    'tpvv': False,                  # use thin provisioned space
                                    # for destination
                                    # (online copy only)
    'snapCPG': 'OpenStack_SnapCPG', # snapshot CPG for the
                                    # destination
                                    # (online copy only)
    'saveSnapshot': False,          # save the snapshot of the
                                    # source volume
    'priority': 1                   # taskPriorityEnum (does not
                                    # apply to online copy)
}
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Invalid VV name or CPG name.
Raises:HTTPNotFound - NON_EXISTENT_CPG - The CPG does not exists.
Raises:HTTPForbidden - CPG_NOT_IN SAME_DOMAIN - The CPG is not in the current domain.
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
Raises:HTTPForbidden - VV_NOT_IN_SAME_DOMAIN - The volume is not in the same domain.
Raises:HTTPBadRequest - INV_INPUT_BAD_ENUM_VALUE - The priority value in not in the valid range(1-3).
Raises:HTTPConflict - EXISTENT_VOLUME - The volume already exists.
Raises:HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - The operation is not allowed on a system volume.
Raises:HTTPForbidden - INV_OPERATION_NON_BASE_VOLUME - The destination volume is not a base volume.
Raises:HTTPForbidden - INV_OPERATION_IN_REMOTE_COPY - The destination volume is involved in a remote copy.
Raises:HTTPForbidden - INV_OPERATION_VV_EXPORTED - The volume is exported.
Raises:HTTPForbidden - INV_OPERATION_VV_COPY_TO_SELF - The destination volume is the same as the parent.
Raises:HTTPForbidden - INV_OPERATION_VV_READONLY_SNAPSHOT - The parent volume is a read-only snapshot.
Raises:HTTPForbidden - INV_OPERATION_VV_COPY_TO_BASE - The destination volume is the base volume of a parent volume.
Raises:HTTPConflict - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - The volume is in a conversion operation.
Raises:HTTPForbidden - INV_OPERATION_VV_NO_SNAPSHOT_ALLOWED - The parent volume must allow snapshots.
Raises:HTTPConflict - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - The volume is the target of an online copy.
Raises:HTTPForbidden - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Cleanup of internal volume for the volume is in progress.
Raises:HTTPForbidden - INV_OPERATION_VV_CIRCULAR_COPY - The parent volume is a copy of the destination volume.
Raises:HTTPForbidden - INV_OPERATION_VV_PEER_VOLUME - The operation is not allowed on a peer volume.
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - The operation is not allowed on an internal volume.
Raises:HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed.
Raises:HTTPForbidden - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - The volume is not in the normal state.
Raises:HTTPForbidden - VV_IN_INCONSISTENT_STATE - The volume has an internal consistency error.
Raises:HTTPConflict - INV_OPERATION_VV_PCOPY_IN_PROGRESS - The destination volume has a physical copy in progress.
Raises:HTTPConflict - INV_OPERATION_VV_FAILED_ONLINE_COPY - Online copying of the destination volume has failed.
Raises:HTTPConflict - INV_OPERATION_VV_COPY_PARENT_TOO_BIG - The size of the parent volume is larger than the size of the destination volume.
Raises:HTTPForbidden - INV_OPERATION_VV_NO_PARENT - The volume has no physical parent.
Raises:HTTPConflict - IN_USE - The resynchronization snapshot is in a stale state.
Raises:HTTPForbidden - VV_IN_STALE_STATE - The volume is in a stale state.
Raises:HTTPNotFound - NON_EXISTENT_VVCOPY - Physical copy not found.
createCPG(name, optional=None)[source]

Create a CPG.

Parameters:
  • name (str) – CPG Name
  • optional (dict) – Optional parameters
optional = {
    'growthIncrementMiB': 100,    # Growth increment in MiB for
                                  # each auto-grown operation
    'growthLimitMiB': 1024,       # Auto-grow operation is limited
                                  # to specified storage amount
    'usedLDWarningAlertMiB': 200, # Threshold to trigger warning
                                  # of used logical disk space
    'domain': 'MyDomain',         # Name of the domain object
    'LDLayout': {
        'RAIDType': 1,            # Disk Raid Type
        'setSize': 100,           # Size in number of chunklets
        'HA': 0,                  # Layout supports failure of
                                  # one port pair (1),
                                  # one cage (2),
                                  # or one magazine (3)
        'chunkletPosPref': 2,     # Chunklet location perference
                                  # characteristics.
                                  # Lowest Number/Fastest transfer
                                  # = 1
                                  # Higher Number/Slower transfer
                                  # = 2
        'diskPatterns': []}       # Patterns for candidate disks
}
Raises:HTTPBadRequest - INV_INPUT Invalid URI Syntax.
Raises:HTTPBadRequest - NON_EXISTENT_DOMAIN - Domain doesn’t exist.
Raises:HTTPBadRequest - NO_SPACE - Not Enough space is available.
Raises:HTTPBadRequest - BAD_CPG_PATTERN A Pattern in a CPG specifies illegal values.
Raises:HTTPForbidden - PERM_DENIED - Permission denied
Raises:HTTPConflict - EXISTENT_CPG - CPG Exists already
createHost(name, iscsiNames=None, FCWwns=None, optional=None)[source]

Create a new Host entry.

Parameters:
  • name (array) – The name of the host
  • iscsiNames – Array if iscsi iqns
  • FCWwns – Array if Fibre Channel World Wide Names
  • optional (dict) – The optional stuff
optional = {
    'persona': 1,                   # ID of the persona to assign
                                    # to the host.
                                    # 3.1.3 default: Generic-ALUA
                                    # 3.1.2 default: General
    'domain': 'myDomain',           # Create the host in the
                                    # specified domain, or default
                                    # domain if unspecified.
    'forceTearDown': False,         # If True, force to tear down
                                    # low-priority VLUN exports.
    'descriptors':
        {'location': 'earth',       # The host's location
         'IPAddr': '10.10.10.10',   # The host's IP address
         'os': 'linux',             # The operating system running
                                    # on the host.
         'model': 'ex',             # The host's model
         'contact': 'Smith',        # The host's owner and contact
         'comment': "Joe's box"}    # Additional host information
}
Raises:HTTPForbidden - PERM_DENIED - Permission denied
Raises:HTTPBadRequest - INV_INPUT_MISSING_REQUIRED - Name not specified.
Raises:HTTPBadRequest - INV_INPUT_PARAM_CONFLICT - FCWWNs and iSCSINames are both specified.
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_LENGTH - Host name, domain name, or iSCSI name is too long.
Raises:HTTPBadRequest - INV_INPUT_EMPTY_STR - Input string (for domain name, iSCSI name, etc.) is empty.
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Any error from host-name or domain-name parsing.
Raises:HTTPBadRequest - INV_INPUT_TOO_MANY_WWN_OR_iSCSI - More than 1024 WWNs or iSCSI names are specified.
Raises:HTTPBadRequest - INV_INPUT_WRONG_TYPE - The length of WWN is not 16. WWN specification contains non-hexadecimal digit.
Raises:HTTPConflict - EXISTENT_PATH - host WWN/iSCSI name already used by another host
Raises:HTTPConflict - EXISTENT_HOST - host name is already used.
Raises:HTTPBadRequest - NO_SPACE - No space to create host.
createHostSet(name, domain=None, comment=None, setmembers=None)[source]

This creates a new host set

Parameters:
  • name – the host set to create
  • domain (str) – the domain where the set lives
  • comment (str) – a comment for the host set
  • setmembers – the hosts to add to the host set, the existence

of the host will not be checked :type setmembers: list of str :returns: id of host set created :rtype: str

Raises:HTTPBadRequest - EXISTENT_SET - The set already exits.
Raises:HTTPConflict - MEMBER_IN_DOMAINSET - The host is in a domain set.
Raises:HTTPConflict - MEMBER_IN_SET - The object is already part of the set.
Raises:HTTPConflict - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.
Raises:HTTPNotFound - NON_EXISTENT_HOST - The host does not exists.
Raises:HTTPBadRequest - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
createQoSRules(targetName, qosRules, target_type=1)[source]

Create QOS rules

The QoS rule can be applied to VV sets. By using sys:all_others, you can apply the rule to all volumes in the system for which no QoS rule has been defined.

ioMinGoal and ioMaxLimit must be used together to set I/O limits. Similarly, bwMinGoalKB and bwMaxLimitKB must be used together.

If ioMaxLimitOP is set to 2 (no limit), ioMinGoalOP must also be to set to 2 (zero), and vice versa. They cannot be set to ‘none’ individually. Similarly, if bwMaxLimitOP is set to 2 (no limit), then bwMinGoalOP must also be set to 2.

If ioMaxLimitOP is set to 1 (no limit), ioMinGoalOP must also be to set to 1 (zero) and vice versa. Similarly, if bwMaxLimitOP is set to 1 (zero), then bwMinGoalOP must also be set to 1.

The ioMinGoalOP and ioMaxLimitOP fields take precedence over the ioMinGoal and ioMaxLimit fields.

The bwMinGoalOP and bwMaxLimitOP fields take precedence over the bwMinGoalKB and bwMaxLimitKB fields

Parameters:
  • target_type (enum) – Type of QoS target, either enum TARGET_TYPE_VVS or TARGET_TYPE_SYS.
  • targetName (str) – the name of the target object on which the QoS rule will be created.
  • qosRules (dict) – QoS options
qosRules = {
    'priority': 2,         # priority enum
    'bwMinGoalKB': 1024,   # bandwidth rate minimum goal in
                           #   kilobytes per second
    'bwMaxLimitKB': 1024,  # bandwidth rate maximum limit in
                           #   kilobytes per second
    'ioMinGoal': 10000,    # I/O-per-second minimum goal
    'ioMaxLimit': 2000000, # I/0-per-second maximum limit
    'enable': True,        # QoS rule for target enabled?
    'bwMinGoalOP': 1,      # zero none operation enum, when set to
                           #   1, bandwidth minimum goal is 0
                           # when set to 2, the bandwidth mimumum
                           #   goal is none (NoLimit)
    'bwMaxLimitOP': 1,     # zero none operation enum, when set to
                           #   1, bandwidth maximum limit is 0
                           # when set to 2, the bandwidth maximum
                           #   limit is none (NoLimit)
    'ioMinGoalOP': 1,      # zero none operation enum, when set to
                           #   1, I/O minimum goal is 0
                           # when set to 2, the I/O minimum goal is
                           #   none (NoLimit)
    'ioMaxLimitOP': 1,     # zero none operation enum, when set to
                           #   1, I/O maximum limit is 0
                           # when set to 2, the I/O maximum limit
                           #   is none (NoLimit)
    'latencyGoal': 5000,   # Latency goal in milliseconds
    'defaultLatency': False # Use latencyGoal or defaultLatency?
}
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_RANGE - Invalid input: number exceeds expected range.
Raises:HTTPNotFound - NON_EXISTENT_QOS_RULE - QoS rule does not exists.
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.
Raises:HTTPBadRequest - EXISTENT_QOS_RULE - QoS rule already exists.
Raises:HTTPBadRequest - INV_INPUT_MIN_GOAL_GRT_MAX_LIMIT - I/O-per-second maximum limit should be greater than the minimum goal.
Raises:HTTPBadRequest - INV_INPUT_BW_MIN_GOAL_GRT_MAX_LIMIT - Bandwidth maximum limit should be greater than the mimimum goal.
Raises:HTTPBadRequest - INV_INPUT_BELOW_RANGE - I/O-per-second limit is below range. Bandwidth limit is below range.
Raises:HTTPBadRequest - UNLICENSED_FEATURE - The system is not licensed for QoS.
createSnapshot(name, copyOfName, optional=None)[source]

Create a snapshot of an existing Volume.

Parameters:
  • name (str) – Name of the Snapshot
  • copyOfName (str) – The volume you want to snapshot
  • optional (dict) – Dictionary of optional params
optional = {
    'id': 12,                   # Specifies the ID of the volume,
                                # next by default
    'comment': "some comment",
    'readOnly': True,           # Read Only
    'expirationHours': 36,      # time from now to expire
    'retentionHours': 12        # time from now to expire
}
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
Raises:HTTPForbidden - PERM_DENIED - Permission denied
createSnapshotOfVolumeSet(name, copyOfName, optional=None)[source]

Create a snapshot of an existing Volume Set.

Parameters:
  • name (str) – Name of the Snapshot. The vvname pattern is described in “VV Name Patterns” in the HP 3PAR Command Line Interface Reference, which is available at the following website: http://www.hp.com/go/storage/docs
  • copyOfName (str) – The volume set you want to snapshot
  • optional (dict) – Dictionary of optional params
optional = {
    'id': 12,                   # Specifies ID of the volume set
                                # set, next by default
    'comment': "some comment",
    'readOnly': True,           # Read Only
    'expirationHours': 36,      # time from now to expire
    'retentionHours': 12        # time from now to expire
}
Raises:HTTPBadRequest - INVALID_INPUT_VV_PATTERN - Invalid volume pattern specified
Raises:HTTPNotFound - NON_EXISTENT_SET - The set does not exist
Raises:HTTPNotFound - EMPTY_SET - The set is empty
Raises:HTTPServiceUnavailable - VV_LIMIT_REACHED - Maximum number of volumes reached
Raises:HTTPNotFound - NON_EXISTENT_VOL - The storage volume does not exist
Raises:HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed
Raises:HTTPForbidden - INV_OPERATION_VV_READONLY_TO_READONLY_SNAP - Creating a read-only copy from a read-only volume is not permitted
Raises:HTTPConflict - NO_SNAP_CPG - No snapshot CPG has been configured for the volume
Raises:HTTPBadRequest - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
Raises:HTTPForbidden - INV_OPERATION_VV_SNAP_PARENT_SAME_BASE - Two parent snapshots share thesame base volume
Raises:HTTPConflict - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - Invalid operation. Online copyis in progress
Raises:HTTPServiceUnavailable - VV_ID_LIMIT_REACHED - Max number of volumeIDs has been reached
Raises:HTTPNotFound - NON_EXISTENT_VOLUME - The volume does not exists
Raises:HTTPForbidden - VV_IN_STALE_STATE - The volume is in a stale state.
Raises:HTTPForbidden - VV_NOT_STARTED - Volume is not started
Raises:HTTPForbidden - VV_UNAVAILABLE - The volume is not accessible
Raises:HTTPServiceUnavailable - SNAPSHOT_LIMIT_REACHED - Max number of snapshots has been reached
Raises:HTTPServiceUnavailable - CPG_ALLOCATION_WARNING_REACHED - The CPG has reached the allocation warning
Raises:HTTPConflict - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Invalid operation: VV conversion is in progress.
Raises:HTTPForbidden - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Internal volume cleanup is in progress.
Raises:HTTPForbidden - INV_OPERATION_VV_PEER_VOLUME - Cannot modify a peer volume.
Raises:HTTPConflict - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - The volume is the target of an online copy.
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - Illegal op on internal vol
Raises:HTTPConflict - EXISTENT_ID - An ID exists
Raises:HTTPForbidden - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - Volume state is not normal
Raises:HTTPForbidden - VV_IN_INCONSISTENT_STATE - Internal inconsistency error in vol
Raises:HTTPBadRequest - INV_INPUT_RETAIN_GT_EXPIRE - Retention time is greater than expiration time.
Raises:HTTPBadRequest - INV_INPUT_TIME - Invalid time specified.
Raises:HTTPForbidden - INV_OPERATION_SNAPSHOT_NOT_SAME_TYPE - Some snapshots in the volume set are read-only, some are read-write
createVLUN(volumeName, lun=None, hostname=None, portPos=None, noVcn=None, overrideLowerPriority=None, auto=False)[source]

Create a new VLUN.

When creating a VLUN, the volumeName is required. The lun member is not required if auto is set to True. Either hostname or portPos (or both in the case of matched sets) is also required. The noVcn and overrideLowerPriority members are optional.

Parameters:
  • volumeName (str) – Name of the volume to be exported
  • lun (int) – The new LUN id
  • hostname (str) – Name of the host which the volume is to be exported.
  • portPos (dict) – ‘portPos’ (dict) - System port of VLUN exported to. It includes node number, slot number, and card port number
portPos = {'node': 1,   # System node (0-7)
           'slot': 2,   # PCI bus slot in the node (0-5)
           'port': 1}   # Port number on the FC card (0-4)
Parameters:
  • noVcn (bool) – A VLUN change notification (VCN) not be issued after export (-novcn). Default: False.
  • overrideLowerPriority (bool) – Existing lower priority VLUNs will be overridden (-ovrd). Use only if hostname member exists. Default: False.
Returns:

the location of the VLUN

createVolume(name, cpgName, sizeMiB, optional=None)[source]

Create a new volume.

Parameters:
  • name (str) – the name of the volume
  • cpgName (str) – the name of the destination CPG
  • sizeMiB (int) – size in MiB for the volume
  • optional (dict) – dict of other optional items
optional = {
 'id': 12,                    # Volume ID. If not specified, next
                              # available is chosen
 'comment': 'some comment',   # Additional information up to 511
                              # characters
 'policies: {                 # Specifies VV policies
    'staleSS': False,         # True allows stale snapshots.
    'oneHost': True,          # True constrains volume export to
                              # single host or host cluster
    'zeroDetect': True,       # True requests Storage System to
                              # scan for zeros in incoming write
                              # data
    'system': False,          # True special volume used by system
                              # False is normal user volume
    'caching': True},         # Read-only. True indicates write &
                              # read caching & read ahead enabled
 'snapCPG': 'CPG name',       # CPG Used for snapshots
 'ssSpcAllocWarningPct': 12,  # Snapshot space allocation warning
 'ssSpcAllocLimitPct': 22,    # Snapshot space allocation limit
 'tpvv': True,                # True: Create TPVV
                              # False (default) Create FPVV
 'usrSpcAllocWarningPct': 22, # Enable user space allocation
                              # warning
 'usrSpcAllocLimitPct': 22,   # User space allocation limit
 'expirationHours': 256,      # Relative time from now to expire
                              # volume (max 43,800 hours)
 'retentionHours': 256        # Relative time from now to retain
                              # volume (max 43,800 hours)
}
Returns:List of Volumes
Raises:HTTPBadRequest - INV_INPUT - Invalid Parameter
Raises:HTTPBadRequest - TOO_LARGE - Volume size above limit
Raises:HTTPBadRequest - NO_SPACE - Not Enough space is available
Raises:HTTPForbidden - PERM_DENIED - Permission denied
Raises:HTTPConflict - EXISTENT_SV - Volume Exists already
createVolumeSet(name, domain=None, comment=None, setmembers=None)[source]

This creates a new volume set

Parameters:
  • name – the volume set to create
  • domain (str) – the domain where the set lives
  • comment (str) – the comment for on the vv set
  • setmembers – the vv to add to the set, the existence of the vv

will not be checked :type setmembers: array

Raises:HTTPBadRequest - EXISTENT_SET - The set already exits.
Raises:HTTPConflict - MEMBER_IN_DOMAINSET - The host is in a domain set.
Raises:HTTPConflict - MEMBER_IN_SET - The object is already part of the set.
Raises:HTTPConflict - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.
Raises:HTTPForbidden - VV_IN_INCONSISTENT_STATE - The volume has an internal inconsistency error.
Raises:HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed.
Raises:HTTPNotFound - NON_EXISTENT_VOLUME - The volume does not exists.
Raises:HTTPNotFound - NON_EXISTENT_HOST - The host does not exists.
Raises:HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - The operation is not allowed on a system volume.
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - The operation is not allowed on an internal volume.
Raises:HTTPBadRequest - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
debug_rest(flag)[source]

This is useful for debugging requests to 3PAR.

Parameters:flag (bool) – set to True to enable debugging
deleteCPG(name)[source]

Delete a CPG.

Parameters:name (str) – CPG Name
Raises:HTTPNotFound - NON_EXISTENT_CPG - CPG Not Found
Raises:HTTPForbidden - IN_USE - The CPG Cannot be removed because it’s in use.
Raises:HTTPForbidden - PERM_DENIED - Permission denied
deleteHost(name)[source]

Delete a Host.

Parameters:name (str) – Host Name
Raises:HTTPNotFound - NON_EXISTENT_HOST - HOST Not Found
Raises:HTTPForbidden - IN_USE - The HOST Cannot be removed because it’s in use.
Raises:HTTPForbidden - PERM_DENIED - Permission denied
deleteHostSet(name)[source]

This removes a host set.

Parameters:name (str) – the host set to remove
Raises:HTTPNotFound - NON_EXISTENT_SET - The set does not exists.
Raises:HTTPConflict - EXPORTED_VLUN - The host set has exported VLUNs.
deleteQoSRules(targetName, targetType='vvset')[source]

Clear and Delete QoS rules.

Parameters:
  • targetType (str) – target type is vvset or sys
  • targetName (str) – the name of the target. When targetType is sys, target name must be sys:all_others.
Raises:

HTTPNotFound - NON_EXISTENT_QOS_RULE - QoS rule does not exist.

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in the input

deleteVLUN(volumeName, lunID, hostname=None, port=None)[source]

Delete a VLUN.

Parameters:
  • volumeName – the volume name of the VLUN
  • lunID (int) – The LUN ID
  • hostname (str) – Name of the host which the volume is exported. For VLUN of port type,the value is empty
  • port (dict) – Specifies the system port of the VLUN export. It includes the system node number, PCI bus slot number, and card port number on the FC card in the format <node>:<slot>:<cardPort>
port = {'node': 1,   # System node (0-7)
        'slot': 2,   # PCI bus slot in the node (0-5)
        'port': 1}   # Port number on the FC card (0-4)
Raises:HTTPBadRequest - INV_INPUT_MISSING_REQUIRED - Incomplete VLUN info. Missing volumeName or lun, or both hostname and port.
Raises:HTTPBadRequest - INV_INPUT_PORT_SELECTION - Specified port is invalid.
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_RANGE - The LUN specified exceeds expected range.
Raises:HTTPNotFound - NON_EXISTENT_HOST - The host does not exist
Raises:HTTPNotFound - NON_EXISTENT_VLUN - The VLUN does not exist
Raises:HTTPNotFound - NON_EXISTENT_PORT - The port does not exist
Raises:HTTPForbidden - PERM_DENIED - Permission denied
deleteVolume(name)[source]

Delete a volume.

Parameters:name (str) – the name of the volume
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
Raises:HTTPForbidden - PERM_DENIED - Permission denied
Raises:HTTPForbidden - RETAINED - Volume retention time has not expired
Raises:HTTPForbidden - HAS_RO_CHILD - Volume has read-only child
Raises:HTTPConflict - HAS_CHILD - The volume has a child volume
Raises:HTTPConflict - IN_USE - The volume is in use by VV set, VLUN, etc
deleteVolumeSet(name)[source]

This removes a volume set. You must clear all QOS rules before a volume set can be deleted.

Parameters:name (str) – the volume set to remove
Raises:HTTPNotFound - NON_EXISTENT_SET - The set does not exists.
Raises:HTTPConflict - EXPORTED_VLUN - The host set has exported VLUNs. The VV set was exported.
Raises:HTTPConflict - VVSET_QOS_TARGET - The object is already part of the set.
findAllVolumeSets(name)[source]

Return a list of every Volume Set the given volume is a part of. The list can contain zero, one, or multiple items.

Parameters:name (str) – the volume name
Returns:a list of Volume Set dicts
vvset_names = [{
    'name': "volume_set_1",       # The name of the volume set
    'comment': 'Samplet VVSet',   # The volume set's comment
    'domain': 'my_domain',        # The volume set's domain
    'setmembers': ['V1', 'V2']    # List of strings containing
                                  # the volumes that are members
                                  # of this volume set
},
...
]
Raises:HTTPForbidden - VV_IN_INCONSISTENT_STATE - Internal inconsistency error in vol
Raises:HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed
Raises:HTTPNotFound - NON_EXISTENT_VOLUME - The volume does not exists
Raises:HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - Illegal op on system vol
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - Illegal op on internal vol
findHost(iqn=None, wwn=None)[source]

Find a host from an iSCSI initiator or FC WWN.

Parameters:
  • iqn (str) – lookup based on iSCSI initiator
  • wwn (str) – lookup based on WWN
findHostSet(name)[source]

Find the Host Set name for a host.

Parameters:name (str) – the host name
findVolumeMetaData(name, key, value)[source]

Determines whether a volume contains a specific key/value pair.

Parameters:
  • name (str) – the volume name
  • key (str) – the metadata key name
  • value (str) – the metadata value
Returns:

bool

findVolumeSet(name)[source]

Find the first Volume Set that contains a target volume. If a volume set other than the first one found is desired use findAllVolumeSets and search the results.

Parameters:name (str) – the volume name
Returns:The name of the first volume set that contains the target

volume, otherwise None.

getAllTasks()[source]

Get the list of all Tasks

Returns:list of all Tasks
getAllVolumeMetaData(name)[source]

This is used to get all key/value pair metadata from a volume.

Parameters:name (str) – the volume name
Returns:dict with all keys and associated data.
keys = {
    'total': 2,
    'members': [
        {
            # time of creation in seconds format
            'creationTimeSec': 1406074222
            # the date/time the key was added
            'date_added': 'Mon Jul 14 16:09:36 PDT 2014',
            'value': 'data'     # the value associated with the key
            'key': 'key_name'   # the key name
            # time of creation in date format
            'creationTime8601': '2014-07-22T17:10:22-07:00'
        },
        {
            # time of creation in seconds format
            'creationTimeSec': 1406074222
            # the date/time the key was added
            'date_added': 'Mon Jul 14 16:09:36 PDT 2014',
            'value': 'data'     # the value associated with the key
            'key': 'key_name_2' # the key name
            # time of creation in date format
            'creationTime8601': '2014-07-22T17:10:22-07:00'
        }
    ]
}
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
getCPG(name)[source]

Get information about a CPG.

Parameters:name (str) – The name of the CPG to find
Returns:cpg dict
Raises:HTTPNotFound - NON_EXISTENT_CPG - CPG doesn’t exist
getCPGAvailableSpace(name)[source]

Get available space information about a CPG.

Parameters:name (str) – The name of the CPG to find
Returns:Available space dict
info = {
    "rawFreeMiB": 1000000,    # Raw free capacity in MiB
    "usableFreeMiB": 5000     # LD free capacity in MiB
}
Raises:HTTPNotFound - NON_EXISTENT_CPG - CPG Not Found
getCPGStatData(name, interval='daily', history='7d')[source]

Requests CPG performance data at a sampling rate (interval) for a given length of time to sample (history)

Parameters:
  • name (str) – a valid CPG name
  • interval (str) – hourly, or daily
  • history (str) – xm for x minutes, xh for x hours, or xd for x days (e.g. 30m, 1.5h, 7d)
Returns:

dict

Raises:

SrstatldException - srstatld gives invalid output

getCPGs()[source]

Get entire list of CPGs.

Returns:list of cpgs
getFCPorts(state=None)[source]

Get a list of Fibre Channel Ports.

Returns:list of Fibre Channel Ports
getHost(name)[source]

Get information about a Host.

Parameters:name (str) – The name of the Host to find
Returns:host dict
Raises:HTTPNotFound - NON_EXISTENT_HOST - HOST doesn’t exist
getHostSet(name)[source]

Get information about a Host Set

Parameters:name (str) – The name of the Host Set to find
Returns:host set dict
Raises:HTTPNotFound - NON_EXISTENT_SET - The set does not exist
getHostSets()[source]

Get information about every Host Set on the 3Par array

Returns:list of Host Sets
getHostVLUNs(hostName)[source]

Get all of the VLUNs on a specific Host.

Parameters:hostName – Host name
Raises:HTTPNotFound - NON_EXISTENT_HOST - HOST Not Found
getHosts()[source]

Get information about every Host on the 3Par array.

Returns:list of Hosts
getIPPorts(state=None)[source]

Get a list of IP Ports.

Returns:list of IP Ports
getOverallSystemCapacity()[source]

Get the overall system capacity for the 3PAR server.

Returns:Dictionary of system capacity information
capacity = {
  "allCapacity": {                        # Overall system capacity
                                          # includes FC, NL, SSD
                                          # device types
    "totalMiB": 20054016,                 # Total system capacity
                                          # in MiB
    "allocated": {                        # Allocated space info
      "totalAllocatedMiB": 12535808,      # Total allocated
                                          # capacity
      "volumes": {                        # Volume capacity info
        "totalVolumesMiB": 10919936,      # Total capacity
                                          # allocated to volumes
        "nonCPGsMiB": 0,                  # Total non-CPG capacity
        "nonCPGUserMiB": 0,               # The capacity allocated
                                          # to non-CPG user space
        "nonCPGSnapshotMiB": 0,           # The capacity allocated
                                          # to non-CPG snapshot
                                          # volumes
        "nonCPGAdminMiB": 0,              # The capacity allocated
                                          # to non-CPG
                                          # administrative volumes
        "CPGsMiB": 10919936,              # Total capacity
                                          # allocated to CPGs
        "CPGUserMiB": 7205538,            # User CPG space
        "CPGUserUsedMiB": 7092550,        # The CPG allocated to
                                          # user space that is
                                          # in use
        "CPGUserUnusedMiB": 112988,       # The CPG allocated to
                                          # user space that is not
                                          # in use
        "CPGSnapshotMiB": 2411870,        # Snapshot CPG space
        "CPGSnapshotUsedMiB": 210256,     # CPG allocated to
                                          # snapshot that is in use
        "CPGSnapshotUnusedMiB": 2201614,  # CPG allocated to
                                          # snapshot space that is
                                          # not in use
        "CPGAdminMiB": 1302528,           # Administrative volume
                                          # CPG space
        "CPGAdminUsedMiB": 115200,        # The CPG allocated to
                                          # administrative space
                                          # that is in use
        "CPGAdminUnusedMiB": 1187328,     # The CPG allocated to
                                          # administrative space
                                          # that is not in use
        "unmappedMiB": 0                  # Allocated volume space
                                          # that is unmapped
      },
      "system": {                    # System capacity info
         "totalSystemMiB": 1615872,  # System space capacity
         "internalMiB": 780288,      # The system capacity
                                     # allocated to internal
                                     # resources
         "spareMiB": 835584,         # Total spare capacity
         "spareUsedMiB": 0,          # The system capacity
                                     # allocated to spare resources
                                     # in use
         "spareUnusedMiB": 835584    # The system capacity
                                     # allocated to spare resources
                                     # that are unused
        }
    },
      "freeMiB": 7518208,             # Free capacity
      "freeInitializedMiB": 7518208,  # Free initialized capacity
      "freeUninitializedMiB": 0,      # Free uninitialized capacity
      "unavailableCapacityMiB": 0,    # Unavailable capacity in MiB
      "failedCapacityMiB": 0          # Failed capacity in MiB
  },
  "FCCapacity": {   # System capacity from FC devices only
      ...           # Same structure as above
  },
  "NLCapacity": {   # System capacity from NL devices only
      ...           # Same structure as above
  },
  "SSDCapacity": {  # System capacity from SSD devices only
      ...           # Same structure as above
  }
}
getPatch(patch_id)[source]
Get details on a specified patch ID if it has been applied to the
system.
Parameters:patch_id – The ID of the patch.
Returns:list of str (raw lines of CLI output as strings)
getPatches(history=True)[source]

Get all the patches currently affecting the system.

Parameters:history – Specify the history of all patches and updates applied to the system.
Returns:dict with total and members (see convert_cli_output_to_collection_like_wsapi())
getPorts()[source]

Get the list of ports on the 3PAR.

Returns:list of Ports
getStorageSystemInfo()[source]

Get the Storage System Information

Returns:Dictionary of Storage System Info
getTask(taskId)[source]

Get the status of a task.

Parameters:taskId (int) – the task id
Returns:the status of the task
Raises:HTTPBadRequest - INV_INPUT_BELOW_RANGE - Bad Request Task ID must be a positive value.
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_RANGE - Bad Request Task ID is too large.
Raises:HTTPNotFound - NON_EXISTENT_TASK - Task with the specified task ID does not exist.
Raises:HTTPBadRequest - INV_INPUT_WRONG_TYPE - Task ID is not an integer.
getVLUN(volumeName)[source]

Get information about a VLUN.

Parameters:volumeName – The volume name of the VLUN to find
Returns:VLUN
Raises:HTTPNotFound - NON_EXISTENT_VLUN - VLUN doesn’t exist
getVLUNs()[source]

Get VLUNs.

Returns:Array of VLUNs
getVolume(name)[source]

Get information about a volume.

Parameters:name (str) – The name of the volume to find
Returns:volume
Raises:HTTPNotFound - NON_EXISTENT_VOL - volume doesn’t exist
getVolumeMetaData(name, key)[source]

This is used to get a key/value pair metadata from a volume.

Parameters:
  • name (str) – the volume name
  • key (str) – the metadata key name
Returns:

dict with the requested key’s data.

data = {
    # time of creation in seconds format
    'creationTimeSec': 1406074222
    # the date/time the key was added
    'date_added': 'Mon Jul 14 16:09:36 PDT 2014',
    'value': 'data'     # the value associated with the key
    'key': 'key_name'   # the key name
    # time of creation in date format
    'creationTime8601': '2014-07-22T17:10:22-07:00'
}
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in input
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
Raises:HTTPNotFound - NON_EXISTENT_OBJECT_KEY - Object key does not exist
getVolumeSet(name)[source]

Get information about a Volume Set

Parameters:name (str) – The name of the Volume Set to find
Returns:Volume Set
Raises:HTTPNotFound - NON_EXISTENT_SET - The set doesn’t exist
getVolumeSets()[source]

Get Volume Sets

Returns:Array of Volume Sets
getVolumeSnapshots(name)[source]

Shows all snapshots associated with a given volume.

Parameters:name (str) – The volume name
Returns:List of snapshot names
getVolumes()[source]

Get the list of Volumes

Returns:list of Volumes
getWSAPIConfigurationInfo()[source]

Get the WSAPI Configuration Information.

Returns:Dictionary of WSAPI configurations
getWsApiVersion()[source]

Get the 3PAR WS API version.

Returns:Version dict
getiSCSIPorts(state=None)[source]

Get a list of iSCSI Ports.

Returns:list of iSCSI Ports
growVolume(name, amount)[source]

Grow an existing volume by ‘amount’ Mebibytes.

Parameters:
  • name (str) – the name of the volume
  • amount (int) – the additional size in MiB to add, rounded up to the next chunklet size (e.g. 256 or 1000 MiB)
Raises:

HTTPForbidden - VV_NOT_IN_SAME_DOMAIN - The volume is not in the same domain.

Raises:

HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist.

Raises:

HTTPForbidden - INV_OPERATION_UNSUPPORTED_VV_TYPE - Invalid operation: Cannot grow this type of volume.

Raises:

HTTPConflict - INV_OPERATION_VV_TUNE_IN_PROGRESS - Invalid operation: Volume tuning is in progress.

Raises:

HTTPBadRequest - INV_INPUT_EXCEEDS_LENGTH - Invalid input: String length exceeds limit.

Raises:

HTTPBadRequest - INV_INPUT_VV_GROW_SIZE - Invalid grow size.

Raises:

HTTPForbidden - VV_NEW_SIZE_EXCEEDS_CPG_LIMIT - New volume size exceeds CPG limit

Raises:

HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - This operation is not allowed on an internal volume.

Raises:

HTTPConflict - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Invalid operation: VV conversion is in progress.

Raises:

HTTPConflict - INV_OPERATION_VV_VOLUME_COPY_IN_PROGRESS - Invalid operation: online copy is in progress.

Raises:

HTTPForbidden - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Internal volume cleanup is in progress.

Raises:

HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed.

Raises:

HTTPForbidden - VV_IN_INCONSISTENT_STATE - The volume has an internal consistency error.

Raises:

HTTPForbidden - VV_SIZE_CANNOT_REDUCE - New volume size is smaller than the current size.

Raises:

HTTPForbidden - VV_NEW_SIZE_EXCEEDS_LIMITS - New volume size exceeds the limit.

Raises:

HTTPConflict - INV_OPERATION_VV_SA_SD_SPACE_REMOVED - Invalid operation: Volume SA/SD space is being removed.

Raises:

HTTPConflict - INV_OPERATION_VV_IS_BUSY - Invalid operation: Volume is currently busy.

Raises:

HTTPForbidden - VV_NOT_STARTED - Volume is not started.

Raises:

HTTPConflict - INV_OPERATION_VV_IS_PCOPY - Invalid operation: Volume is a physical copy.

Raises:

HTTPForbidden - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - Volume state is not normal

Raises:

HTTPConflict - INV_OPERATION_VV_PROMOTE_IN_PROGRESS - Invalid operation: Volume promotion is in progress.

Raises:

HTTPConflict - INV_OPERATION_VV_PARENT_OF_PCOPY - Invalid operation: Volume is the parent of physical copy.

Raises:

HTTPBadRequest - NO_SPACE - Insufficent space for requested operation.

isOnlinePhysicalCopy(name)[source]

Is the volume being created by process of online copy?

Parameters:name (str) – the name of the volume
login(username, password, optional=None)[source]
This authenticates against the 3PAR wsapi server and creates a
session.
Parameters:
  • username (str) – The username
  • password (str) – The Password
Returns:

None

logout()[source]
This destroys the session and logs out from the 3PAR server.
The SSH connection to the 3PAR server is also closed.
Returns:None
modifyHost(name, mod_request)[source]

Modify an existing Host entry.

Parameters:
  • name (str) – The name of the host
  • mod_request (dict) – Objects for Host Modification Request
mod_request = {
    'newName': 'myNewName',         # New name of the host
    'pathOperation': 1,             # If adding, adds the WWN or
                                    # iSCSI name to the existing
                                    # host.
    'FCWWNs': [],                   # One or more WWN to set for
                                    # the host.
    'iSCSINames': [],               # One or more iSCSI names to
                                    # set for the host.
    'forcePathRemoval': False,      # If True, remove SSN(s) or
                                    # iSCSI(s) even if there are
                                    # VLUNs exported to host
    'persona': 1,                   # ID of the persona to modify
                                    # the host's persona to.
    'descriptors':
        {'location': 'earth',       # The host's location
         'IPAddr': '10.10.10.10',   # The host's IP address
         'os': 'linux',             # The operating system running
                                    # on the host.
         'model': 'ex',             # The host's model
         'contact': 'Smith',        # The host's owner and contact
         'comment': 'Joes box'}     # Additional host information
    'chapOperation': HOST_EDIT_ADD, # Add or remove
    'chapOperationMode': CHAP_INITIATOR, # Initator or target
    'chapName': 'MyChapName',       # The chap name
    'chapSecret': 'xyz',            # The chap secret for the host
                                    # or the target
    'chapSecretHex': False,         # If True, the chapSecret is
                                    # treated as Hex.
    'chapRemoveTargetOnly': True    # If True, then remove target
                                    # chap only
}
Raises:HTTPBadRequest - INV_INPUT - Missing host name.
Raises:HTTPBadRequest - INV_INPUT_PARAM_CONFLICT - Both iSCSINames & FCWWNs are specified. (lot of other possibilities)
Raises:HTTPBadRequest - INV_INPUT_ONE_REQUIRED - iSCSINames or FCWwns missing.
Raises:HTTPBadRequest - INV_INPUT_ONE_REQUIRED - No path operation specified.
Raises:HTTPBadRequest - INV_INPUT_BAD_ENUM_VALUE - Invalid enum value.
Raises:HTTPBadRequest - INV_INPUT_MISSING_REQUIRED - Required fields missing.
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_LENGTH - Host descriptor argument length, new host name, or iSCSI name is too long.
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Error parsing host or iSCSI name.
Raises:HTTPConflict - EXISTENT_HOST - New host name is already used.
Raises:HTTPNotFound - NON_EXISTENT_HOST - Host to be modified does not exist.
Raises:HTTPBadRequest - INV_INPUT_TOO_MANY_WWN_OR_iSCSI - More than 1024 WWNs or iSCSI names are specified.
Raises:HTTPBadRequest - INV_INPUT_WRONG_TYPE - Input value is of the wrong type.
Raises:HTTPConflict - EXISTENT_PATH - WWN or iSCSI name is already claimed by other host.
Raises:HTTPBadRequest - INV_INPUT_BAD_LENGTH - CHAP hex secret length is not 16 bytes, or chap ASCII secret length is not 12 to 16 characters.
Raises:HTTPNotFound - NO_INITIATOR_CHAP - Setting target CHAP without initiator CHAP.
Raises:HTTPNotFound - NON_EXISTENT_CHAP - Remove non-existing CHAP.
Raises:HTTPConflict - NON_UNIQUE_CHAP_SECRET - CHAP secret is not unique.
Raises:HTTPConflict - EXPORTED_VLUN - Setting persona with active export; remove a host path on an active export.
Raises:HTTPBadRequest - NON_EXISTENT_PATH - Remove a non-existing path.
Raises:HTTPConflict - LUN_HOSTPERSONA_CONFLICT - LUN number and persona capability conflict.
Raises:HTTPBadRequest - INV_INPUT_DUP_PATH - Duplicate path specified.
modifyHostSet(name, action=None, newName=None, comment=None, setmembers=None)[source]

This modifies a host set by adding or removing a hosts from the set. It’s action is based on the enums SET_MEM_ADD or SET_MEM_REMOVE.

Parameters:
  • name (str) – the host set name
  • action (enum) – add or remove host(s) from the set
  • newName (str) – new name of set
  • comment (str) – new comment for the set
  • setmembers (list str) – the host(s) to add to the set, the existence of the host(s) will not be checked
Returns:

headers - dict of HTTP Response headers. Upon successful modification of a host set HTTP code 200 OK is returned and the URI of the updated host set will be returned in the location portion of the headers.

Returns:

body - the body of the response. None if successful.

Raises:

HTTPBadRequest - EXISTENT_SET - The set already exits.

Raises:

HTTPNotFound - NON_EXISTENT_SET - The set does not exists.

Raises:

HTTPConflict - MEMBER_IN_DOMAINSET - The host is in a domain set.

Raises:

HTTPConflict - MEMBER_IN_SET - The object is already part of the set.

Raises:

HTTPNotFound - MEMBER_NOT_IN_SET - The object is not part of the set.

Raises:

HTTPConflict - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.

Raises:

HTTPBadRequest - INV_INPUT_DUP_NAME - Invalid input (duplicate name).

Raises:

HTTPBadRequest - INV_INPUT_PARAM_CONFLICT - Invalid input (parameters cannot be present at the same time).

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Invalid contains one or more illegal characters.

modifyQoSRules(targetName, qosRules, targetType='vvset')[source]

Modify an existing QOS rules

The QoS rule can be applied to VV sets. By using sys:all_others, you can apply the rule to all volumes in the system for which no QoS rule has been defined.

ioMinGoal and ioMaxLimit must be used together to set I/O limits. Similarly, bwMinGoalKB and bwMaxLimitKB must be used together.

If ioMaxLimitOP is set to 2 (no limit), ioMinGoalOP must also be to set to 2 (zero), and vice versa. They cannot be set to ‘none’ individually. Similarly, if bwMaxLimitOP is set to 2 (no limit), then bwMinGoalOP must also be set to 2.

If ioMaxLimitOP is set to 1 (no limit), ioMinGoalOP must also be to set to 1 (zero) and vice versa. Similarly, if bwMaxLimitOP is set to 1 (zero), then bwMinGoalOP must also be set to 1.

The ioMinGoalOP and ioMaxLimitOP fields take precedence over the ioMinGoal and ioMaxLimit fields.

The bwMinGoalOP and bwMaxLimitOP fields take precedence over the bwMinGoalKB and bwMaxLimitKB fields

Parameters:
  • targetName (str) – the name of the target object on which the QoS rule will be created.
  • targetType (str) – Type of QoS target, either vvset or sys
  • qosRules (dict) – QoS options
qosRules = {
    'priority': 2,         # priority enum
    'bwMinGoalKB': 1024,   # bandwidth rate minimum goal in
                           # kilobytes per second
    'bwMaxLimitKB': 1024,  # bandwidth rate maximum limit in
                           # kilobytes per second
    'ioMinGoal': 10000,    # I/O-per-second minimum goal.
    'ioMaxLimit': 2000000, # I/0-per-second maximum limit
    'enable': True,        # QoS rule for target enabled?
    'bwMinGoalOP': 1,      # zero none operation enum, when set to
                           # 1, bandwidth minimum goal is 0
                           # when set to 2, the bandwidth minimum
                           # goal is none (NoLimit)
    'bwMaxLimitOP': 1,     # zero none operation enum, when set to
                           # 1, bandwidth maximum limit is 0
                           # when set to 2, the bandwidth maximum
                           # limit is none (NoLimit)
    'ioMinGoalOP': 1,      # zero none operation enum, when set to
                           # 1, I/O minimum goal minimum goal is 0
                           # when set to 2, the I/O minimum goal is
                           # none (NoLimit)
    'ioMaxLimitOP': 1,     # zero none operation enum, when set to
                           # 1, I/O maximum limit is 0
                           # when set to 2, the I/O maximum limit
                           # is none (NoLimit)
    'latencyGoal': 5000,   # Latency goal in milliseconds
    'defaultLatency': False # Use latencyGoal or defaultLatency?
}
Raises:HTTPBadRequest INV_INPUT_EXCEEDS_RANGE - Invalid input: number exceeds expected range.
Raises:HTTPNotFound NON_EXISTENT_QOS_RULE - QoS rule does not exists.
Raises:HTTPBadRequest INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.
Raises:HTTPBadRequest EXISTENT_QOS_RULE - QoS rule already exists.
Raises:HTTPBadRequest INV_INPUT_IO_MIN_GOAL_GRT_MAX_LIMIT - I/O-per-second maximum limit should be greater than the minimum goal.
Raises:HTTPBadRequest INV_INPUT_BW_MIN_GOAL_GRT_MAX_LIMIT - Bandwidth maximum limit should be greater than the minimum goal.
Raises:HTTPBadRequest INV_INPUT_BELOW_RANGE - I/O-per-second limit is below range. Bandwidth limit is below range.
Raises:HTTPBadRequest UNLICENSED_FEATURE - The system is not licensed for QoS.
modifyVolume(name, volumeMods)[source]

Modify a volume.

Parameters:
  • name (str) – the name of the volume
  • volumeMods (dict) – dictionary of volume attributes to change
volumeMods = {
 'newName': 'newName',         # New volume name
 'comment': 'some comment',    # New volume comment
 'snapCPG': 'CPG name',        # Snapshot CPG name
 'policies: {                  # Specifies VV policies
    'staleSS': False,          # True allows stale snapshots.
    'oneHost': True,           # True constrains volume export to
                               # single host or host cluster
    'zeroDetect': True,        # True requests Storage System to
                               # scan for zeros in incoming write
                               # data
    'system': False,           # True special volume used by system
                               # False is normal user volume
    'caching': True},          # Read-only. True indicates write &
                               # read caching & read ahead enabled
 'ssSpcAllocWarningPct': 12,   # Snapshot space allocation warning
 'ssSpcAllocLimitPct': 22,     # Snapshot space allocation limit
 'tpvv': True,                 # True: Create TPVV
                               # False: (default) Create FPVV
 'usrSpcAllocWarningPct': 22,  # Enable user space allocation
                               # warning
 'usrSpcAllocLimitPct': 22,    # User space allocation limit
 'userCPG': 'User CPG name',   # User CPG name
 'expirationHours': 256,       # Relative time from now to expire
                               # volume (max 43,800 hours)
 'retentionHours': 256,        # Relative time from now to retain
                               # volume (max 43,800 hours)
 'rmSsSpcAllocWarning': False, # True removes snapshot space
                               # allocation warning.
                               # False sets it when value > 0
 'rmUsrSpcAllocWarwaning': False, # True removes user space
                               #  allocation warning.
                               # False sets it when value > 0
 'rmExpTime': False,           # True resets expiration time to 0.
                               # False sets it when value > 0
 'rmSsSpcAllocLimit': False,   # True removes snapshot space
                               # allocation limit.
                               # False sets it when value > 0
 'rmUsrSpcAllocLimit': False   # True removes user space
                               # allocation limit.
                               # False sets it when value > 0
}
Raises:HTTPBadRequest - INV_INPUT_WARN_GT_LIMIT - Allocation warning level is higher than the limit.
Raises:HTTPBadRequest - INV_INPUT_USR_ALRT_NON_TPVV - User space allocation alerts are valid only with a TPVV.
Raises:HTTPBadRequest - INV_INPUT_RETAIN_GT_EXPIRE - Retention time is greater than expiration time.
Raises:HTTPBadRequest - INV_INPUT_VV_POLICY - Invalid policy specification (for example, caching or system is set to true).
Raises:HTTPBadRequest - INV_INPUT_EXCEEDS_LENGTH - Invalid input: string length exceeds limit.
Raises:HTTPBadRequest - INV_INPUT_TIME - Invalid time specified.
Raises:HTTPForbidden - INV_OPERATION_VV_MODIFY_USR_CPG_TPVV - usr_cpg cannot be modified on a TPVV.
Raises:HTTPBadRequest - UNLICENSED_FEATURE - Retention time cannot be modified on a system without the Virtual Lock license.
Raises:HTTPForbidden - CPG_NOT_IN_SAME_DOMAIN - Snap CPG is not in the same domain as the user CPG.
Raises:HTTPForbidden - INV_OPERATION_VV_PEER_VOLUME - Cannot modify a peer volume.
Raises:HTTPInternalServerError - INT_SERV_ERR - Metadata of the VV is corrupted.
Raises:HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - Cannot modify retention time on a system volume.
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - Cannot modify an internal volume
Raises:HTTPConflict - INV_OPERATION_VV_VOLUME_NOT_DEFINED_ALL_NODES - Cannot modify a volume until the volume is defined on all volumes.
Raises:HTTPConflict - INVALID_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - Cannot modify a volume when an online copy for that volume is in progress.
Raises:HTTPConflict - INVALID_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Cannot modify a volume in the middle of a conversion operation.
Raises:HTTPConflict - INVALID_OPERATION_VV_SNAPSPACE_NOT_MOVED_TO_CPG - Snapshot space of a volume needs to be moved to a CPG before the user space.
Raises:HTTPConflict - INV_OPERATION_VV_VOLUME_ACCOUNTING_IN_PROGRESS - The volume cannot be renamed until snapshot accounting has finished.
Raises:HTTPForbidden - INV_OPERATION_VV_ZERO_DETECT_TPVV - The zero_detect policy can be used only on TPVVs.
Raises:HTTPConflict - INV_OPERATION_VV_CPG_ON_SNAPSHOT - CPG cannot be assigned to a snapshot.
modifyVolumeSet(name, action=None, newName=None, comment=None, flashCachePolicy=None, setmembers=None)[source]

This modifies a volume set by adding or remove a volume from the volume set. It’s actions is based on the enums SET_MEM_ADD or SET_MEM_REMOVE.

Parameters:
  • action (enum) – add or remove volume from the set
  • name (str) – the volume set name
  • newName (str) – new name of set
  • comment (FLASH_CACHED_ENABLED or FLASH_CACHE_DISABLED) – the comment for on the vv set
  • flashCachePolicy – the flash-cache policy for the vv set
  • setmembers (array) – the vv to add to the set, the existence of the vv will not be checked
Raises:

HTTPBadRequest - EXISTENT_SET - The set already exits.

Raises:

HTTPNotFound - NON_EXISTENT_SET - The set does not exists.

Raises:

HTTPConflict - MEMBER_IN_DOMAINSET - The host is in a domain set.

Raises:

HTTPConflict - MEMBER_IN_SET - The object is already part of the set.

Raises:

HTTPNotFound - MEMBER_NOT_IN_SET - The object is not part of the set.

Raises:

HTTPConflict - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.

Raises:

HTTPForbidden - VV_IN_INCONSISTENT_STATE - The volume has an internal inconsistency error.

Raises:

HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed.

Raises:

HTTPNotFound - NON_EXISTENT_VOLUME - The volume does not exists.

Raises:

HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - The operation is not allowed on a system volume.

Raises:

HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - The operation is not allowed on an internal volume.

Raises:

HTTPBadRequest - INV_INPUT_DUP_NAME - Invalid input (duplicate name).

Raises:

HTTPBadRequest - INV_INPUT_PARAM_CONFLICT - Invalid input (parameters cannot be present at the same time).

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Invalid contains one or more illegal characters.

queryHost(iqns=None, wwns=None)[source]

Find a host from an iSCSI initiator or FC WWN.

Parameters:
  • iqns (list) – lookup based on iSCSI initiator list
  • wwns (list) – lookup based on WWN list
Raises:

HTTPBadRequest - INV_INPUT - Invalid URI syntax.

Raises:

HTTPNotFound - NON_EXISTENT_HOST - HOST Not Found

Raises:

HTTPInternalServerError - INTERNAL_SERVER_ERR - Internal server error.

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Host name contains invalid character.

queryQoSRule(targetName, targetType='vvset')[source]

Query a QoS rule

Parameters:
  • targetType (str) – target type is vvset or sys
  • targetName (str) – the name of the target. When targetType is sys, target name must be sys:all_others.
Raises:

HTTPNotFound - NON_EXISTENT_QOS_RULE - QoS rule does not exist.

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.

queryQoSRules()[source]

Get QoS Rules

Returns:Array of QoS Rules
removeHostFromHostSet(set_name, name)[source]

Remove a host from a host set.

Parameters:
  • set_name (str) – the host set name
  • name (str) – the host name to remove
Returns:

headers - dict of HTTP Response headers. Upon successful modification of a host set HTTP code 200 OK is returned and the URI of the updated host set will be returned in the location portion of the headers.

Returns:

body - the body of the response. None if successful.

removeHostFromItsHostSet(name)[source]

Remove a host from its host set if it is a member of one.

Parameters:name (str) – the host name to remove
Returns:None if host has no host set, else (headers, body)
Returns:headers - dict of HTTP Response headers. Upon successful modification of a host set HTTP code 200 OK is returned and the URI of the updated host set will be returned in the location portion of the headers.
Returns:body - the body of the response. None if successful.
removeVolumeFromVolumeSet(set_name, name)[source]

Remove a volume from a volume set

Parameters:
  • set_name (str) – the volume set name
  • name (str) – the volume name to add
removeVolumeMetaData(name, key)[source]

This is used to remove a metadata key/value pair from a volume.

Parameters:
  • name (str) – the volume name
  • key (str) – the metadata key name
Returns:

None

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in input

Raises:

HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist

Raises:

HTTPNotFound - NON_EXISTENT_OBJECT_KEY - Object key does not exist

setQOSRule(set_name, max_io=None, max_bw=None)[source]

Set a QOS Rule on a volume set

Parameters:
  • set_name (str) – the volume set name for the rule.
  • max_io (int) – the maximum IOPS value
  • max_bw – The maximum Bandwidth
setSSHOptions(ip, login, password, port=22, conn_timeout=None, privatekey=None, **kwargs)[source]

Set SSH Options for ssh calls.

This is used to set the SSH credentials for calls that use SSH instead of REST HTTP.

setVolumeMetaData(name, key, value)[source]

This is used to set a key/value pair metadata into a volume. If the key already exists on the volume the value will be updated.

Parameters:
  • name (str) – the volume name
  • key (str) – the metadata key name
  • value (str) – the metadata value
Raises:

HTTPBadRequest - INV_INPUT_EXCEEDS_LENGTH - Invalid input: string length exceeds limit.

Raises:

HTTPBadRequest - INV_INPUT_MISSING_REQUIRED - Required fields missing

Raises:

HTTPBadRequest - INV_INPUT_UNREC_NAME - Unrecognized name

Raises:

HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Illegal character in input

Raises:

HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist

stopOfflinePhysicalCopy(name)[source]

Stopping a offline physical copy operation.

Parameters:name (str) – the name of the volume
Raises:HTTPBadRequest - INV_INPUT_ILLEGAL_CHAR - Invalid VV name or CPG name.
Raises:HTTPNotFound - NON_EXISTENT_CPG - The CPG does not exists.
Raises:HTTPForbidden - CPG_NOT_IN SAME_DOMAIN - The CPG is not in the current domain.
Raises:HTTPNotFound - NON_EXISTENT_VOL - The volume does not exist
Raises:HTTPForbidden - VV_NOT_IN_SAME_DOMAIN - The volume is not in the same domain.
Raises:HTTPBadRequest - INV_INPUT_BAD_ENUM_VALUE - The priority value in not in the valid range(1-3).
Raises:HTTPConflict - EXISTENT_VOLUME - The volume already exists.
Raises:HTTPForbidden - INV_OPERATION_VV_SYS_VOLUME - The operation is not allowed on a system volume.
Raises:HTTPForbidden - INV_OPERATION_NON_BASE_VOLUME - The destination volume is not a base volume.
Raises:HTTPForbidden - INV_OPERATION_IN_REMOTE_COPY - The destination volume is involved in a remote copy.
Raises:HTTPForbidden - INV_OPERATION_VV_EXPORTED - The volume is exported.
Raises:HTTPForbidden - INV_OPERATION_VV_COPY_TO_SELF - The destination volume is the same as the parent.
Raises:HTTPForbidden - INV_OPERATION_VV_READONLY_SNAPSHOT - The parent volume is a read-only snapshot.
Raises:HTTPForbidden - INV_OPERATION_VV_COPY_TO_BASE - The destination volume is the base volume of a parent volume.
Raises:HTTPConflict - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - The volume is in a conversion operation.
Raises:HTTPForbidden - INV_OPERATION_VV_NO_SNAPSHOT_ALLOWED - The parent volume must allow snapshots.
Raises:HTTPConflict - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - The volume is the target of an online copy.
Raises:HTTPForbidden - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Cleanup of internal volume for the volume is in progress.
Raises:HTTPForbidden - INV_OPERATION_VV_CIRCULAR_COPY - The parent volume is a copy of the destination volume.
Raises:HTTPForbidden - INV_OPERATION_VV_PEER_VOLUME - The operation is not allowed on a peer volume.
Raises:HTTPForbidden - INV_OPERATION_VV_INTERNAL_VOLUME - The operation is not allowed on an internal volume.
Raises:HTTPForbidden - VV_IS_BEING_REMOVED - The volume is being removed.
Raises:HTTPForbidden - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - The volume is not in the normal state.
Raises:HTTPForbidden - VV_IN_INCONSISTENT_STATE - The volume has an internal consistency error.
Raises:HTTPConflict - INV_OPERATION_VV_PCOPY_IN_PROGRESS - The destination volume has a physical copy in progress.
Raises:HTTPConflict - INV_OPERATION_VV_FAILED_ONLINE_COPY - Online copying of the destination volume has failed.
Raises:HTTPConflict - INV_OPERATION_VV_COPY_PARENT_TOO_BIG - The size of the parent volume is larger than the size of the destination volume.
Raises:HTTPForbidden - INV_OPERATION_VV_NO_PARENT - The volume has no physical parent.
Raises:HTTPConflict - IN_USE - The resynchronization snapshot is in a stale state.
Raises:HTTPForbidden - VV_IN_STALE_STATE - The volume is in a stale state.
Raises:HTTPNotFound - NON_EXISTENT_VVCOPY - Physical copy not found.
stopOnlinePhysicalCopy(name)[source]

Stopping a online physical copy operation.

Parameters:name (str) – the name of the volume

exceptions Module

Exceptions for the client

Author:Walter A. Boring IV
Description:This contains the HTTP exceptions that can come back from the REST calls to 3PAR
exception hp3parclient.exceptions.AuthorizationFailure[source]

Bases: exceptions.Exception

exception hp3parclient.exceptions.ClientException(error=None)[source]

Bases: exceptions.Exception

The base exception class for all exceptions this library raises.

Parameters:error (array) – The error array
get_code()[source]
get_description()[source]
get_ref()[source]
exception hp3parclient.exceptions.CommandError[source]

Bases: exceptions.Exception

exception hp3parclient.exceptions.ConnectionError(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

There was an error connecting to the server

exception hp3parclient.exceptions.CopyVolumeException(message=None, **kwargs)[source]

Bases: hp3parclient.exceptions.SSHException

message = 'SSH copy volume failed: %(command)s'
exception hp3parclient.exceptions.GrowVolumeException(message=None, **kwargs)[source]

Bases: hp3parclient.exceptions.SSHException

message = 'SSH grow volume failed: %(command)s'
exception hp3parclient.exceptions.HTTPBadGateway(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 502 - The server was acting as a gateway or proxy and received an
invalid response from the upstream server.
http_status = 502
message = 'Bad Gateway'
exception hp3parclient.exceptions.HTTPBadRequest(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 400 - Bad request: you sent some malformed data.

http_status = 400
message = 'Bad request'
exception hp3parclient.exceptions.HTTPConflict(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 409 - Conflict: A Conflict happened on the server

http_status = 409
message = 'Conflict'
exception hp3parclient.exceptions.HTTPError(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

An HTTP error occurred

exception hp3parclient.exceptions.HTTPExpectationFailed(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 417 - The server cannot meet the requirements of the Expect
request-header field.
http_status = 417
message = 'Expectation Failed'
exception hp3parclient.exceptions.HTTPForbidden(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 403 - Forbidden: your credentials don’t give you access to this resource.

http_status = 403
message = 'Forbidden'
exception hp3parclient.exceptions.HTTPGatewayTimeout(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 504 - The server was acting as a gateway or proxy and did
not receive a timely response from the upstream server.
http_status = 504
message = 'Gateway Timeout'
exception hp3parclient.exceptions.HTTPGone(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 410 - Indicates that the resource requested is no longer available and
will not be available again.
http_status = 410
message = 'Gone'
exception hp3parclient.exceptions.HTTPInternalServerError(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 500 - Internal Server Error: an internal error occured.

http_status = 500
message = 'Internal Server Error'
exception hp3parclient.exceptions.HTTPLengthRequired(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 411 - The request did not specify the length of its content, which is
required by the requested resource.
http_status = 411
message = 'Length Required'
exception hp3parclient.exceptions.HTTPMethodNotAllowed(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 405 - Method not Allowed

http_status = 405
message = 'Method Not Allowed'
exception hp3parclient.exceptions.HTTPNotAcceptable(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 406 - Method not Acceptable

http_status = 406
message = 'Method Not Acceptable'
exception hp3parclient.exceptions.HTTPNotFound(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 404 - Not found

http_status = 404
message = 'Not found'
exception hp3parclient.exceptions.HTTPNotImplemented(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 501 - Not Implemented: the server does not support this operation.

http_status = 501
message = 'Not Implemented'
exception hp3parclient.exceptions.HTTPPreconditionFailed(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 412 - The server does not meet one of the preconditions that the
requester put on the request.
http_status = 412
message = 'Over limit'
exception hp3parclient.exceptions.HTTPProxyAuthRequired(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 407 - The client must first authenticate itself with the proxy.

http_status = 407
message = 'Proxy Authentication Required'
exception hp3parclient.exceptions.HTTPRequestEntityTooLarge(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 413 - The request is larger than the server is willing or able to
process
http_status = 413
message = 'Request Entity Too Large'
exception hp3parclient.exceptions.HTTPRequestTimeout(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 408 - The server timed out waiting for the request.

http_status = 408
message = 'Request Timeout'
exception hp3parclient.exceptions.HTTPRequestURITooLong(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 414 - The URI provided was too long for the server to process.

http_status = 414
message = 'Request URI Too Large'
exception hp3parclient.exceptions.HTTPRequestedRangeNotSatisfiable(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 416 - The client has asked for a portion of the file, but the server
cannot supply that portion.
http_status = 416
message = 'Requested Range Not Satisfiable'
exception hp3parclient.exceptions.HTTPServiceUnavailable(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 503 - The server is currently unavailable

http_status = 503
message = 'Service Unavailable'
exception hp3parclient.exceptions.HTTPTeaPot(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 418 - I’m a Tea Pot

http_status = 418
message = "I'm A Teapot. (RFC 2324)"
exception hp3parclient.exceptions.HTTPUnauthorized(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 401 - Unauthorized: bad credentials.

http_status = 401
message = 'Unauthorized'
exception hp3parclient.exceptions.HTTPUnsupportedMediaType(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 415 - The request entity has a media type which the server or resource
does not support.
http_status = 415
message = 'Unsupported Media Type'
exception hp3parclient.exceptions.HTTPVersionNotSupported(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

HTTP 505 - The server does not support the HTTP protocol version used
in the request.
http_status = 505
message = 'Version Not Supported'
exception hp3parclient.exceptions.NoUniqueMatch[source]

Bases: exceptions.Exception

exception hp3parclient.exceptions.ProcessExecutionError(stdout=None, stderr=None, exit_code=None, cmd=None, description=None)[source]

Bases: exceptions.Exception

exception hp3parclient.exceptions.RequestException(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

There was an ambiguous exception that occurred in Requests

exception hp3parclient.exceptions.SSHException(message=None, **kwargs)[source]

Bases: exceptions.Exception

This is the basis for the SSH Exceptions.

code = 500
message = 'An unknown exception occurred.'
exception hp3parclient.exceptions.SSHInjectionThreat(message=None, **kwargs)[source]

Bases: hp3parclient.exceptions.SSHException

message = 'SSH command injection detected: %(command)s'
exception hp3parclient.exceptions.SSLCertFailed(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

The SSL certificate from the server could not be verified

http_status = ''
message = 'SSL Certificate Verification Failed'
exception hp3parclient.exceptions.SetQOSRuleException(message=None, **kwargs)[source]

Bases: hp3parclient.exceptions.SSHException

message = 'SSH set QOS rule failed: %(command)s'
exception hp3parclient.exceptions.SrstatldException(message=None, **kwargs)[source]

Bases: hp3parclient.exceptions.SSHException

message = 'SSH command failed: %(command)s'
exception hp3parclient.exceptions.Timeout(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

The request timed out

exception hp3parclient.exceptions.TooManyRedirects(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

Too many redirects

exception hp3parclient.exceptions.URLRequired(error=None)[source]

Bases: hp3parclient.exceptions.ClientException

A valid URL is required to make a request

exception hp3parclient.exceptions.UnsupportedVersion[source]

Bases: exceptions.Exception

Indicates that the user is trying to use an unsupported version of the API

hp3parclient.exceptions.from_response(response, body)[source]

Return an instance of an ClientException or subclass based on a Python Requests response.

Usage:

resp, body = http.request(...)
if resp.status != 200:
    raise exception_from_response(resp, body)

file_client Module

HP3PAR File Persona Client

Author:Mark Sturdevant
Description:Client for 3PAR File Persona. This module provides a client for File Persona functionality. The File Persona client requires 3PAR InForm 3.2.1 (MU3) with File Persona capability. This client extends the regular 3PAR client.
class hp3parclient.file_client.HP3ParFilePersonaClient(api_url, secure=False)[source]

Bases: hp3parclient.client.HP3ParClient

The 3PAR File Persona Client.

The File Persona client requires 3PAR InForm 3.2.1 (MU3) with File Persona capability

Parameters:api_url (str) – The url to the WSAPI service on 3PAR ie. http://<3par server>:8080/api/v1
HP3PAR_WS_MIN_BUILD_VERSION = 30201256
HP3PAR_WS_MIN_BUILD_VERSION_DESC = '3.2.1 (MU3)'
createfpg(*args, **kwargs)[source]

Create a file provisioning group.

The createfpg command creates a file provisioning group of the given name and size within the specified cpg.

For this command MB = 1048576 bytes, GB = 1024MB, and TB = 1024GB.

Parameters:
  • cpgname – The CPG where the VVs associated with the file provisioning group will be created
  • fpgname – The name of the file provisioning group to be created
  • size – The size of the file provisioning group to be created. The specified size must be between 1T and 32T. A suffix (with no whitespace before the suffix) will modify the units to GB (g or G suffix) or TB (t or T suffix).
  • comment – Specifies the textual description of the file provisioning group.
  • node – Bind the created file provisioning group to the specified node.
  • full – Create the file provisioning group using fully provisioned volumes.
  • wait – Wait until the associated task is completed before proceeding. This option will produce verbose task information.
Returns:

List of strings. Lines of output from the CLI command.

createfsgroup(*args, **kwargs)[source]

Create a local group account associated with file services.

The -gid option can have any value between 1000 and 65535.

To access an SMB share, specify the group as “LOCAL_CLUSTER<groupname>”.

Parameters:
  • groupname – Specifies the local group name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
  • gid – Specifies the group ID to be used.
  • memberlist – User members of the group.
Returns:

List of strings. Lines of output from the CLI command.

createfshare(*args, **kwargs)[source]

Create a file share.

The createfshare command creates file shares for supported protocols.

PROTOCOLS

smb
Creates an SMB file share.
nfs
Creates an NFS file share.
obj
Creates an Object file share.

OPTIONS

The following parameters are for all protocols:

fpg <fpgname> fstore <fstore> sharedir <sharedir> comment <comment>

The following options are specific to each subcommand:

smb
abe {true|false} allowip <iplist> denyip <iplist> allowperm <permlist> denyperm <permlist> cache {off|manual|optimized|auto} ca {true|false}
nfs
options <options> clientip <clientlist>
obj
ssl {true|false} urlpath <urlpath>

The file provisioning group and its underneath virtual file server must be created before creating file shares.

For SMB permissions, the same user cannot be specified with the same permission in both “allowperm” and “denyperm”.

To access an SMB share: for users configured locally, specify “LOCAL_CLUSTER<user>”, for users configured on Active Directory, specify “<domain><user>” or “<ad-netbios><user>”, for users configured on the LDAP server, specify “<ldap-netbios><user>”.

For NFS shares, it is not allowed to create two shares which have identical clients (i.e. specified by -clientip) and share directory (i.e. specified by -sharedir). If you create NFS shares without specifying different -clientip and -sharedir options, the second “createfshare” will fail.

To create Object share, the virtual file server specified by <vfs> must have an associated IP address.

Parameters:
  • protocol – The protocol {‘nfs’|’smb’|’obj’}
  • vfs – The virtual file server under which the file store, if it does not exist, and the share will be created.
  • sharename – The share name to be created.
  • fpg – Specifies the file provisioning group that <vfs> belongs. If this is not specified, the command will find out the file provisioning group based on the specified <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
  • fstore – Specifies the file store under which the share will be created. If this is not specified, the command uses the <sharename> as the file store name. The file store will be created if it does not exist.
  • sharedir – Specifies the directory path to share. It can be a full path starting from “/”, or a relative path under the file store. If this is not specified, the share created will be rooted at the file store. If option is specified, option -fstore must be specified.
  • comment – Specifies any comments or additional information for the share. The comment can be up to 255 characters long. Unprintable characters are not allowed.
  • abe – Access Based Enumeration. Specifies if users can see only the files and directories to which they have been allowed access on the shares. The default is ‘false’. Valid values are ‘true’, ‘false’ or None. The parameter is a Python string – not a boolean.
  • allowip – Specifies client IP addresses that are allowed access to the share. Use commas to separate the IP addresses. The default is “”, which allows all IP addresses (i.e. empty means all are allowed).
  • denyip – Specifies client IP addresses that are denied access to the share. Use commas to separate the IP addresses. The default is “”, which denies none of IP addresses (i.e. empty means none is denied).
  • allowperm

    Specifies the permission that a user/group is allowed to access the share. <permlist> must be specified in the format of: “<user1>:<perm1>,<user2>:<perm2>,...”. <user> can be a user or group name. <perm> must be “fullcontrol”, “read”, or “change”.

    “Everyone” is a special user for all users and groups.

    If the user is configured locally using “createfsuser”, use <user> to specify the user (for example, -allowperm user1:fullcontrol).

    If the user is configured on Active Directory, use “setfs ad” to join Active Directory domain with <domain> if it has not been done, and use “<domain><user>” or “<ad-netbios><user>” to specify the user (for example, -allowperm example.comaduser:fullcontrol). The <ad-netbios> can be found by running “showfs -ad”.

    If the user is configured on the LDAP server, use “setfs ldap” to create LDAP configuration with <ldap-netbios> if it has not been done, and use “<ldap-netbios><user>” to specify the user (for example, -allowperm ldaphostldapuser:read).

    If not specified, no default permissions will be allowed for the new shares, which sets the same default as a Windows Server 2012 R2 server would. This is to avoid a system administrator inadvertently allowing any non explicitly specified user to be able to access the SMB share.

  • denyperm

    Specifies the permission that a user/group is denied to access the share. <permlist> must be specified in the format of: “<user1>:<perm1>,<user2>:<perm2>,...”. <user> can be a user or group name. <perm> must be “fullcontrol”, “read”, or “change”.

    “Everyone” is a special user for all users and groups.

    If the user is configured locally using “createfsuser”, use <user> to specify the user (for example, -denyperm user1:fullcontrol).

    If the user is configured on Active Directory, use “setfs ad” to join Active Directory domain with <domain> if it has not been done, and use “<domain><user>” or “<ad-netbios><user>” to specify the user (for example, -denyperm example.comaduser:fullcontrol). The <ad-netbios> can be found by running “showfs -ad”.

    If the user is configured on the LDAP server, use “setfs ldap” to create LDAP configuration with <ldap-netbios> if it has not been done, and use “<ldap-netbios><user>” to specify the user (for example, -denyperm ldaphostldapuser:read).

  • cache – Specifies client-side caching for offline files. Valid values are: “off”: The client must not cache any files from this share. The share is configured to disallow caching. “manual”: The client must allow only manual caching for the files open from this share. “optimized”: The client may cache every file that it opens from this share. Also, the client may satisfy the file requests from its local cache. The share is configured to allow automatic caching of programs and documents. “auto”: The client may cache every file that it opens from this share. The share is configured to allow automatic caching of documents. If this is not specified, the default is “manual”.
  • ca – Continuous Availability. Specifies if SMB3 continuous availability features should be enabled for this share. If not specified, the default is ‘true’. Valid values are ‘true’, ‘false’ or None. The parameter is a Python string – not a boolean.
  • options

    Specifies options to use for the share to be created. Standard NFS export options except “no_subtree_check” are supported. Do not enter option “fsid”, which is provided. If not specified, the following options will be automatically set: sync, auth_nlm, wdelay, sec=sys, no_all_squash, crossmnt, secure, subtree_check, hide, root_squash, ro.

    See linux exports(5) man page for detailed information.

  • clientip – Specifies the clients that can access the share. The NFS client can be specified by the name (for example, sys1.hp.com), the name with a wildcard (for example, .hp.com), or by its IP address. Use comma to separate the IP addresses. If this is not specified, the default is “”.
  • ssl – Specifies if SSL is enabled. The default is false.
  • urlpath – Specifies the URL that clients will use to access the share. If this is not specified, the command uses <sharename> as <urlpath>.
Returns:

List of strings. Lines of output from the CLI command.

createfsip(*args, **kwargs)[source]

Assigns an IP address to a Virtual File Server.

Parameters:
  • ipaddr – Specifies the IP address to be assign to the Virtual File Server.
  • subnet – Specifies the subnet mask to be used.
  • vfs – Specifies the Virtual File Server to which the IP address will be assigned.
  • vlantag – Specifies the VLAN Tag to be used.
  • fpg – Specifies the file provisioning group in which the Virtual File Server was created.
Returns:

List of strings. Lines of output from the CLI command.

createfsnap(*args, **kwargs)[source]

Create a snapshot for File Services.

If option -retain is specified and the file store already has the maximum number of snapshots taken, the oldest snapshot will be deleted first before the new snapshot is created. If the command fails to create the new snapshot, the deleted snapshot will not be restored.

Parameters:
  • vfs – Specifies the name of the virtual file server.
  • fstore – Specifies the name of the file store that the snapshot will be taken. This is the path relative to <vfs>.
  • tag – Specifies the suffix to be appended to the timestamp of snapshot creation time in ISO 8601 date and time format, which will become the name of the created file store snapshot (for example: if “snapshot1” is being used as <tag>, the snapshot name will be 2013-12-17T215020_snapshot1). The name can be used as the value of option -snapname to display or remove a snapshot.
  • retain – Number of snapshots to retain with the specified tag. Snapshots exceeding the count will be deleted, oldest first. The valid range of <rcnt> is from 1 to 1024.
  • fpg – Specifies the file provisioning group that <vfs> belongs. If this is not specified, the command will find out the file provisioning group based on the specified <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
Returns:

List of strings. Lines of output from the CLI command.

createfstore(*args, **kwargs)[source]

Create a file store.

The createfstore command creates a new fstore with the specified name for the specified storage pool and the virtual file system.

Parameters:
  • vfs – Specifies the name of the virtual file system.
  • fstore – Specifies the name of the file store to be created.
  • comment – Specifies the textual description of the fstore.
  • fpg – Specifies the name of the file provisioning group.
Returns:

List of strings. Lines of output from the CLI command.

createfsuser(*args, **kwargs)[source]

Create a local user account associated with file services.

If not specified -uid will be given a default value.

The -uid option can have any value between 1000 and 65535.

If the -enabled option is not supplied the user will be enabled by default. Valid values are strings ‘false’ or ‘true’ (default). These values are strings – not Python booleans.

To access an SMB share, specify the user as “LOCAL_CLUSTER<username>”.

Parameters:
  • username – Specifies the local user name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
  • passwd – Specifies the user’s password.
  • primarygroup – Specifies the user’s primary group.
  • enable – Specifies the user is enabled or disabled on creation. Valid values are strings ‘false’ or ‘true’ (default). These values are strings – not Python booleans.
  • uid – Specifies the user ID to be used.
  • grplist – Specifies a list of additional groups the user is to be a member.
Returns:

List of strings. Lines of output from the CLI command.

createvfs(*args, **kwargs)[source]

Create a Virtual File Server.

createvfs creates a Virtual File Server. It can optionally create the File Provisioning Group to which the VFS will belong.

If an fpg is created, it will be given the same name as the VFS. Both names must be available for creation for the command to succeed.

Either -fpg or the parameters to create a File Provisioning Group must be specified in order to create a VFS.

This command will spawn a task and return the taskid.

Grace times are specified in minutes.

Certificates must be in PEM format, containing both public and private keys.

Only one of the following certificate options can be specified: nocert, certfile, certdata.

Parameters:
  • ipaddr – The IP address to which the VFS should be assigned
  • subnet – The subnet for the IP Address.
  • vfsname – The name of the VFS to be created.
  • nocert – Do not create a self signed certificate associated with the VFS.
  • certfile – Use the certificate data contained in this file.
  • certdata – Use the certificate data contained in this string.
  • comment – Specifies any additional textual information.
  • bgrace – The block grace time in minutes for quotas within the VFS.
  • igrace – The inode grace time in minutes for quotas within the VFS.
  • fpg – The name of the File Provisioning Group in which the VFS should be created.
  • cpg – The CPG in which the File Provisioning Group should be created.
  • size – The size of the File Provisioning Group to be created.
  • node – The node to which the File Provisioning Group should be assigned.
  • vlan – The VLAN ID associated with the VFSIP.
  • wait – Wait until the associated task is completed before proceeding. This option will produce verbose task information.
Returns:

List of strings. Lines of output from the CLI command.

getfpg(*args, **kwargs)[source]

Show file provisioning group information

The getfpg command displays information on file provisioning groups

Parameters:fpgs – Limit output to the specified file provisioning group.
Returns:dict with message, total and members
result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of FPGs
}
getfs(*args, **kwargs)[source]

Show information on File Services cluster.

The getfs command displays information on File Services nodes.

Returns:dict with message, total and members
result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of FS settings.
}
getfshare(*args, **kwargs)[source]

Show file shares information.

The getfshare command displays file share information for supported protocols.

PROTOCOLS

smb
Displays file shares information for SMB.
nfs
Displays file shares information for NFS.
obj
Displays file shares information for Object.
Parameters:
  • protocol – The protocol {‘nfs’|’smb’|’obj’}
  • sharename – Displays only shares with names matching the specified <sharename> or one of glob-style patterns.
  • **kwargs – See below.
Kwargs:
  • fpg – Specifies the file provisioning group name. This limits the share output to those shares associated with the specified file provisioning group.
  • vfs – Specifies the virtual file server name. This limits the share output to those shares associated with the specified virtual file server. If this option is specified, but -fpg is not specified, the command will find out the file provisioning group based on <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
  • fstore – Specifies the file store name. This limits the share output to only those shares associated with the specified file store. If this is specified, option -vfs must be specified.
  • pat – Specifies the file share names using the glob-style pattern. Shares which have the name matching any of the specified glob-style patterns will be displayed. The -pat option can specify a list of patterns, and it must be used if specifier <pattern> is used.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of fshares.
}
getfsip(*args, **kwargs)[source]

Shows the network config of a Virtual File Server.

Parameters:
  • vfs – Specifies the Virtual File Server which is to have its network config modified.
  • fpg – Specifies the File Provisioning Group in which the Virtual File Server was created.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of FSIPs.
}
getfsnap(*args, **kwargs)[source]

Show snapshot information for File Services.

Parameters:
  • snapname – Displays only snapshots with names matching the specified <snapname> or one of glob-style patterns.
  • **kwargs – See below.
Kwargs:
  • fpg – Specifies the file provisioning group name. This option limits the snapshot output to those associated snapshots with the specified file provisioning group.
  • vfs – Specifies the virtual file server name. This option limits the snapshot output to those snapshots associated with the specified virtual file server.
  • fstore – Specifies the file store name. This option limits the snapshot output to only those snapshots associated with the specified file store.
  • pat – Specifies the snapshot names using glob-style patterns. Snapshots which have the name matching any of the specified glob-style patterns will be displayed. Patterns can be repeated using a comma-separated list. The -pat option must be used if <pattern> specifier is used.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of fsnaps.
}
getfsnapclean(*args, **kwargs)[source]

List details of snapshot reclamation tasks.

The showfsnapclean command displays the details of an on-demand snapshot reclamation task active on a file provisioning group.

Parameters:fpgname – Specifies the name of the file provisioning group.
Returns:dict with message, total and members
result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of fsnapcleans.
}
getfsquota(*args, **kwargs)[source]

Show the quotas for File Services.

Parameters:
  • username – The user name of the quotas to be displayed.
  • groupname – The group name of the quotas to be displayed.
  • fstore – The file store of the quotas to be displayed.
  • vfs – Specifies the name of the virtual file server associated with the quotas.
  • fpg – Specifies the name of the file provisioning group hosting the virtual file server.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of fsquotas.
}
getfstore(*args, **kwargs)[source]

Display File Store information.

The showfstore command displays information on the file stores. To specify VFS or fstore filters, the parent components must be specified.

Parameters:
  • fpg – Limit the display to virtual file servers contained within the file provisioning group.
  • vfs – Limit the display to the specified virtual file server.
  • fstore – Limit the display to the specified file store.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of fstores.
}
gettpdinterface(*args, **kwargs)[source]

Get and parse TPD interfaces (and set for re-use).

The output is filtered to only include interfaces used by this client.

Returns:Dictionary of TPD interfaces
getvfs(*args, **kwargs)[source]

Display Virtual File Server information.

The getvfs command displays information on Virtual File Servers.

VFS name is not globally unique, and the same VFS name may be in use in multiple File Provisioning Groups.

If no filter options are provided the system will traverse all File Provisioning Groups and display all associated VFSs.

Parameters:
  • fpg – Limit the display to VFSs contained within the File Provisioning Group.
  • vfs – Limit the display to the specified VFS name.
Returns:

dict with message, total and members

result = {
    'message': None,  # Error message, if any.
    'total': 0        # Number of members returned.
    'members': [],    # List containing dict of VFSs.
}
growfpg(*args, **kwargs)[source]

Grow a file provisioning group.

The growfpg command grows a file provisioning group of the given name by the size specified, within the CPG associated with the base file provisioning group.

For each grow undertaken, at least one additional VV of name <fpgname>.n is created.

Parameters:
  • fpgname – The name of the filesystem to be grown.
  • size – The size of the filesystem to be grown.
Returns:

List of strings. Lines of output from the CLI command.

removefpg(*args, **kwargs)[source]

Remove a file provisioning group

The removefpg command removes a file provisioning group and its underlying components from the system.

It is necessary to remove any shares on the file provisioning group before removing the file provisioning group itself.

Parameters:
  • fpgname – fpgname is the name of the file provisioning group(s) to be removed. This specifier can be repeated to remove multiple file provisioning groups. When used with pat=True, specifies a glob-style pattern. This specifier can be repeated to remove multiple file provisioning groups.
  • **kwargs – See below.
Kwargs:
  • forget – Removes the specified file provisioning group which is involved in Remote DR, keeping the virtual volume intact.
  • wait – Wait until the associated task is completed before proceeding. This option will produce verbose task information.
  • pat – The fpgname parameter is a glob-style pattern.
Returns:

List of strings. Lines of output from the CLI command.

removefsgroup(*args, **kwargs)[source]

Remove a local group account associated with file services.

Parameters:groupname – Specifies the local group name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
Returns:List of strings. Lines of output from the CLI command.
removefshare(*args, **kwargs)[source]

Remove a file share from File Services cluster.

PROTOCOLS

smb
Removes an SMB file share.
nfs
Removes an NFS file share.
obj
Removes an Object file share.
Parameters:
  • protocol – The protocol {‘nfs’|’smb’|’obj’}
  • vfs – Specifies the virtual file server name.
  • sharename – The name of the share to be removed.
  • fpg – Specifies the file provisioning group that <vfs> belongs. If this is not specified, the command will find out the file provisioning group based on the specified <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
  • fstore – Specifies the file store that the file share to be removed belongs. If this is not specified, the <sharename> will be used as <fstore>.
Returns:

List of strings. Lines of output from the CLI command.

removefsip(*args, **kwargs)[source]

Removes the network config of a Virtual File Server.

Parameters:
  • vfs – Specifies the Virtual File Server which is to have its network config removed.
  • id – Specifies the ID for the network config.
  • fpg – Specifies the File Provisioning Group in which the Virtual File Server was created.
Returns:

List of strings. Lines of output from the CLI command.

removefsnap(*args, **kwargs)[source]

Remove file store snapshots from File Services.

Parameters:
  • vfs – Specifies the virtual file server name.
  • fstore – Specifies the file store name.
  • snapname – Specifies the name of the snapshot to be removed. If this is not specified, all snapshots of the file store specified by <fstore> will be removed.
  • fpg – Specifies the file provisioning group that <vfs> belongs. If this is not specified, the command will find out the file provisioning group based on the specified <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
Returns:

List of strings. Lines of output from the CLI command.

removefstore(*args, **kwargs)[source]

Remove a File Store

The removefstore command removes a File store and its underlying
components from the system
Parameters:
  • vfs – The name of the containing Virtual File Server.
  • fstore – The name of the fstore to be removed.
  • fpg – The name of the parent File Provisioning Group.
Returns:

List of strings. Lines of output from the CLI command.

removefsuser(*args, **kwargs)[source]

Remove a local user account associated with file services.

Parameters:username – Specifies the local user name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
Returns:List of strings. Lines of output from the CLI command.
removevfs(*args, **kwargs)[source]

Remove a Virtual File Server.

The removevfs command removes a Virtual File Server and its underlying components from the system.

Parameters:
  • vfs – The name of the VFS to be removed.
  • fpg – fpg is the name of the File Provisioning Group containing the VFS
Returns:

List of strings. Lines of output from the CLI command.

setfpg(*args, **kwargs)[source]

Modify the properties of a File Provisioning Group.

The setfpg command allows the user to enable and disable various properties associated with a File Provisioning Group.

Access to all domains is required to run this command.

The -primarynode and -failover options are mutually exclusive.

When assigning primary nodes, the secondary node will be implicit as a couplet pair [0,1] [2,3] [4,5] [6,7]. This action will fail if the graceful failover is not possible.

The -failover and -primarynode options will result in temporary unavailability of the Virtual File Servers associated with the File Provisioning Group being migrated, and also the unavailability of any associated shares. An implicit -deactivate and -activate process is undertaken during a migration to the alternate node.

Parameters:
  • fpgname – The name of the file provisioning group to be modified.
  • comment – Specifies any addition textual information.
  • rmcomment – Clears the comment string.
  • activate – Makes the File Provisioning Group available.
  • deactivate – Makes the File Provisioning Group unavailable.
  • primarynode – Specifies the primary node to which the File Provisioning Group will be assigned. Appropriate <nodeid> values are defined as those on which file services has been enabled.
  • failover – Specifies that the File Provisioning Group should be failed over to its alternate node. If it has previously failed over to the secondary, this will cause it to fail back to the primary node. Will fail if a graceful failover is not possible.
  • forced – In the event of failure to failover, this will attempt a forced failover.
Returns:

List of strings. Lines of output from the CLI command.

setfsgroup(*args, **kwargs)[source]

Modify a local group account associated with file services.

memberlist specifies user members of the group. It is a set of comma separated strings (memberlist=’<list>’).

If <list> has a prefix (for example, +user1):

+ add <list> to the existing user list. Users in <list> must not be in the existing list.

- remove <list> from the existing list. Users in <list> must be already in the existing list.

If specified, the prefix will be applied to the entire list. If <list> has no prefix, <list> will be used as the new user list.

Parameters:
  • groupname – Specifies the local group name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
  • memberlist – Specifies user members of the group. It is a set of comma separated strings.
Returns:

List of strings. Lines of output from the CLI command.

setfshare(*args, **kwargs)[source]

Set/modify file share properties.

The setfshare command modifies file share properties for supported protocols.

For setting SMB permissions, the same user cannot be specified with the same permission in both “allowperm” and “denyperm”.

PROTOCOLS

smb
Sets file share options for SMB.
nfs
Sets file share options for NFS.
obj
Sets file share options for Object.

OPTIONS

The following options are for all protocols:

fpg <fpgname> fstore <fstore> comment <comment>

The following options are specific to each protocol:

smb
-abe {true|false} -allowip [+|-]<iplist> -denyip [+|-]<iplist> -allowperm [+|-|=]<permlist> -denyperm [+|-|=]<permlist> -cache {off|manual|optimized|auto} -ca {true|false}
nfs
-options <options> -clientip [+|-]<iplist>
obj
-ssl {true|false}
Parameters:
  • protocol – The protocol {‘nfs’|’smb’|’obj’}
  • vfs – Specifies the virtual file server that the share to be modified belongs.
  • sharename – Specifies the name of the share to be modified.
  • fpg – Specifies the file provisioning group that <vfs> belongs. If this is not specified, the command will find out the file provisioning group based on the specified <vfs>. However, if <vfs> exists under multiple file provisioning groups, -fpg must be specified.
  • fstore – Specifies the file store that the share to be modified belongs. If this is not specified, the <sharename> will be used as the file store name to identify the share.
  • comment – Specifies any comments or additional information for the share. The comment can be up to 255 characters long. Unprintable characters are not allowed.
  • abe – Access Based Enumeration. Specifies if users can see only the files and directories to which they have been allowed access on the shares.
  • allowip

    Specifies client IP addresses that are allowed access to the share. Use commas to separate the IP addresses.

    If <iplist> has a prefix (for example: +1.1.1.0,2.2.2.0):

    + add <iplist> to the existing allowed list. The IP addresses in <iplist> must not be in the existing allowed list.

    - remove <iplist> from the existing allowed list. The IP addresses in <iplist> must be already in the existing allowed list.

    If specified, the prefix will be applied to the entire <iplist>. If <iplist> has no prefix, <iplist> will be used as the new allowed list.

  • denyip

    Specifies client IP addresses that are denied access to the share. Use commas to separate the IP addresses.

    If <iplist> has a prefix (for example: +1.1.1.0,2.2.2.0):

    + add <iplist> to the existing denied list. The IP addresses in <iplist> must not be in the existing denied list.

    - remove <iplist> from the existing denied list. The IP addresses in <iplist> must already be in the existing denied list.

    If specified, the prefix will be applied to the entire <iplist>. If <iplist> has no prefix, <iplist> will be used as the new denied list.

  • allowperm

    Specifies the permissions that users/groups are allowed to access the share. <permlist> must be specified in the format of: “<user1>:<perm1>,<user2>:<perm2>,...”. The <user> can be a user or group name specified using the same format as described in createfshare. <perm> must be “fullcontrol”, “read”, or “change”.

    If <permlist> has a prefix (for example: +Everyone:read):

    + add <permlist> to the existing allowed list. Users/groups in <permlist> must not be in the existing allowed list.

    - remove <permlist> from the existing allowed list. Users/groups in <permlist> must be already in the existing allowed list.

    = modify the existing allowed list with <permlist>. Users/groups in <permlist> must be already in the existing allowed list.

    If specified, the prefix will be applied to the entire <permlist>. If <permlist> has no prefix, <permlist> will be used as the new allowed list.

  • denyperm

    Specifies the permissions that users/groups are denied to access the share. <permlist> must be specified in the format of: “<user1>:<perm1>,<user2>:<perm2>,...”. The <user> can be a user or group name specified using the same format as described in createfshare. <perm> must be “fullcontrol”, “read”, or “change”.

    If <permlist> has a prefix (for example, +Everyone:read):

    + add <permlist> to the existing denied list. Users/groups in <permlist> must not be in the existing denied list.

    - remove <permlist> from the existing denied list. Users/groups in <permlist> must be already in the existing denied list.

    = modify the existing denied list with <permlist>. Users/groups set in <permlist> must be already in the existing denied list.

    If specified, the prefix will be applied to the entire <permlist>. If <permlist> has no prefix, <permlist> will be used as the new denied list.

  • cache – Specifies client-side caching for offline files. Valid values are: “off”: The client must not cache any files from this share. The share is configured to disallow caching. “manual”: The client must allow only manual caching for the files open from this share. “optimized”: The client may cache every file that it opens from this share. Also, the client may satisfy the file requests from its local cache. The share is configured to allow automatic caching of programs and documents. “auto”: The client may cache every file that it opens from this share. The share is configured to allow automatic caching of documents.
  • ca – Continuous Availability. Specifies if SMB3 continuous availability features should be enabled for this share. If not specified, the default is ‘true’. Valid values are ‘true’, ‘false’ or None. The parameter is a Python string – not a boolean.
  • options

    Specifies the new options to use for the share. This completely overwrites the options you set previously. Standard NFS export options except “no_subtree_check” are supported. Do not enter option “fsid”, which is provided. If not specified, the following options will be automatically set: sync, auth_nlm, wdelay, sec=sys, no_all_squash, crossmnt, secure, subtree_check, hide, root_squash, ro.

    See linux exports(5) man page for detailed information on valid options.

  • clientip

    Specifies the clients that can access the share. The NFS client can be specified by the name (for example, sys1.hp.com), the name with a wildcard (for example, *.hp.com), or by its IP address. Use comma to separate the IP addresses.

    If <iplist> has a prefix (for example, +1.1.1.0,2.2.2.0):

    + add <iplist> to the existing list. IP addresses in <iplist> must not be in the existing list.

    - remove <iplist> from the existing list. IP addresses in <iplist> must be already in the existing list.

    If specified, the prefix will be applied to the entire <iplist>. If <iplist> has no prefix, <iplist> will be used as the new list.

  • ssl – Specifies to enable or disable SSL.
Returns:

List of strings. Lines of output from the CLI command.

setfsip(*args, **kwargs)[source]

Modifies the network config of a Virtual File Server.

Parameters:
  • vfs – Specifies the Virtual File Server which is to have its network config modified.
  • id – Specifies the ID for the network config.
  • vlantag – Specifies the VLAN Tag to be used.
  • ip – Specifies the new IP address.
  • subnet – Specifies the new subnet mask.
  • fpg – Specifies the File Provisioning Group in which the Virtual File Server was created.
Returns:

List of strings. Lines of output from the CLI command.

setfsquota(*args, **kwargs)[source]

Set the quotas for a specific virtual file server.

Parameters:
  • vfsname – Specifies the name of the virtual file server associated with the quotas.
  • fpg – Specifies the name of the file provisioning group hosting the virtual file server.
  • username

    The username of the quotas to be modified.

    If the user is configured on Active Directory, use “setfs ad” to join Active Directory domain with <domain> if it has not been done, and use “<domain><uname>” or “<ad-netbios><uname>” to specify the user (for example, -username example.comduser). The “<ad-netbios>” is Active Directory NetBIOS name, which can be found by running “showfs -ad”.

    If the user is configured on the LDAP server, use “setfs ldap” to create LDAP configuration with <ldap-netbios> if it has not been done, and use “<ldap-netbios><username>” to specify the user (for example, -username ldaphostldapuser). The “<ldap-netbios>” is the LDAP server NetBIOS name, which can be found by running “showfs -ldap”.

  • groupname

    The groupname of the quotas to be modified.

    If the group is configured on Active Directory, use “setfs ad” to join Active Directory domain with <domain> if it has not been done, and use “<domain><gname>” or “<ad-netbios><uname>” to specify the user (for example, -groupname example.comdgroup). The <ad-netbios> is Active Directory NetBIOS name, which can be found by running “showfs -ad”.

    If the group is configured on the LDAP server, use “setfs ldap” to create LDAP configuration with <ldap-netbios> if it has not been done, and use “<ldap-netbios><gname>” to specify the user (for example, -groupname ldaphostldapgroup).

  • fstore – The path to the fstore to which you wish to apply quotas.
  • scapacity – An integer value in MB for the soft capacity storage quota.
  • hcapacity – An integer value in MB for the hard capacity storage quota.
  • sfile – An integer limit of the number of files for the soft file quota.
  • hfile – An integer limit of the number of files for the hard file quota.
  • clear – Clears the quotas of the specified object.
  • archive – Stores the quota information associated with the VFS in a file.
  • restore – Applies the quota information stored in the file to the VFS.
Returns:

List of strings. Lines of output from the CLI command.

setfstore(*args, **kwargs)[source]

Modify a File Store.

Parameters:
  • vfs – The name of the containing Virtual File Server.
  • fstore – The name of the fstore to be modified.
  • comment – Specifies any addition textual information.
  • fpg – The name of the parent File Provisioning Group.
Returns:

List of strings. Lines of output from the CLI command.

setfsuser(*args, **kwargs)[source]

Modify a local user account associated with file services.

Valid values for enabled are strings ‘false’ or ‘true’ (or None). These values are strings – not Python booleans.

grplist specifies a list of additional groups which the user is to be a member. It is a set of comma separated strings (grplist=’<list>’).

If <list> has a prefix (for example, +group1):

+ add <list> to the existing group list. Groups in <list> must not be in the existing list.

- remove <list> from the existing list. Groups in <list> must be already in the existing list.

If specified, the prefix will be applied to the entire list. If <list> has no prefix, <list> will be used as the new group list.

Parameters:
  • username – Specifies the local user name using up to 31 characters. Valid characters are alphanumeric characters, periods, dashes (except first character), and underscores.
  • passwd – Specifies the user’s password.
  • primarygroup – Specifies the user’s primary group.
  • enable – Specifies if the user is enabled or not.
  • grplist – Specifies a list of additional groups which the user is to be a member. It is a set of comma separated strings.
Returns:

List of strings. Lines of output from the CLI command.

setvfs(*args, **kwargs)[source]

Modify a Virtual File Server.

Allows modification of the specified Virtual File Server

Only one of the following certificate options can be specified: certfile, certdata, certgen, rmcert.

Certificates must be in PEM format, containing both public and private keys.

Grace times are specified in minutes.

Parameters:
  • vfs – The name of the VFS to be modified.
  • fpg – The name of the File Provisioning Group to which the VFS belongs.
  • certfile – Use the certificate data contained in this file.
  • certdata – Use the certificate data contained in this string.
  • certgen – Generates and sets a certificate for the VFS.
  • rmcert – Remove the named certificate from the VFS.
  • comment – Specifies any additional textual information.
  • bgrace – Specifies the block grace time for quotas within the VFS.
  • igrace – Specifies the inode grace time for quotas within the VFS.
Returns:

List of strings. Lines of output from the CLI command.

startfsnapclean(*args, **kwargs)[source]

Start or resume an on-demand reclamation task.

Parameters:
  • fpgname – Specifies the name of the file provisioning group.
  • resume – Specifies a paused reclamation task needs to be resumed.
  • reclaimStrategy
    Specifies the strategy to be used while
    reclaiming snap space.

    ‘maxspeed’: Suggests optimize for speedy reclamation. ‘maxspace’: Suggests optimize to reclaim maximum space.

Returns:

List of strings. Lines of output from the CLI command.

stopfsnapclean(*args, **kwargs)[source]

Stop or pause an on-demand reclamation task.

The stopfsnapclean command stops or pauses an on-demand reclamation task on a file provisioning group.

There can be only one reclamation task running on a file provisioning group. If we pause reclamation task, it will still be counted.

If the task is not running, the following output is displayed: No reclamation task running on Storage Pool samplepool (Server error: 400)

Parameters:
  • fpgname – Specifies the name of the file provisioning group.
  • pause – Specifies to pause a reclamation task.
Returns:

List of strings. Lines of output from the CLI command.

http Module

HTTPJSONRESTClient.

Author:Walter A. Boring IV
Description:This is the HTTP Client that is used to make the actual calls. It includes the authentication that knows the cookie name for 3PAR.
class hp3parclient.http.HTTPJSONRESTClient(api_url, secure=False, http_log_debug=False, suppress_ssl_warnings=False)[source]

Bases: object

An HTTP REST Client that sends and recieves JSON data as the body of the HTTP request.

Parameters:
  • api_url (str) – The url to the WSAPI service on 3PAR ie. http://<3par server>:8080
  • secure (bool) – Validate SSL cert? Default will not validate
  • http_log_debug (bool) – Turns on http log debugging. Default will not log
  • suppress_ssl_warnings (bool) – Suppresses log warning messages if True
USER_AGENT = 'python-3parclient'
authenticate(user, password, optional=None)[source]

This tries to create an authenticated session with the 3PAR server

Parameters:
  • user (str) – The username
  • password (str) – Password
backoff = 2
delay = 0
delete(url, **kwargs)[source]

Make an HTTP DELETE request to the server.

#example call
try {
    headers, body = http.delete('/volumes/%s' % name)
} except exceptions.HTTPUnauthorized as ex:
    print "Not logged in"
}
Parameters:url (str) – The relative url from the 3PAR api_url
Returns:headers - dict of HTTP Response headers
Returns:body - the body of the response. If the body was JSON, it will be an object
get(url, **kwargs)[source]

Make an HTTP GET request to the server.

#example call
try {
    headers, body = http.get('/volumes')
} except exceptions.HTTPUnauthorized as ex:
    print "Not logged in"
}
Parameters:url (str) – The relative url from the 3PAR api_url
Returns:headers - dict of HTTP Response headers
Returns:body - the body of the response. If the body was JSON, it will be an object
get_timings()[source]

Ths gives an array of the request timings since last reset_timings call

http_log_debug = False
post(url, **kwargs)[source]

Make an HTTP POST request to the server.

#example call
try {
    info = {'name': 'new volume name', 'cpg': 'MyCPG',
            'sizeMiB': 300}
    headers, body = http.post('/volumes', body=info)
} except exceptions.HTTPUnauthorized as ex:
    print "Not logged in"
}
Parameters:url (str) – The relative url from the 3PAR api_url
Returns:headers - dict of HTTP Response headers
Returns:body - the body of the response. If the body was JSON, it will be an object
put(url, **kwargs)[source]

Make an HTTP PUT request to the server.

#example call
try {
    info = {'name': 'something'}
    headers, body = http.put('/volumes', body=info)
} except exceptions.HTTPUnauthorized as ex:
    print "Not logged in"
}
Parameters:url (str) – The relative url from the 3PAR api_url
Returns:headers - dict of HTTP Response headers
Returns:body - the body of the response. If the body was JSON, it will be an object
request(*args, **kwargs)[source]

This makes an HTTP Request to the 3Par server. You should use get, post, delete instead.

reset_timings()[source]

This resets the request/response timings array

retry_exceptions = (<class 'hp3parclient.exceptions.HTTPServiceUnavailable'>, <class 'requests.exceptions.ConnectionError'>)
set_debug_flag(flag)[source]

This turns on/off http request/response debugging output to console

Parameters:flag (bool) – Set to True to enable debugging output
set_url(api_url)[source]
tries = 5
unauthenticate()[source]

This clears the authenticated session with the 3PAR server.

Table Of Contents

This Page