class Hpe3parSdk::Client

Public Class Methods

new(api_url,debug:false, secure: false, timeout: nil, suppress_ssl_warnings: false, app_type: 'ruby-3parclient', log_file_path: nil) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 29
def initialize(api_url,debug:false, secure: false, timeout: nil, suppress_ssl_warnings: false, app_type: 'ruby-3parclient', log_file_path: nil)
  unless api_url.is_a?(String)
    raise Hpe3parSdk::HPE3PARException.new(nil,
                                              "'api_url' parameter is mandatory and should be of type String")
  end

  @api_url = api_url
  @debug = debug
  @secure = secure
  @timeout = timeout
  @suppress_ssl_warnings = suppress_ssl_warnings
  @log_level = Logger::INFO
  @log_file_path = log_file_path
  init_log
  @http = HTTPJSONRestClient.new(
      @api_url, @secure, @debug,
      @suppress_ssl_warnings, @timeout = nil
  )
  check_WSAPI_version
  @vlun_query_supported = false
  @cpg = CPGManager.new(@http)
  @qos = QOSManager.new(@http)
  @flash_cache = FlashCacheManager.new(@http)
  @port = PortManager.new(@http)
  @task = TaskManager.new(@http)
  @host_and_vv_set_filter_supported = false
  @ssh = nil
  @vlun = VlunManager.new(@http, @vlun_query_supported)
  @host = HostManager.new(@http, @vlun_query_supported)
  @volume_set = VolumeSetManager.new(@http, @host_and_vv_set_filter_supported)
  @host_set = HostSetManager.new(@http, @host_and_vv_set_filter_supported)
  @app_type = app_type
end

Public Instance Methods

add_hosts_to_host_set(set_name, setmembers) click to toggle source

Adds host(s) to a host set.

Attributes

  • set_name - Hostset name.

    type set_name: String
    
  • setmembers - Array of host names to add to the set.

    type setmembers: Array of String
# File lib/Hpe3parSdk/client.rb, line 1183
def add_hosts_to_host_set(set_name, setmembers)
  begin
    @host_set.add_hosts_to_host_set(set_name, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
add_volumes_to_volume_set(set_name, setmembers) click to toggle source

Adds volume(s) to a volume set.

Attributes

  • set_name - the volume set name

    type set_name: String
    
  • setmembers - the volume(s) name to add

    type setmembers: Array of String
# File lib/Hpe3parSdk/client.rb, line 1957
def add_volumes_to_volume_set(set_name, setmembers)
  begin
    @volume_set.add_volumes_to_volume_set(set_name, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
cancel_task(task_id) click to toggle source

Cancel a 3PAR task

Attributes

  • task_id - The Id of the task to be cancelled.

    type task_id: Integer
    

Raises

# File lib/Hpe3parSdk/client.rb, line 2542
def cancel_task(task_id)
  begin
    @task.cancel_task(task_id)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
cpg_exists?(name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2596
def cpg_exists?(name)
  begin
    @cpg.cpg_exists?(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_cpg(name, optional = nil) click to toggle source

Creates a new CPG.

Attributes

  • name - Name of the cpg

    type name: String
    
  • optional - Hash of other optional items

      type optional: Hash
    
      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

# File lib/Hpe3parSdk/client.rb, line 2353
def create_cpg(name, optional = nil)
  begin
    @cpg.create_cpg(name, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_flash_cache(size_in_gib, mode = nil) click to toggle source

Creates a new FlashCache

Attributes

  • size_in_gib - Specifies the node pair size of the Flash Cache on the system

    type size_in_gib: Integer
    
  • mode - Values supported Simulator: 1, Real: 2 (default)

    type mode: Integer
    

Raises

# File lib/Hpe3parSdk/client.rb, line 186
def create_flash_cache(size_in_gib, mode = nil)
  begin
    @flash_cache.create_flash_cache(size_in_gib, mode)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
  
end
create_host(name, iscsi_names = nil, fcwwns = nil, optional = nil) click to toggle source

Creates a new Host.

Attributes

  • name - The name of the host.

    type name: String
    
  • iscsi_names - Array of iSCSI iqns.

    type iscsi_names: Array
    
  • fcwwns - Array of Fibre Channel World Wide Names.

    type fcwwns: Array
    
  • optional - The optional stuff.

    type optional: Hash
      optional = {
          'persona'=> 1,                  # Refer Hpe3parSdk::HostPersona for complete enumeration.
                                          # 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

# File lib/Hpe3parSdk/client.rb, line 881
def create_host(name, iscsi_names = nil, fcwwns = nil, optional = nil)
  begin
    @host.create_host(name, iscsi_names, fcwwns, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_host_set(name, domain = nil, comment = nil, setmembers = nil) click to toggle source

Creates a new HostSet.

Attributes

  • name - Name of the host set to be created.

    type name: String
    
  • domain - The domain in which the host set will be created.

    type domain: String
    
  • comment - Comment for the host set.

    type comment: String
    
  • setmembers - The hosts to be added to the set. The existence of the host will not be checked.

    type setmembers: Array of String

Raises

# File lib/Hpe3parSdk/client.rb, line 1100
def create_host_set(name, domain = nil, comment = nil, setmembers = nil)
  begin
    @host_set.create_host_set(name, domain, comment, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_physical_copy(src_name, dest_name, dest_cpg, optional = nil) click to toggle source

Creates a physical copy of a VirtualVolume

Attributes

  • src_name - the source volume name

    type src_name: String
    
  • dest_name - the destination volume name

    type dest_name: String
    
  • dest_cpg - the destination CPG

    type dest_cpg: String
    
  • optional - Hash of optional parameters

    type optional: Hash
    
    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 - Hpe3parSdk::TaskPriority)
    }
    
# File lib/Hpe3parSdk/client.rb, line 1674
def create_physical_copy(src_name, dest_name, dest_cpg, optional = nil)
  if @current_version < @min_version_with_compression && !optional.nil?
    [:compression, :allowRemoteCopyParent, :skipZero].each { |key| optional.delete key }
  end
  begin
    @volume.create_physical_copy(src_name, dest_name, dest_cpg, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_qos_rules(target_name, qos_rules, target_type = QoStargetType::VVSET) click to toggle source

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

Attributes

  • target_type: Type of QoS target, either enum TARGET_TYPE_VVS or TARGET_TYPE_SYS.

    type target_type:  VVSET or SYS. Refer QoStargetType::VVSET for complete enumeration
  • target_name: Name of the target object on which the QoS rule will be created.

    type target_name: String
    
  • qos_rules: QoS options

    type qos_rules: Hash
    qos_rules = {
        'priority'=> 2,         # Refer Hpe3parSdk::QoSpriorityEnumeration for complete enumeration
        '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'=> false,        # 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

# File lib/Hpe3parSdk/client.rb, line 657
def create_qos_rules(target_name, qos_rules, target_type = QoStargetType::VVSET)
  if @current_version < @min_version && !qos_rules.nil?
    qos_rules.delete_if { |key, _value| key == :latencyGoaluSecs }
  end
  begin
    @qos.create_qos_rules(target_name, qos_rules, target_type)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_snapshot(name, copy_of_name, optional = nil) click to toggle source

Creates a snapshot of an existing Volume.

Attributes

  • name - the name of the Snapshot

    type name: String
    
  • copy_of_name - the name of the parent volume

    type copy_of_name: String
    
  • optional - Hash of other optional items

    type optional: Hash
    
    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

# File lib/Hpe3parSdk/client.rb, line 2099
def create_snapshot(name, copy_of_name, optional = nil)
  if @current_version < @min_version_with_compression && !optional.nil?
    optional.delete_if { |key, _value| key == :allowRemoteCopyParent }
  end
  begin
    @volume.create_snapshot(name, copy_of_name, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_snapshot_of_volume_set(name, copy_of_name, optional = nil) click to toggle source

Creates a snapshot of an existing VolumeSet

Attributes

  • name: Name of the Snapshot. The vvname pattern is described in “VV Name Patterns” in the HPE 3PAR Command Line Interface Reference, which is available at the following website: www.hp.com/go/storage/docs

    type name: String
    
  • copy_of_name: the name of the parent volume

    type copy_of_name: String
    
  • comment: the comment on the vv set

    type comment: String
    
  • optional: Hash of optional params

    type optional: Hash   
    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

# File lib/Hpe3parSdk/client.rb, line 2064
def create_snapshot_of_volume_set(name, copy_of_name, optional = nil)
  begin
    @volume_set.create_snapshot_of_volume_set(name, copy_of_name, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_vlun(volume_name, lun = nil, host_name = nil, port_pos = nil, no_vcn = false, override_lower_priority = false, auto = false) click to toggle source

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

  • volume_name: Name of the volume to be exported

    type volume_name: String
    
  • lun: LUN id

    type lun: Integer
    
  • host_name: Name of the host which the volume is to be exported.

    type host_name: String
    
  • port_pos: System port of VLUN exported to. It includes node number, slot number, and card port number

    type port_pos: Hash
        port_pos = {'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)
    
  • no_vcn: A VLUN change notification (VCN) not be issued after export (-novcn).

    type no_vcn: Boolean
    
  • override_lower_priority: Existing lower priority VLUNs will be overridden (-ovrd). Use only if hostname member exists.

    type override_lower_priority: Boolean
    

Returns

VLUN id

Raises

# File lib/Hpe3parSdk/client.rb, line 442
def create_vlun(volume_name, lun = nil, host_name = nil, port_pos = nil, no_vcn = false, override_lower_priority = false, auto = false)
  begin
    @vlun.create_vlun(volume_name, host_name, lun, port_pos, no_vcn, override_lower_priority, auto)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_volume(name, cpg_name, size_MiB, optional = nil) click to toggle source

Creates a new volume.

Attributes

  • name - the name of the volume

    type name: String
    
  • cpg_name - the name of the destination CPG

    type cpg_name: String
    
  • size_MiB - size in MiB for the volume

    type size_MiB: Integer
    
  • optional - hash of other optional items

      type optional: hash
    
      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
    }

Raises

# File lib/Hpe3parSdk/client.rb, line 1406
def create_volume(name, cpg_name, size_MiB, optional = nil)
  if @current_version < @min_version_with_compression && !optional.nil?
    optional.delete_if { |key, _value| key == :compression }
  end
  begin
    @volume.create_volume(name, cpg_name, size_MiB, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
create_volume_set(name, domain = nil, comment = nil, setmembers = nil) click to toggle source

Creates a new volume set

Attributes

  • name - the volume set to create

    type name: String
    
  • domain: the domain where the set lives

    type domain: String
    
  • comment: the comment for the vv set

    type comment: String
    
  • setmembers: the vv(s) to add to the set, the existence of the vv(s) will not be checked

    type name: Array of String

Raises

# File lib/Hpe3parSdk/client.rb, line 1850
def create_volume_set(name, domain = nil, comment = nil, setmembers = nil)
  begin
    @volume_set.create_volume_set(name, domain, comment, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_cpg(name) click to toggle source

Deletes a CPG.

Attributes

  • name - The name of the CPG

    type name: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 2435
def delete_cpg(name)
  begin
    @cpg.delete_cpg(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_flash_cache() click to toggle source

Deletes an existing Flash Cache

Raises

# File lib/Hpe3parSdk/client.rb, line 220
def delete_flash_cache
  begin
    @flash_cache.delete_flash_cache
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_host(name) click to toggle source

Deletes a host.

Attributes

  • name - The name of host to be deleted.

    type name: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 988
def delete_host(name)
  begin
    @host.delete_host(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_host_set(name) click to toggle source

Deletes a HostSet.

Attributes

  • name - The hostset to delete.

    type name: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 1122
def delete_host_set(name)
  begin
    @host_set.delete_host_set(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_physical_copy(name) click to toggle source

Deletes a physical copy

Attributes

  • name - the name of the clone volume

    type name: String
    

Raises:

# File lib/Hpe3parSdk/client.rb, line 1706
def delete_physical_copy(name)
  begin
    @volume.delete_volume(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET) click to toggle source

Deletes QoS rules.

Attributes

  • target_name: Name of the target. When target_type is sys, target_name must be sys:all_others.

    type target_name: String
    
  • target_type: target type is vvset or sys

    type target_type: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 774
def delete_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET)
  begin
    @qos.delete_qos_rules(target_name, target_type)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_snapshot(name) click to toggle source

Deletes a snapshot

Attributes

  • name - the name of the snapshot volume

    type name: String
    

Raises:

# File lib/Hpe3parSdk/client.rb, line 2173
def delete_snapshot(name)
  begin
    @volume.delete_volume(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_vlun(volume_name, lun_id, host_name = nil, port = nil) click to toggle source

Deletes a VLUN.

Attributes

  • volume_name: Volume name of the VLUN

    type volume_name: String
    
  • lun_id: LUN ID

    type lun_id: Integer
    
  • host_name: Name of the host which the volume is exported. For VLUN of port type,the value is empty

    type host_name: String
    
  • port: 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>

    type port: Hash
    
        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

# File lib/Hpe3parSdk/client.rb, line 523
def delete_vlun(volume_name, lun_id, host_name = nil, port = nil)
  begin
    @vlun.delete_vlun(volume_name, lun_id, host_name, port)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_volume(name) click to toggle source

Deletes a volume

Attributes

  • name - the name of the volume

    type name: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 1439
def delete_volume(name)
  begin
    @volume.delete_volume(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
delete_volume_set(name) click to toggle source

Deletes the volume set. You must clear all QOS rules before a volume set can be deleted.

Attributes

  • name - The name of the VolumeSet

    type name: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 1874
def delete_volume_set(name)
  begin
    @volume_set.delete_volume_set(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
find_all_volume_sets(name) click to toggle source

Returns an array of every VolumeSet the given volume is a part of. The array can contain zero, one, or multiple items.

Attributes

  • name - the volume name

    type name: String
    

Returns

Array of VolumeSet

Raises

# File lib/Hpe3parSdk/client.rb, line 1776
def find_all_volume_sets(name)
  begin
    @volume_set.find_all_volume_sets(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
find_host_sets(host_name) click to toggle source

Returns an array of every Hostset the given host is a part of. The array can contain zero, one, or multiple items.

Attributes

  • host_name - The host name of whose hostset is to be found.

    type host_name: String
    

Returns

Array of HostSet.

# File lib/Hpe3parSdk/client.rb, line 1219
def find_host_sets(host_name)
  begin
    @host_set.find_host_sets(host_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
flash_cache_exists?() click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2551
def flash_cache_exists?
  begin
    @flash_cache.flash_cache_exists?
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_all_tasks() click to toggle source

Get the list of all 3PAR Tasks

Returns

Array of Task

# File lib/Hpe3parSdk/client.rb, line 357
def get_all_tasks
  begin
    @task.get_all_tasks
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end 
end
get_cpg(name) click to toggle source

Gets information about a Cpg.

Attributes

  • name - The name of the cpg to find

    type name: String
    

Returns

CPG

Raises

# File lib/Hpe3parSdk/client.rb, line 2297
def get_cpg(name)
  begin
    @cpg.get_cpg(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_cpg_available_space(name) click to toggle source

Gets available space information about a cpg.

Attributes

  • name - The name of the cpg to find

    type name: String
    

Returns

Available space details in form of LDLayoutCapacity object

Raises

# File lib/Hpe3parSdk/client.rb, line 2411
def get_cpg_available_space(name)
  begin
    @cpg.get_cpg_available_space(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_cpgs() click to toggle source

Gets entire list of CPGs.

Returns

CPG array

# File lib/Hpe3parSdk/client.rb, line 2273
def get_cpgs
  begin
    @cpg.get_cpgs
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_fc_ports(state = nil) click to toggle source

Gets an array of Fibre Channel Ports.

  • state - Port link state.

    type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.

Returns

Array of Fibre Channel Port.

# File lib/Hpe3parSdk/client.rb, line 2223
def get_fc_ports(state = nil)
  begin
    @port.get_fc_ports(state)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_flash_cache() click to toggle source

Get Flash Cache information

Returns

FlashCache - Details of the specified flash cache

# File lib/Hpe3parSdk/client.rb, line 201
def get_flash_cache
  begin
    @flash_cache.get_flash_cache
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_host(name) click to toggle source

Gets host information by name.

Attributes

  • name - The name of the host to find.

    type name: String
    

Returns

Host.

Raises

# File lib/Hpe3parSdk/client.rb, line 818
def get_host(name)
  begin
    @host.get_host(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_host_set(name) click to toggle source

Gets hostset information by name.

Attributes

  • name - The name of the hostset to find.

    type name: String
    

Returns

HostSet.

Raises

# File lib/Hpe3parSdk/client.rb, line 1243
def get_host_set(name)
  begin
    @host_set.get_host_set(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_host_sets() click to toggle source

Gets all host sets.

Returns

Array of HostSet.

# File lib/Hpe3parSdk/client.rb, line 1062
def get_host_sets
  begin
    @host_set.get_host_sets
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_host_vluns(host_name) click to toggle source

Gets all of the VLUNs on a specific host.

Attributes

  • host_name - Name of the host.

    type host_name: String
    

Returns

Array of VLUN.

Raises

# File lib/Hpe3parSdk/client.rb, line 1267
def get_host_vluns(host_name)
  begin
    @host.get_host_vluns(host_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_hosts() click to toggle source

Gets all hosts.

Returns

Array of Host.

# File lib/Hpe3parSdk/client.rb, line 788
def get_hosts
  begin
    @host.get_hosts
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_ip_ports(state = nil) click to toggle source

Gets an array of IP Ports.

Attributes

  • state - Port link state.

    type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.

Returns

Array of IP Port.

# File lib/Hpe3parSdk/client.rb, line 2259
def get_ip_ports(state = nil)
  begin
    @port.get_ip_ports(state)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_iscsi_ports(state = nil) click to toggle source

Gets an array of iSCSI Ports.

  • state - Port link state.

    type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.

Returns

Array of iSCSI Port.

# File lib/Hpe3parSdk/client.rb, line 2240
def get_iscsi_ports(state = nil)
  begin
    @port.get_iscsi_ports(state)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_online_physical_copy_status(name) click to toggle source

Gets the status of an online physical copy

Attributes

  • name - The name of the volume

    type name: str
    

Returns

Status of online copy (String)

Raises

# File lib/Hpe3parSdk/client.rb, line 2459
def get_online_physical_copy_status(name)
  begin
    @volume.get_online_physical_copy_status(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_overall_system_capacity() click to toggle source

Gets the overall system capacity for the 3PAR server.

Returns

Hash 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
  }
}
# File lib/Hpe3parSdk/client.rb, line 328
def get_overall_system_capacity   
  begin
    response = @http.get('/capacity')
    response[1]
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_ports() click to toggle source

Gets an array of all ports on the 3PAR.

Returns

Array of Port.

# File lib/Hpe3parSdk/client.rb, line 2206
def get_ports
  begin
    @port.get_ports
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_snapshots() click to toggle source

Gets the list of snapshots in the array

Returns

Array of VirtualVolume

# File lib/Hpe3parSdk/client.rb, line 1295
def get_snapshots
  begin
    @volume.get_volumes(VolumeCopyType::VIRTUAL_COPY)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_storage_system_info() click to toggle source

Gets the Storage System Information

Returns

Hash of Storage System Info

# File lib/Hpe3parSdk/client.rb, line 234
def get_storage_system_info
  begin
    response = @http.get('/system')
    response[1]
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_task(task_id) click to toggle source

Get the status of a 3PAR Task

Attributes

  • task_id - the task id

    type task_id: Integer
    

Returns

Task

Raises

# File lib/Hpe3parSdk/client.rb, line 387
def get_task(task_id)
  begin
    @task.get_task(task_id)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end 
end
get_vlun(volume_name) click to toggle source

Gets information about a VLUN.

Attributes

  • volume_name: The volume name of the VLUN to find

    type volume_name: String
    

Returns

VLUN object

Raises

# File lib/Hpe3parSdk/client.rb, line 480
def get_vlun(volume_name)
  begin
    @vlun.get_vlun(volume_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_vluns() click to toggle source

Gets VLUNs.

Returns

Array of VLUN objects

# File lib/Hpe3parSdk/client.rb, line 456
def get_vluns
  begin
    @vlun.get_vluns
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volume(name) click to toggle source

Gets information about a volume by name

Attributes

  • name - The name of the volume to find

    type name: String
    

Returns

VirtualVolume

Raises

# File lib/Hpe3parSdk/client.rb, line 1319
def get_volume(name)
  begin
    @volume.get_volume(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volume_by_wwn(wwn) click to toggle source

Gets information about a volume by wwn

Attributes

  • wwn - The wwn of the volume to find

    type wwn: String
    

Returns

Raises

# File lib/Hpe3parSdk/client.rb, line 1343
def get_volume_by_wwn(wwn)
  begin
    @volume.get_volume_by_wwn(wwn)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volume_set(name) click to toggle source

Gets the information about a Volume Set.

Attributes

  • name - The name of the CPG to find

    type name: String
    

Returns

VolumeSet

Raises

# File lib/Hpe3parSdk/client.rb, line 1814
def get_volume_set(name)
  begin
    @volume_set.get_volume_set(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volume_sets() click to toggle source

Gets the Volume Sets

Returns

Array of VolumeSet

# File lib/Hpe3parSdk/client.rb, line 1790
def get_volume_sets
  begin
    @volume_set.get_volume_sets
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volume_snapshots(name) click to toggle source

Gets the snapshots of a particular volume

Attributes

  • name - the name of the volume

    type name: String
    

Returns

Array of VirtualVolume

# File lib/Hpe3parSdk/client.rb, line 2192
def get_volume_snapshots(name)
  begin
    @volume.get_volume_snapshots(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_volumes() click to toggle source

Gets all Volumes in the array

Returns

Array of VirtualVolume

# File lib/Hpe3parSdk/client.rb, line 1281
def get_volumes
  begin
    @volume.get_volumes(VolumeCopyType::BASE_VOLUME)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_ws_api_configuration_info() click to toggle source

Gets the WSAPI Configuration.

Returns

WSAPI configuration hash

# File lib/Hpe3parSdk/client.rb, line 155
def get_ws_api_configuration_info
  begin
    response = @http.get('/wsapiconfiguration')
    response[1]
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
get_ws_api_version() click to toggle source

Get the 3PAR WS API version.

Returns

WSAPI version hash

# File lib/Hpe3parSdk/client.rb, line 133
def get_ws_api_version
  # remove everything down to host:port
  host_url = @api_url.split('/api')
  @http.set_url(host_url[0])
  begin
    # get the api version
    response = @http.get('/api')
    response[1]
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
ensure
  # reset the url
  @http.set_url(@api_url)
end
grow_volume(name, amount) click to toggle source

Grows an existing volume by 'amount' Mebibytes.

Attributes

  • name - the name of the volume

    type name: String
    
  • amount: the additional size in MiB to add, rounded up to the next chunklet size (e.g. 256 or 1000 MiB)

    type amount: Integer
    

Raises:

# File lib/Hpe3parSdk/client.rb, line 1638
def grow_volume(name, amount)
  begin
    @volume.grow_volume(name, amount)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
host_exists?(host_name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2578
def host_exists?(host_name)
  begin
    @host.host_exists?(host_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
host_set_exists?(host_name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2587
def host_set_exists?(host_name)
  begin
    @host_set.host_set_exists?(host_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
login(username, password, optional = nil) click to toggle source

Attributes

  • username - The username

    type username: String
    
  • password - The Password

    type password: String
    
# File lib/Hpe3parSdk/client.rb, line 346
def login(username, password, optional = nil)
  set_ssh_options(username, password, port=22, conn_timeout=nil)
  @volume = VolumeManager.new(@http, @ssh, @app_type)
  @http.authenticate(username, password, optional)
end
logout() click to toggle source

Logout from the 3PAR Array

# File lib/Hpe3parSdk/client.rb, line 2633
def logout
  unless @log_file_path.nil?
    if Hpe3parSdk.logger != nil
      Hpe3parSdk.logger.close
      Hpe3parSdk.logger = nil
    end
  end
  begin
    @http.unauthenticate
  rescue Hpe3parSdk::HPE3PARException => ex
    #Do nothing
  end
end
modify_cpg(name, cpg_mods) click to toggle source

Modifies a CPG.

Attributes

  • name - Name of the CPG

    type name: String
    
  • optional - hash of other optional items

    type optional: Hash
    
    optional = {
          'newName'=> "newCPG:,          # Specifies the name of the
                                         # CPG to update.
          'disableAutoGrow'=>false,      # Enables (false) or
                                         # disables (true) CPG auto
                                         # grow. Defaults to false.
          'rmGrowthLimit'=> false,       # Enables (false) or
                                         # disables (true) auto grow
                                         # limit enforcement. Defaults
                                         # to false.
          'rmWarningAlert'=> false,      # Enables (false) or
                                         # disables (true) warning
                                         # limit enforcement. Defaults
                                         # to false.
    }
# File lib/Hpe3parSdk/client.rb, line 2387
def modify_cpg(name, cpg_mods)
  begin
    @cpg.modify_cpg(name, cpg_mods)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
modify_host(name, mod_request) click to toggle source

Modifies an existing Host.

Attributes

  • name - Name of the host.

    type name: String
    
  • mod_request - Objects for host modification request.

    type mod_request: Hash
      mod_request = {
          'newName'=> 'myNewName',         # New name of the host
          'pathOperation'=> 1,             # Refer Hpe3parSdk::HostEditOperation for complete enumeration
          '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,                   # Refer Hpe3parSdk::HostPersona for complete enumeration.
          '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'=> 1,             # Refer Hpe3parSdk::HostEditOperation for complete enumeration
          'chapOperationMode'=> TARGET,    # Refer Hpe3parSdk::ChapOperationMode for complete enumeration
          '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

# File lib/Hpe3parSdk/client.rb, line 966
def modify_host(name, mod_request)
  begin
    @host.modify_host(name, mod_request)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
modify_host_set(name, action = nil, setmembers = nil, new_name = nil, comment = nil) click to toggle source

Modifies a HostSet.

Attributes

  • name - Hostset name

    type name: String
    
  • action - Add or Remove host(s) from the set

    type action: Refer values of Hpe3parSdk::SetCustomAction::MEM_ADD and Hpe3parSdk::SetCustomAction::MEM_REMOVE
  • setmembers - Host(s) to add to the set, the existence of the host(s) will not be checked

    type setmembers: Array of String
  • new_name - New name of set

    type new_name: String
    
  • comment - New comment for the set

    type comment: String
    

Raises

# File lib/Hpe3parSdk/client.rb, line 1166
def modify_host_set(name, action = nil, setmembers = nil, new_name = nil, comment = nil)
  begin
    @host_set.modify_host_set(name, action, setmembers, new_name, comment)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
modify_qos_rules(target_name, qos_rules, target_type = QoStargetTypeConstants::VVSET) click to toggle source

Modifies 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

Attributes

  • target_name: Name of the target object on which the QoS rule will be created.

    type target_name: String
    
  • target_type: Type of QoS target, either vvset or sys.Refer Hpe3parSdk::QoStargetTypeConstants for complete enumeration

    type target_type: String
    
  • qos_rules: QoS options

    type qos_rules: Hash
    qos_rules = {
        'priority'=> 2,         # Refer Hpe3parSdk::QoSpriorityEnumeration for complete enumeration
        '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

# File lib/Hpe3parSdk/client.rb, line 747
def modify_qos_rules(target_name, qos_rules, target_type = QoStargetTypeConstants::VVSET)
  if @current_version < @min_version && !qos_rules.nil?
    qos_rules.delete_if { |key, _value| key == :latencyGoaluSecs }
  end
  begin
    @qos.modify_qos_rules(target_name, qos_rules, target_type)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
modify_volume(name, volume_mods) click to toggle source

Modifies a volume

Attributes

  • name - the name of the volume

    type name: String
    
  • volumeMods - Hash of volume attributes to change

    type volumeMods: Hash
     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:

# File lib/Hpe3parSdk/client.rb, line 1558
def modify_volume(name, volume_mods)
  begin
    @volume.modify_volume(name, volume_mods)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
modify_volume_set(name, action = nil, newName = nil, comment = nil, flash_cache_policy = nil, setmembers = nil) click to toggle source

Modifies a volume set by adding or removing a volume from the volume set. It's actions is based on the enums MEM_ADD or MEM_REMOVE.

Attributes

  • action: add or remove volume from the set

    type name: Hpe3parSdk::SetCustomAction
    
  • name: the volume set name

    type name: String
    
  • newName: new name of set

    type newName: String
    
  • comment: the comment for on the vv set

    type comment: String
    
  • flash_cache_policy: the flash-cache policy for the vv set

    type flash_cache_policy: enum
    
  • setmembers: the vv to add to the set, the existence of the vv will not be checked

    type name: Array of String

Raises

# File lib/Hpe3parSdk/client.rb, line 1939
def modify_volume_set(name, action = nil, newName = nil, comment = nil, flash_cache_policy = nil, setmembers = nil)
  begin
    @volume_set.modify_volume_set(name, action, newName, comment, flash_cache_policy, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
offline_physical_copy_exists?(src_name, phy_copy_name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2623
def offline_physical_copy_exists?(src_name, phy_copy_name)
  begin
    @volume.offline_physical_copy_exists?(src_name, phy_copy_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
online_physical_copy_exists?(src_name, phy_copy_name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2614
def online_physical_copy_exists?(src_name, phy_copy_name)
  begin
    @volume.online_physical_copy_exists?(src_name, phy_copy_name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
qos_rule_exists?(target_name, target_type = 'vvset') click to toggle source
# File lib/Hpe3parSdk/client.rb, line 574
def qos_rule_exists?(target_name, target_type = 'vvset')
   begin
    @qos.qos_rule_exists?(target_name, target_type)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
query_host_by_fc_path(wwn = nil) click to toggle source

Finds the host with the specified FC WWN path.

Attributes

  • wwn - Lookup based on WWN.

    type wwn: String
    

Returns

Host with specified FC WWN.

Raises

# File lib/Hpe3parSdk/client.rb, line 1018
def query_host_by_fc_path(wwn = nil)
  begin
    @host.query_host_by_fc_path(wwn)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
query_host_by_iscsi_path(iqn = nil) click to toggle source

Finds the host with the specified iSCSI initiator.

Attributes

  • iqn - Lookup based on iSCSI initiator.

    type iqn: String
    

Returns

Host with specified IQN.

Raises

# File lib/Hpe3parSdk/client.rb, line 1048
def query_host_by_iscsi_path(iqn = nil)
  begin
    @host.query_host_by_iscsi_path(iqn)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
query_qos_rule(target_name, target_type = 'vvset') click to toggle source

Queries a QoS rule

Attributes

  • target_name : Name of the target. When targetType is sys, target name must be sys:all_others.

    type target_name: String
    
  • target_type : Target type is vvset or sys

    type target_type: String
    

Returns

QoSRule object

Raises

# File lib/Hpe3parSdk/client.rb, line 565
def query_qos_rule(target_name, target_type = 'vvset')
  begin
    @qos.query_qos_rule(target_name, target_type)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
query_qos_rules() click to toggle source

Gets QoS Rules.

Returns

Array of QoSRule objects

# File lib/Hpe3parSdk/client.rb, line 538
def query_qos_rules
  begin
    @qos.query_qos_rules
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end    
end
remove_hosts_from_host_set(set_name, setmembers) click to toggle source

Removes host(s) from a host set.

Attributes

  • set_name - The host set name.

    type set_name: String
    
  • setmembers - Array of host names to remove from the set.

    type setmembers: Array of String
# File lib/Hpe3parSdk/client.rb, line 1200
def remove_hosts_from_host_set(set_name, setmembers)
  begin
    @host_set.remove_hosts_from_host_set(set_name, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
remove_volumes_from_volume_set(set_name, setmembers) click to toggle source

Removes a volume from a volume set

Attributes

  • set_name - the volume set name

    type set_name: String
    
  • name - the volume name to remove

    type name: String
    
# File lib/Hpe3parSdk/client.rb, line 1974
def remove_volumes_from_volume_set(set_name, setmembers)
  begin
    @volume_set.remove_volumes_from_volume_set(set_name, setmembers)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
restore_snapshot(name, optional = nil) click to toggle source

Restores from a snapshot to a volume

Attributes

  • name - the name of the Snapshot

    type name: String
    
  • optional - hash of other optional items

    type name: Hash
    
    optional = {
           'online' => false,                # Enables (true) or disables
                                             #(false) executing the promote
                                             #operation on an online volume.
                                             #The default setting is false
    
           'priority' => 2                   #Does not apply to online promote
                                             #operation or to stop promote
                                             #operation.
    
           'allowRemoteCopyParent' => false  #Allows the promote operation to
                                             #proceed even if the RW parent
                                             #volume is currently in a Remote
                                             #Copy volume group, if that group
                                             #has not been started. If the
                                             #Remote Copy group has been
                                             #started, this command fails.
                                             #(WSAPI 1.6 and later.)
    }
# File lib/Hpe3parSdk/client.rb, line 2140
def restore_snapshot(name, optional = nil)
  if @current_version < @min_version_with_compression && !optional.nil?
    optional.delete_if { |key, _value| key == :allowRemoteCopyParent }
  end
  begin
    @volume.restore_snapshot(name, optional)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
resync_physical_copy(name) click to toggle source

Resynchronizes a physical copy.

Attributes

  • name - The name of the volume

    type name: String
    
# File lib/Hpe3parSdk/client.rb, line 2504
def resync_physical_copy(name)
  begin
    @volume.resync_physical_copy(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
stop_offline_physical_copy(name) click to toggle source

Stops an offline physical copy operation

Attributes

  • name - The name of the volume

    type name: String
    
# File lib/Hpe3parSdk/client.rb, line 2474
def stop_offline_physical_copy(name)
  begin
    @volume.stop_offline_physical_copy(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
stop_online_physical_copy(name) click to toggle source

Stops an online physical copy operation

Attributes

  • name - The name of the volume

    type name: String
    
# File lib/Hpe3parSdk/client.rb, line 2489
def stop_online_physical_copy(name)
  begin
    @volume.stop_online_physical_copy(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
tune_volume(name, tune_operation, optional = nil) click to toggle source

Tunes a volume

Attributes

  • name - the volume name

    type name: String
    
  • tune_operation - Enum of tune operation - 1: Change User CPG, 2: Change snap CPG

    type dest_name: Integer
    
  • optional - hash of optional parameters

    type optional: hash
    
    optional = {
     'userCPG' => 'user_cpg',        # Specifies the new user
                                     # CPG to which the volume
                                     # will be tuned.
     'snapCPG' => 'snap_cpg',        # Specifies the snap CPG to
                                     # which the volume will be
                                     # tuned.
     'conversionOperation' => 1,     # conversion operation enum. Refer Hpe3parSdk::VolumeConversionOperation
     'keepVV' => 'new_volume',       # Name of the new volume
                                     # where the original logical disks are saved.
     'compression' => true           # Enables (true) or disables (false) compression.
                                     # You cannot compress a fully provisioned volume.
    }
    
# File lib/Hpe3parSdk/client.rb, line 1739
def tune_volume(name, tune_operation, optional = nil)
  if @current_version < @min_version_with_compression && !optional.nil?
    optional.delete_if { |key, _value| key == :compression }
  end
  begin
    object_hash = @volume.tune_volume(name, tune_operation, optional)
    get_task(object_hash['taskid'])
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
vlun_exists?(volname,lunid,host=nil,port=nil) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 397
def vlun_exists?(volname,lunid,host=nil,port=nil)
  begin
     @vlun.vlun_exists?(volname,lunid,host,port)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
volume_exists?(name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2560
def volume_exists?(name)
  begin
    @volume.volume_exists?(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
volume_set_exists?(name) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 2569
def volume_set_exists?(name)
  begin
    @volume_set.volume_set_exists?(name)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end
wait_for_task_to_end(task_id, poll_rate_secs = 15) click to toggle source

Waits for a 3PAR task to end.

Attributes

  • task_id - The Id of the task to be waited upon.

    type task_id: Integer
    
  • poll_rate_secs - The polling interval in seconds.

    type poll_rate_secs: Integer
    
# File lib/Hpe3parSdk/client.rb, line 2521
def wait_for_task_to_end(task_id, poll_rate_secs = 15)
  begin
    @task.wait_for_task_to_end(task_id, poll_rate_secs)
  rescue => ex
    Util.log_exception(ex, caller_locations(1, 1)[0].label)
    raise ex
  end
end

Private Instance Methods

check_WSAPI_version() click to toggle source
# File lib/Hpe3parSdk/client.rb, line 77
        def check_WSAPI_version
  begin
    @api_version = get_ws_api_version
  rescue HPE3PARException => ex
    ex_message = ex.message
    if ex_message && ex_message.include?('SSL Certificate Verification Failed')
      raise Hpe3parSdk::SSLCertFailed
    else
      msg = "Error: #{ex_message} - Error communicating with 3PAR WSAPI. '
      'Check proxy settings. If error persists, either the '
      '3PAR WSAPI is not running OR the version of the WSAPI is '
      'not supported."
      raise Hpe3parSdk::HPE3PARException(message: msg)
    end
  end

  compare_version(@api_version)

end
compare_version(api_version) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 101
        def compare_version(api_version)
  @min_version = WSAPIVersion
                     .parse(WSAPIVersionSupport::WSAPI_MIN_SUPPORTED_VERSION)
  @min_version_with_compression = WSAPIVersion
                                      .parse(WSAPIVersionSupport::WSAPI_MIN_VERSION_COMPRESSION_SUPPORT)

  @current_version = WSAPIVersion.new(api_version['major'], api_version['minor'],
                                      api_version['revision'])
  if @current_version < @min_version
    err_msg = "Unsupported 3PAR WS API version #{@current_version}, min supported version is, #{WSAPIVersionSupport::WSAPI_MIN_SUPPORTED_VERSION}"
    raise Hpe3parSdk::UnsupportedVersion.new(nil, err_msg)
  end

  # Check for VLUN query support.
  min_vlun_query_support_version = WSAPIVersion
                                       .parse(WSAPIVersionSupport::WSAPI_MIN_VERSION_VLUN_QUERY_SUPPORT)
  if @current_version >= min_vlun_query_support_version
    @vlun_query_supported = true
  end

  # Check for Host and VV Set query support
  if @current_version >= @min_version_with_compression
    @host_and_vv_set_filter_supported = true
  end

end
init_log() click to toggle source
# File lib/Hpe3parSdk/client.rb, line 64
        def init_log
  unless @log_file_path.nil?
    client_logger = Logger.new(@log_file_path, 'daily', formatter: CustomFormatter.new)
  else
    client_logger = Logger.new(STDOUT)
  end
  if @debug
    @log_level = Logger::DEBUG
  end
  Hpe3parSdk.logger = MultiLog.new(:level => @log_level, :loggers => client_logger)
end
set_ssh_options(username, password, port=22, conn_timeout=nil) click to toggle source
# File lib/Hpe3parSdk/client.rb, line 97
        def set_ssh_options(username, password, port=22, conn_timeout=nil)
  @ssh=Hpe3parSdk::SSH.new(@api_url.split("//")[1].split(":")[0], username, password)
end