Class: HPE3PAR_API
- Inherits:
-
Object
- Object
- HPE3PAR_API
- Defined in:
- lib/puppet/util/hpe3par_api.rb
Constant Summary collapse
- DEBUG_MODE =
false
Instance Attribute Summary collapse
-
#rest_url ⇒ Object
Returns the value of attribute rest_url.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #add_fc_path_to_host(host_name, fc_wwns, debug = false) ⇒ Object
- #add_hosts_to_host_set(host_set_name, setmembers, debug = false) ⇒ Object
- #add_initiator_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) ⇒ Object
- #add_iscsi_path_to_host(host_name, iscsi_names, debug = false) ⇒ Object
- #add_target_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) ⇒ Object
- #add_volumes_to_volume_set(volume_set_name, setmembers, debug = false) ⇒ Object
- #change_snap_cpg(name, snap_cpg, wait_for_task_to_end, debug = false) ⇒ Object
- #change_user_cpg(name, user_cpg, wait_for_task_to_end, debug = false) ⇒ Object
- #convert_to_binary_multiple(size, size_unit) ⇒ Object
- #convert_to_hours(time, unit) ⇒ Object
- #convert_volume_type(name, user_cpg, type, keep_vv = nil, compression = false, wait_for_task_to_end = false, debug = false) ⇒ Object
- #cpg_exists?(name, debug = false) ⇒ Boolean
- #cpg_ldlayout_map(ldlayout_hash) ⇒ Object
- #create_cpg(name, domain = nil, growth_increment = nil, growth_increment_unit = nil, growth_limit = nil, growth_limit_unit = nil, growth_warning = nil, growth_warning_unit = nil, raidtype = nil, setSize = nil, highavailability = nil, disktype = nil, debug = false) ⇒ Object
- #create_flash_cache(size_in_gib, mode = nil, debug = false) ⇒ Object
- #create_host(host_name, domain = nil, fcwwns = nil, iscsi_names = nil, persona = nil, debug = false) ⇒ Object
- #create_host_set(host_set_name, domain = nil, setmembers = nil, debug = false) ⇒ Object
- #create_offline_clone(base_volume_name, clone_name, dest_cpg = nil, online = false, save_snapshot = nil, priority = nil, skip_zero = nil, debug = false) ⇒ Object
- #create_online_clone(base_volume_name, clone_name, dest_cpg = nil, online = true, tpvv = nil, tdvv = nil, snap_cpg = nil, compression = nil, debug = false) ⇒ Object
- #create_qos_rules(target_name, target_type, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal = nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) ⇒ Object
- #create_snapshot(name, base_volume_name, read_only = nil, expiration_time = nil, retention_time = nil, expiration_unit = nil, retention_unit = nil, debug = false) ⇒ Object
- #create_vlun(volume_name, lunid = nil, host_name = nil, node = nil, slot = nil, card_port = nil, auto = true, debug = false) ⇒ Object
- #create_volume(volume_name, cpg_name, size, size_unit, type = 'thin', compression = false, snap_cpg = nil, debug = false) ⇒ Object
- #create_volume_set(volume_set_name, domain = nil, setmembers = nil, debug = false) ⇒ Object
- #delete_clone(clone_name, debug = false) ⇒ Object
- #delete_cpg(name, debug = false) ⇒ Object
- #delete_flash_cache(debug = false) ⇒ Object
- #delete_host(host_name, debug = false) ⇒ Object
- #delete_host_set(host_set_name, debug = false) ⇒ Object
- #delete_qos_rules(target_name, target_type, debug = false) ⇒ Object
- #delete_snapshot(snapshot_name, force_delete = false, debug = false) ⇒ Object
- #delete_vlun(volume_name, lunid, host_name = nil, node = nil, slot = nil, card_port = nil, debug = false) ⇒ Object
- #delete_volume(volume_name, debug = false) ⇒ Object
- #delete_volume_set(volume_set_name, debug = false) ⇒ Object
- #flash_cache_exists?(debug = false) ⇒ Boolean
- #get_host_set(host_set, debug = false) ⇒ Object
- #get_storage_system_info(debug = false) ⇒ Object
- #get_volume(volume_name, debug = false) ⇒ Object
- #get_volume_set(volume_set, debug = false) ⇒ Object
- #get_volume_type(type) ⇒ Object
- #grow_to_size(volume_name, size, size_unit, debug = false) ⇒ Object
- #grow_volume(volume_name, size, size_unit, debug = false) ⇒ Object
- #host_exists?(name, debug = false) ⇒ Boolean
- #hostset_exists?(name, debug = false) ⇒ Boolean
-
#initialize(url, options = {}) ⇒ HPE3PAR_API
constructor
A new instance of HPE3PAR_API.
- #initiator_chap_exists?(host_name, debug = false) ⇒ Boolean
- #modify_base_volume(volume_name, new_name = nil, expiration_time = nil, retention_time = nil, ss_spc_alloc_warning_pct = nil, ss_spc_alloc_limit_pct = nil, usr_spc_alloc_warning_pct = nil, usr_spc_alloc_limit_pct = nil, rm_ss_spc_alloc_warning = nil, rm_usr_spc_alloc_warning = nil, rm_exp_time = nil, rm_ss_spc_alloc_limit = nil, rm_usr_spc_alloc_limit = nil, debug = false) ⇒ Object
- #modify_host(host_name, new_name = nil, persona = nil, domain = nil, debug = false) ⇒ Object
- #modify_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal = nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) ⇒ Object
- #modify_snapshot(name, new_name, expiration_hours, retention_hours, rm_exp_time, debug = false) ⇒ Object
- #modify_volume(volume_name, new_name, expiration_time, retention_time, snap_cpg, user_cpg, ss_spc_alloc_warning_pct, ss_spc_alloc_limit_pct, usr_spc_alloc_warning_pct, usr_spc_alloc_limit_pct, rm_ss_spc_alloc_warning, rm_usr_spc_alloc_warning, rm_exp_time, rm_ss_spc_alloc_limit, rm_usr_spc_alloc_limit, debug = false) ⇒ Object
- #offline_clone_exists?(name, base_volume_name, debug = false) ⇒ Boolean
- #offline_physical_copy_exists?(src_name, phy_copy_name, debug = false) ⇒ Boolean
- #online_physical_copy_exists?(src_name, phy_copy_name, debug = false) ⇒ Boolean
- #qos_rule_exists?(target_name, target_type, debug = false) ⇒ Boolean
- #remove_fc_path_from_host(host_name, fc_wwns, force_path_removal, debug = false) ⇒ Object
- #remove_hosts_from_host_set(host_set_name, setmembers, debug = false) ⇒ Object
- #remove_initiator_chap(host_name, debug = false) ⇒ Object
- #remove_iscsi_path_from_host(host_name, iscsi_names, force_path_removal, debug = false) ⇒ Object
- #remove_target_chap(host_name, debug = false) ⇒ Object
- #remove_volumes_from_volume_set(volume_set_name, setmembers, debug = false) ⇒ Object
- #restore_snapshot_offline(snapshot_name, priority, allow_remote_copy_parent, debug = false) ⇒ Object
- #restore_snapshot_online(snapshot_name, allow_remote_copy_parent, debug = false) ⇒ Object
- #resync_clone(clone_name, debug = false) ⇒ Object
- #set_snap_cpg(volume_name, snap_cpg, debug = false) ⇒ Object
- #stop_clone(clone_name, debug = false) ⇒ Object
- #validate ⇒ Object
- #vlun_exists?(volume_name, lunid, host_name = nil, node = nil, slot = nil, card_port = nil, debug = false) ⇒ Boolean
- #volume_exists?(name, debug = false) ⇒ Boolean
- #volume_set_exists?(name, debug = false) ⇒ Boolean
Constructor Details
#initialize(url, options = {}) ⇒ HPE3PAR_API
Returns a new instance of HPE3PAR_API.
27 28 29 30 31 |
# File 'lib/puppet/util/hpe3par_api.rb', line 27 def initialize(url, = {}) @url = URI.parse(url) validate @rest_url = "#{@url.scheme}://#{@url.host}:#{@url.port}/api/v1" end |
Instance Attribute Details
#rest_url ⇒ Object
Returns the value of attribute rest_url.
25 26 27 |
# File 'lib/puppet/util/hpe3par_api.rb', line 25 def rest_url @rest_url end |
#url ⇒ Object
Returns the value of attribute url.
25 26 27 |
# File 'lib/puppet/util/hpe3par_api.rb', line 25 def url @url end |
Instance Method Details
#add_fc_path_to_host(host_name, fc_wwns, debug = false) ⇒ Object
804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
# File 'lib/puppet/util/hpe3par_api.rb', line 804 def add_fc_path_to_host(host_name, fc_wwns, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'pathOperation' => Hpe3parSdk::HostEditOperation.const_get('ADD'), 'FCWWNs' => fc_wwns} cl.modify_host(host_name, mod_request) Puppet.info("FC path #{fc_wwns} added to host #{host_name}") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#add_hosts_to_host_set(host_set_name, setmembers, debug = false) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/puppet/util/hpe3par_api.rb', line 107 def add_hosts_to_host_set(host_set_name, setmembers, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin current_set_members = get_host_set(host_set_name).setmembers if !current_set_members.nil? new_set_members = setmembers - current_set_members else new_set_members = setmembers end if !new_set_members.nil? and new_set_members.any? cl.login(@url.user, @url.password) cl.add_hosts_to_host_set(host_set_name, new_set_members) end ensure cl.logout end end |
#add_initiator_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) ⇒ Object
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 |
# File 'lib/puppet/util/hpe3par_api.rb', line 738 def add_initiator_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'chapOperationMode' => Hpe3parSdk::ChapOperationMode.const_get('INITIATOR'), 'chapOperation' => Hpe3parSdk::HostEditOperation.const_get('ADD'), 'chapName' => chap_name, 'chapSecret' => chap_secret, 'chapSecretHex' => chap_secret_hex} cl.modify_host(host_name, mod_request) Puppet.info("Host #{host_name} modified to add initiator chap") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#add_iscsi_path_to_host(host_name, iscsi_names, debug = false) ⇒ Object
837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'lib/puppet/util/hpe3par_api.rb', line 837 def add_iscsi_path_to_host(host_name, iscsi_names, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'pathOperation' => Hpe3parSdk::HostEditOperation.const_get('ADD'), 'iSCSINames' => iscsi_names} cl.modify_host(host_name, mod_request) Puppet.info("iSCSI path #{iscsi_names} added to host #{host_name}") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#add_target_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) ⇒ Object
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 |
# File 'lib/puppet/util/hpe3par_api.rb', line 771 def add_target_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'chapOperationMode' => Hpe3parSdk::ChapOperationMode.const_get('TARGET'), 'chapOperation' => Hpe3parSdk::HostEditOperation.const_get('ADD'), 'chapName' => chap_name, 'chapSecret' => chap_secret, 'chapSecretHex' => chap_secret_hex} cl.modify_host(host_name, mod_request) Puppet.info("Host #{host_name} modified to add target chap") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#add_volumes_to_volume_set(volume_set_name, setmembers, debug = false) ⇒ Object
954 955 956 957 958 959 960 961 962 963 964 965 966 967 |
# File 'lib/puppet/util/hpe3par_api.rb', line 954 def add_volumes_to_volume_set(volume_set_name, setmembers, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.add_volumes_to_volume_set(volume_set_name, setmembers) Puppet.info("Added volumes #{setmembers} to volume set #{volume_set_name} successfully") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#change_snap_cpg(name, snap_cpg, wait_for_task_to_end, debug = false) ⇒ Object
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/puppet/util/hpe3par_api.rb', line 527 def change_snap_cpg(name, snap_cpg, wait_for_task_to_end, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) task = cl.tune_volume(name, Hpe3parSdk::VolumeTuneOperation::SNP_CPG, {:snapCPG => snap_cpg}) if wait_for_task_to_end Puppet.info("Waiting for change snap CPG task of volume #{name} to complete") cl.wait_for_task_to_end(task.task_id) end Puppet.info("Snap CPG of Volume #{name} changed to #{snap_cpg} successfully") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#change_user_cpg(name, user_cpg, wait_for_task_to_end, debug = false) ⇒ Object
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/puppet/util/hpe3par_api.rb', line 546 def change_user_cpg(name, user_cpg, wait_for_task_to_end, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) task = cl.tune_volume(name, Hpe3parSdk::VolumeTuneOperation::USR_CPG, {:userCPG => user_cpg}) if wait_for_task_to_end Puppet.info("Waiting for change user CPG task of volume #{name} to complete") cl.wait_for_task_to_end(task.task_id) end Puppet.info("User CPG of Volume #{name} changed to #{user_cpg} successfully") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#convert_to_binary_multiple(size, size_unit) ⇒ Object
384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/puppet/util/hpe3par_api.rb', line 384 def convert_to_binary_multiple(size, size_unit) size_MiB = 0 if size_unit == 'GiB' size_MiB = size * 1024 elsif size_unit == 'TiB' size_MiB = size * 1048576 elsif size_unit == 'MiB' size_MiB = size end return size_MiB.to_i end |
#convert_to_hours(time, unit) ⇒ Object
409 410 411 412 413 414 415 416 417 |
# File 'lib/puppet/util/hpe3par_api.rb', line 409 def convert_to_hours(time, unit) hours = 0 if unit == 'Days' hours = time * 24 elsif unit == 'Hours' hours = time end return hours end |
#convert_volume_type(name, user_cpg, type, keep_vv = nil, compression = false, wait_for_task_to_end = false, debug = false) ⇒ Object
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/puppet/util/hpe3par_api.rb', line 565 def convert_volume_type(name, user_cpg, type, keep_vv = nil, compression = false, wait_for_task_to_end = false, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) new_vol_type = get_volume_type(type) task = cl.tune_volume(name, Hpe3parSdk::VolumeTuneOperation::USR_CPG, {:userCPG => user_cpg, :conversionOperation => Hpe3parSdk::VolumeConversionOperation.const_get(new_vol_type), :keepVV => keep_vv, :compression => compression }) if wait_for_task_to_end Puppet.info("Waiting for type conversion task of volume #{name} to complete") cl.wait_for_task_to_end(task.task_id) end Puppet.info("Volume #{name} type changed to #{type} successfully") rescue Hpe3parSdk::HTTPConflict => ex Puppet.err(ex.) Puppet.err('An error occured. This maybe due to the existence of a back-up volume (using the keepvv option) created during a previous run.') raise ex rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#cpg_exists?(name, debug = false) ⇒ Boolean
205 206 207 208 209 210 211 212 213 |
# File 'lib/puppet/util/hpe3par_api.rb', line 205 def cpg_exists?(name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.cpg_exists?(name) ensure cl.logout end end |
#cpg_ldlayout_map(ldlayout_hash) ⇒ Object
396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/puppet/util/hpe3par_api.rb', line 396 def cpg_ldlayout_map(ldlayout_hash) if !ldlayout_hash[:RAIDType].nil? && !ldlayout_hash[:RAIDType].empty? ldlayout_hash[:RAIDType] = Hpe3parSdk::CPGRAIDType .const_get(ldlayout_hash[:RAIDType]) end if !ldlayout_hash[:HA].nil? && !ldlayout_hash[:HA].empty? ldlayout_hash[:HA] = Hpe3parSdk::CPGHA .const_get(ldlayout_hash[:HA]) end return ldlayout_hash end |
#create_cpg(name, domain = nil, growth_increment = nil, growth_increment_unit = nil, growth_limit = nil, growth_limit_unit = nil, growth_warning = nil, growth_warning_unit = nil, raidtype = nil, setSize = nil, highavailability = nil, disktype = nil, debug = false) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/puppet/util/hpe3par_api.rb', line 39 def create_cpg(name, domain = nil, growth_increment = nil, growth_increment_unit = nil, growth_limit = nil, growth_limit_unit = nil, growth_warning = nil, growth_warning_unit = nil, raidtype = nil, setSize = nil, highavailability = nil, disktype = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin ldLayout = Hash.new diskPatterns = [] if !disktype.nil? && !disktype.empty? disktype = Hpe3parSdk::CPGDiskType.const_get(disktype) diskPatterns= [{:diskType => disktype}] end ldLayout = { :RAIDType => raidtype, :setSize => setSize, :HA => highavailability, :diskPatterns => diskPatterns } ldLayout = cpg_ldlayout_map(ldLayout) growth_increment = convert_to_binary_multiple(growth_increment, growth_increment_unit) unless growth_increment.nil? growth_limit = convert_to_binary_multiple(growth_limit, growth_limit_unit) unless growth_limit.nil? growth_warning = convert_to_binary_multiple(growth_warning, growth_warning_unit) unless growth_warning.nil? optional_hash= { :domain => domain, :growthIncrementMiB => growth_increment, :growthLimitMiB => growth_limit, :usedLDWarningAlertMiB => growth_warning, :LDLayout => ldLayout } cl.login(@url.user, @url.password) cl.create_cpg(name, optional_hash) ensure cl.logout end end |
#create_flash_cache(size_in_gib, mode = nil, debug = false) ⇒ Object
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'lib/puppet/util/hpe3par_api.rb', line 892 def create_flash_cache(size_in_gib, mode = nil, debug = false) mode = mode.to_s if mode == 'simulator' mode = 1 else mode = 2 end cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.create_flash_cache(size_in_gib, mode) ensure cl.logout end end |
#create_host(host_name, domain = nil, fcwwns = nil, iscsi_names = nil, persona = nil, debug = false) ⇒ Object
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# File 'lib/puppet/util/hpe3par_api.rb', line 695 def create_host(host_name, domain = nil, fcwwns = nil, iscsi_names = nil, persona = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional = {} unless domain.nil? optional['domain'] = domain end unless persona.nil? optional['persona'] = Hpe3parSdk::HostPersona.const_get(persona) end cl.create_host(host_name, iscsi_names, fcwwns, optional) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#create_host_set(host_set_name, domain = nil, setmembers = nil, debug = false) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/puppet/util/hpe3par_api.rb', line 87 def create_host_set(host_set_name, domain = nil, setmembers = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.create_host_set(host_set_name, domain, nil, setmembers) ensure cl.logout end end |
#create_offline_clone(base_volume_name, clone_name, dest_cpg = nil, online = false, save_snapshot = nil, priority = nil, skip_zero = nil, debug = false) ⇒ Object
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1000 def create_offline_clone(base_volume_name, clone_name, dest_cpg=nil, online=false, save_snapshot=nil, priority=nil, skip_zero=nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional = {:online => online, :skipZero => skip_zero, :saveSnapshot => save_snapshot } optional[:priority] = Hpe3parSdk::TaskPriority.const_get(priority) cl.create_physical_copy(base_volume_name, clone_name, dest_cpg, optional) ensure cl.logout end end |
#create_online_clone(base_volume_name, clone_name, dest_cpg = nil, online = true, tpvv = nil, tdvv = nil, snap_cpg = nil, compression = nil, debug = false) ⇒ Object
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1019 def create_online_clone(base_volume_name, clone_name, dest_cpg=nil, online=true, tpvv=nil, tdvv=nil, snap_cpg=nil, compression=nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional = {:online => online, :tpvv => tpvv, :tdvv => tdvv, :snapCPG => snap_cpg, :compression => compression } cl.create_physical_copy(base_volume_name, clone_name, dest_cpg, optional) ensure cl.logout end end |
#create_qos_rules(target_name, target_type, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal = nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/puppet/util/hpe3par_api.rb', line 225 def create_qos_rules(target_name, target_type, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal= nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin qos_rules = { :bwMinGoalKB => bwMinGoalKB, :bwMaxLimitKB => bwMaxLimitKB, :ioMinGoal => ioMinGoal, :ioMaxLimit => ioMaxLimit, :latencyGoal => latencyGoal, :defaultLatency => defaultLatency, :enable => enable, :latencyGoaluSecs => latencyGoaluSecs } unless priority.nil? qos_rules[:priority] = Hpe3parSdk::QoSpriorityEnumeration.const_get(priority) end unless bwMinGoalOP.nil? qos_rules[:bwMinGoalOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(bwMinGoalOP) end unless bwMaxLimitOP.nil? qos_rules[:bwMaxLimitOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(bwMaxLimitOP) end unless ioMinGoalOP.nil? qos_rules[:ioMinGoalOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(ioMinGoalOP) end unless ioMaxLimitOP.nil? qos_rules[:ioMaxLimitOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(ioMaxLimitOP) end cl.login(@url.user, @url.password) cl.create_qos_rules(target_name, qos_rules, target_type = Hpe3parSdk::QoStargetType.const_get(target_type)) ensure cl.logout end end |
#create_snapshot(name, base_volume_name, read_only = nil, expiration_time = nil, retention_time = nil, expiration_unit = nil, retention_unit = nil, debug = false) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/puppet/util/hpe3par_api.rb', line 143 def create_snapshot(name, base_volume_name, read_only=nil, expiration_time=nil, retention_time=nil, expiration_unit=nil, retention_unit=nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional_hash= { :readOnly => read_only, :expirationHours => convert_to_hours(expiration_time, expiration_unit), :retentionHours => convert_to_hours(retention_time, retention_unit) } cl.create_snapshot(name, base_volume_name, optional_hash) ensure cl.logout end end |
#create_vlun(volume_name, lunid = nil, host_name = nil, node = nil, slot = nil, card_port = nil, auto = true, debug = false) ⇒ Object
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/puppet/util/hpe3par_api.rb', line 346 def create_vlun(volume_name, lunid = nil, host_name=nil, node = nil, slot = nil, card_port = nil, auto = true, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) port_pos = nil if !node.nil? && !slot.nil? && !card_port.nil? port_pos={ :node => node, :slot => slot, :cardPort => card_port } end begin cl.login(@url.user, @url.password) cl.create_vlun(volume_name, lunid, host_name, port_pos, no_vcn = nil, override_lower_priority = nil, auto) ensure cl.logout end end |
#create_volume(volume_name, cpg_name, size, size_unit, type = 'thin', compression = false, snap_cpg = nil, debug = false) ⇒ Object
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/puppet/util/hpe3par_api.rb', line 420 def create_volume(volume_name, cpg_name, size, size_unit, type = 'thin', compression = false, snap_cpg = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug, app_type: 'puppet-3par') size_MiB = convert_to_binary_multiple(size, size_unit) tpvv = false tdvv = false if type == 'thin' tpvv = true elsif type == 'thin_dedupe' tdvv = true end optional_hash= { :tpvv => tpvv, :tdvv => tdvv, :compression => compression, :snapCPG => snap_cpg } begin cl.login(@url.user, @url.password) cl.create_volume(volume_name, cpg_name, size_MiB, optional_hash) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#create_volume_set(volume_set_name, domain = nil, setmembers = nil, debug = false) ⇒ Object
629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/puppet/util/hpe3par_api.rb', line 629 def create_volume_set(volume_set_name, domain=nil, setmembers=nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.create_volume_set(volume_set_name, domain, nil, setmembers) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#delete_clone(clone_name, debug = false) ⇒ Object
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1048 def delete_clone(clone_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_volume(clone_name) ensure cl.logout end end |
#delete_cpg(name, debug = false) ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/puppet/util/hpe3par_api.rb', line 77 def delete_cpg(name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_cpg(name) ensure cl.logout end end |
#delete_flash_cache(debug = false) ⇒ Object
908 909 910 911 912 913 914 915 916 |
# File 'lib/puppet/util/hpe3par_api.rb', line 908 def delete_flash_cache(debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_flash_cache ensure cl.logout end end |
#delete_host(host_name, debug = false) ⇒ Object
870 871 872 873 874 875 876 877 878 879 880 |
# File 'lib/puppet/util/hpe3par_api.rb', line 870 def delete_host(host_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_host(host_name) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#delete_host_set(host_set_name, debug = false) ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/puppet/util/hpe3par_api.rb', line 97 def delete_host_set(host_set_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_host_set(host_set_name) ensure cl.logout end end |
#delete_qos_rules(target_name, target_type, debug = false) ⇒ Object
305 306 307 308 309 310 311 312 313 314 |
# File 'lib/puppet/util/hpe3par_api.rb', line 305 def delete_qos_rules(target_name, target_type, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_qos_rules(target_name, Hpe3parSdk::QoStargetTypeConstants.const_get(target_type)) ensure cl.logout end end |
#delete_snapshot(snapshot_name, force_delete = false, debug = false) ⇒ Object
158 159 160 161 162 163 164 165 166 |
# File 'lib/puppet/util/hpe3par_api.rb', line 158 def delete_snapshot(snapshot_name, force_delete=false, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_snapshot(snapshot_name) ensure cl.logout end end |
#delete_vlun(volume_name, lunid, host_name = nil, node = nil, slot = nil, card_port = nil, debug = false) ⇒ Object
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/puppet/util/hpe3par_api.rb', line 366 def delete_vlun(volume_name, lunid, host_name = nil, node = nil, slot = nil, card_port = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) port_pos = nil if !node.nil? && !slot.nil? && !card_port.nil? port_pos={ :node => node, :slot => slot, :cardPort => card_port } end begin cl.login(@url.user, @url.password) cl.delete_vlun(volume_name, lunid, host_name, port_pos) ensure cl.logout end end |
#delete_volume(volume_name, debug = false) ⇒ Object
607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/puppet/util/hpe3par_api.rb', line 607 def delete_volume(volume_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_volume(volume_name) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#delete_volume_set(volume_set_name, debug = false) ⇒ Object
641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/puppet/util/hpe3par_api.rb', line 641 def delete_volume_set(volume_set_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.delete_volume_set(volume_set_name) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#flash_cache_exists?(debug = false) ⇒ Boolean
918 919 920 921 922 923 924 925 926 |
# File 'lib/puppet/util/hpe3par_api.rb', line 918 def flash_cache_exists?(debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.flash_cache_exists? ensure cl.logout end end |
#get_host_set(host_set, debug = false) ⇒ Object
663 664 665 666 667 668 669 670 671 672 673 |
# File 'lib/puppet/util/hpe3par_api.rb', line 663 def get_host_set(host_set, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.get_host_set(host_set) rescue Hpe3parSdk::HPE3PARException => ex raise ex ensure cl.logout end end |
#get_storage_system_info(debug = false) ⇒ Object
1069 1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1069 def get_storage_system_info(debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.get_storage_system_info ensure cl.logout end end |
#get_volume(volume_name, debug = false) ⇒ Object
675 676 677 678 679 680 681 682 683 |
# File 'lib/puppet/util/hpe3par_api.rb', line 675 def get_volume(volume_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.get_volume(volume_name) ensure cl.logout end end |
#get_volume_set(volume_set, debug = false) ⇒ Object
685 686 687 688 689 690 691 692 693 |
# File 'lib/puppet/util/hpe3par_api.rb', line 685 def get_volume_set(volume_set, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.get_volume_set(volume_set) ensure cl.logout end end |
#get_volume_type(type) ⇒ Object
595 596 597 598 599 600 601 602 603 604 605 |
# File 'lib/puppet/util/hpe3par_api.rb', line 595 def get_volume_type(type) enum_type = '' if type == 'thin' enum_type = 'TPVV' elsif type == 'thin_dedupe' enum_type = 'TDVV' elsif type == 'full' enum_type = 'FPVV' end return enum_type end |
#grow_to_size(volume_name, size, size_unit, debug = false) ⇒ Object
512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/puppet/util/hpe3par_api.rb', line 512 def grow_to_size(volume_name, size, size_unit, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) size_MiB = convert_to_binary_multiple(size, size_unit) cl.grow_to_size(volume_name, size_MiB) Puppet.info("Volume #{volume_name} grown") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#grow_volume(volume_name, size, size_unit, debug = false) ⇒ Object
497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/puppet/util/hpe3par_api.rb', line 497 def grow_volume(volume_name, size, size_unit, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) size_MiB = convert_to_binary_multiple(size, size_unit) cl.grow_volume(volume_name, size_MiB) Puppet.info("Volume #{volume_name} growth successful") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#host_exists?(name, debug = false) ⇒ Boolean
882 883 884 885 886 887 888 889 890 |
# File 'lib/puppet/util/hpe3par_api.rb', line 882 def host_exists?(name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.host_exists?(name) ensure cl.logout end end |
#hostset_exists?(name, debug = false) ⇒ Boolean
215 216 217 218 219 220 221 222 223 |
# File 'lib/puppet/util/hpe3par_api.rb', line 215 def hostset_exists?(name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.host_set_exists?(name) ensure cl.logout end end |
#initiator_chap_exists?(host_name, debug = false) ⇒ Boolean
928 929 930 931 932 933 934 935 936 937 |
# File 'lib/puppet/util/hpe3par_api.rb', line 928 def initiator_chap_exists?(host_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) initiator_chap_enabled = cl.get_host(host_name).initiator_chap_enabled return initiator_chap_enabled ensure cl.logout end end |
#modify_base_volume(volume_name, new_name = nil, expiration_time = nil, retention_time = nil, ss_spc_alloc_warning_pct = nil, ss_spc_alloc_limit_pct = nil, usr_spc_alloc_warning_pct = nil, usr_spc_alloc_limit_pct = nil, rm_ss_spc_alloc_warning = nil, rm_usr_spc_alloc_warning = nil, rm_exp_time = nil, rm_ss_spc_alloc_limit = nil, rm_usr_spc_alloc_limit = nil, debug = false) ⇒ Object
450 451 452 453 454 455 456 |
# File 'lib/puppet/util/hpe3par_api.rb', line 450 def modify_base_volume(volume_name, new_name=nil, expiration_time=nil, retention_time=nil, ss_spc_alloc_warning_pct=nil, ss_spc_alloc_limit_pct=nil, usr_spc_alloc_warning_pct=nil, usr_spc_alloc_limit_pct=nil, rm_ss_spc_alloc_warning=nil, rm_usr_spc_alloc_warning=nil, rm_exp_time=nil, rm_ss_spc_alloc_limit=nil, rm_usr_spc_alloc_limit=nil, debug = false) modify_volume(volume_name, new_name, expiration_time, retention_time, nil, nil, ss_spc_alloc_warning_pct, ss_spc_alloc_limit_pct, usr_spc_alloc_warning_pct, usr_spc_alloc_limit_pct, rm_ss_spc_alloc_warning, rm_usr_spc_alloc_warning, rm_exp_time, rm_ss_spc_alloc_limit, rm_usr_spc_alloc_limit, debug) end |
#modify_host(host_name, new_name = nil, persona = nil, domain = nil, debug = false) ⇒ Object
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File 'lib/puppet/util/hpe3par_api.rb', line 714 def modify_host(host_name, new_name = nil, persona = nil, domain = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {} unless domain.nil? mod_request['domain'] = domain end unless new_name.nil? mod_request['newName'] = new_name end unless persona.nil? mod_request['persona'] = Hpe3parSdk::HostPersona.const_get(persona) end cl.modify_host(host_name, mod_request) Puppet.info("Host #{host_name} modified successfully") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#modify_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal = nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) ⇒ Object
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/puppet/util/hpe3par_api.rb', line 267 def modify_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET, priority = nil, bwMinGoalKB = nil, bwMaxLimitKB = nil, ioMinGoal= nil, ioMaxLimit = nil, bwMinGoalOP = nil, bwMaxLimitOP = nil, ioMinGoalOP = nil, ioMaxLimitOP = nil, latencyGoal = nil, defaultLatency = nil, enable = nil, latencyGoaluSecs = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) qos_rules = { :bwMinGoalKB => bwMinGoalKB, :bwMaxLimitKB => bwMaxLimitKB, :ioMinGoal => ioMinGoal, :ioMaxLimit => ioMaxLimit, :latencyGoal => latencyGoal, :defaultLatency => defaultLatency, :enable => enable, :latencyGoaluSecs => latencyGoaluSecs } unless priority.nil? qos_rules[:priority] = Hpe3parSdk::QoSpriorityEnumeration.const_get(priority) end unless bwMinGoalOP.nil? qos_rules[:bwMinGoalOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(bwMinGoalOP) end unless bwMaxLimitOP.nil? qos_rules[:bwMaxLimitOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(bwMaxLimitOP) end unless ioMinGoalOP.nil? qos_rules[:ioMinGoalOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(ioMinGoalOP) end unless ioMaxLimitOP.nil? qos_rules[:ioMaxLimitOP] = Hpe3parSdk::QosZeroNoneOperation.const_get(ioMaxLimitOP) end begin cl.login(@url.user, @url.password) cl.modify_qos_rules(target_name, qos_rules, Hpe3parSdk::QoStargetTypeConstants.const_get(target_type)) ensure cl.logout end end |
#modify_snapshot(name, new_name, expiration_hours, retention_hours, rm_exp_time, debug = false) ⇒ Object
168 169 170 171 172 173 174 175 176 |
# File 'lib/puppet/util/hpe3par_api.rb', line 168 def modify_snapshot(name, new_name, expiration_hours, retention_hours, rm_exp_time, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) modify_volume(name, new_name, expiration_hours, retention_hours, nil, nil, nil, nil, nil, nil, nil, nil, rm_exp_time, nil, nil, debug) ensure cl.logout end end |
#modify_volume(volume_name, new_name, expiration_time, retention_time, snap_cpg, user_cpg, ss_spc_alloc_warning_pct, ss_spc_alloc_limit_pct, usr_spc_alloc_warning_pct, usr_spc_alloc_limit_pct, rm_ss_spc_alloc_warning, rm_usr_spc_alloc_warning, rm_exp_time, rm_ss_spc_alloc_limit, rm_usr_spc_alloc_limit, debug = false) ⇒ Object
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'lib/puppet/util/hpe3par_api.rb', line 462 def modify_volume(volume_name, new_name, expiration_time, retention_time, snap_cpg, user_cpg, ss_spc_alloc_warning_pct, ss_spc_alloc_limit_pct, usr_spc_alloc_warning_pct, usr_spc_alloc_limit_pct, rm_ss_spc_alloc_warning, rm_usr_spc_alloc_warning, rm_exp_time, rm_ss_spc_alloc_limit, rm_usr_spc_alloc_limit, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug, app_type: 'puppet-3par') begin cl.login(@url.user, @url.password) volume_mods={:expirationHours => expiration_time, :newName => new_name, :retentionHours => retention_time, :snapCPG => snap_cpg, :ssSpcAllocWarningPct => ss_spc_alloc_warning_pct, :ssSpcAllocLimitPct => ss_spc_alloc_limit_pct, :userCPG => user_cpg, :usrSpcAllocWarningPct => usr_spc_alloc_warning_pct, :usrSpcAllocLimitPct => usr_spc_alloc_limit_pct, :rmSsSpcAllocWarning => rm_ss_spc_alloc_warning, :rmUsrSpcAllocWarning => rm_usr_spc_alloc_warning, :rmExpTime => rm_exp_time, :rmSsSpcAllocLimit => rm_ss_spc_alloc_limit, :rmUsrSpcAllocLimit => rm_usr_spc_alloc_limit } cl.modify_volume(volume_name, volume_mods) Puppet.info("Volume #{volume_name} modified successfully") rescue Hpe3parSdk::HTTPConflict => ex Puppet.err(ex.) Puppet.err("Unable to rename, since a volume with the name #{new_name} already exists") raise ex rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#offline_clone_exists?(name, base_volume_name, debug = false) ⇒ Boolean
969 970 971 972 973 974 975 976 977 978 |
# File 'lib/puppet/util/hpe3par_api.rb', line 969 def offline_clone_exists?(name, base_volume_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) return_val = (volume_exists?(name) and !online_physical_copy_exists?(base_volume_name, name) and offline_physical_copy_exists?(base_volume_name, name)) return return_val ensure cl.logout end end |
#offline_physical_copy_exists?(src_name, phy_copy_name, debug = false) ⇒ Boolean
990 991 992 993 994 995 996 997 998 |
# File 'lib/puppet/util/hpe3par_api.rb', line 990 def offline_physical_copy_exists?(src_name, phy_copy_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.offline_physical_copy_exists?(src_name, phy_copy_name) ensure cl.logout end end |
#online_physical_copy_exists?(src_name, phy_copy_name, debug = false) ⇒ Boolean
980 981 982 983 984 985 986 987 988 |
# File 'lib/puppet/util/hpe3par_api.rb', line 980 def online_physical_copy_exists?(src_name, phy_copy_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.online_physical_copy_exists?(src_name, phy_copy_name) ensure cl.logout end end |
#qos_rule_exists?(target_name, target_type, debug = false) ⇒ Boolean
317 318 319 320 321 322 323 324 325 |
# File 'lib/puppet/util/hpe3par_api.rb', line 317 def qos_rule_exists?(target_name, target_type, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.qos_rule_exists?(target_name, Hpe3parSdk::QoStargetTypeConstants.const_get(target_type)) ensure cl.logout end end |
#remove_fc_path_from_host(host_name, fc_wwns, force_path_removal, debug = false) ⇒ Object
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
# File 'lib/puppet/util/hpe3par_api.rb', line 820 def remove_fc_path_from_host(host_name, fc_wwns, force_path_removal, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'pathOperation' => Hpe3parSdk::HostEditOperation.const_get('REMOVE'), 'FCWWNs' => fc_wwns, 'forcePathRemoval' => force_path_removal} cl.modify_host(host_name, mod_request) Puppet.info("FC path #{fc_wwns} removed from host #{host_name}") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#remove_hosts_from_host_set(host_set_name, setmembers, debug = false) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/puppet/util/hpe3par_api.rb', line 125 def remove_hosts_from_host_set(host_set_name, setmembers, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin current_set_members = get_host_set(host_set_name).setmembers if current_set_members != nil common_set_members = current_set_members & setmembers end if !common_set_members.nil? and common_set_members.any? cl.login(@url.user, @url.password) cl.remove_hosts_from_host_set(host_set_name, common_set_members) end ensure cl.logout end end |
#remove_initiator_chap(host_name, debug = false) ⇒ Object
756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
# File 'lib/puppet/util/hpe3par_api.rb', line 756 def remove_initiator_chap(host_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'chapOperation' => Hpe3parSdk::HostEditOperation.const_get('REMOVE')} cl.modify_host(host_name, mod_request) Puppet.info("Host #{host_name} modified to remove initiator chap") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#remove_iscsi_path_from_host(host_name, iscsi_names, force_path_removal, debug = false) ⇒ Object
853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
# File 'lib/puppet/util/hpe3par_api.rb', line 853 def remove_iscsi_path_from_host(host_name, iscsi_names, force_path_removal, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'pathOperation' => Hpe3parSdk::HostEditOperation.const_get('REMOVE'), 'iSCSINames' => iscsi_names, 'forcePathRemoval' => force_path_removal} cl.modify_host(host_name, mod_request) Puppet.info("iSCSI path #{iscsi_names} removed from host #{host_name}") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#remove_target_chap(host_name, debug = false) ⇒ Object
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 |
# File 'lib/puppet/util/hpe3par_api.rb', line 788 def remove_target_chap(host_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) mod_request = {'chapOperation' => Hpe3parSdk::HostEditOperation.const_get('REMOVE'), 'chapRemoveTargetOnly' => true} cl.modify_host(host_name, mod_request) Puppet.info("Host #{host_name} modified to remove target chap") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#remove_volumes_from_volume_set(volume_set_name, setmembers, debug = false) ⇒ Object
939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
# File 'lib/puppet/util/hpe3par_api.rb', line 939 def remove_volumes_from_volume_set(volume_set_name, setmembers, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.remove_volumes_from_volume_set(volume_set_name, setmembers) Puppet.info("Removed volumes #{setmembers} from volume set #{volume_set_name} successfully") rescue Hpe3parSdk::HPE3PARException => ex Puppet.err(ex.) raise ex ensure cl.logout end end |
#restore_snapshot_offline(snapshot_name, priority, allow_remote_copy_parent, debug = false) ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/puppet/util/hpe3par_api.rb', line 178 def restore_snapshot_offline(snapshot_name, priority, allow_remote_copy_parent, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional = {:online => false, :allowRemoteCopyParent => allow_remote_copy_parent } optional[:priority] = Hpe3parSdk::TaskPriority.const_get(priority) cl.restore_snapshot(snapshot_name, optional) ensure cl.logout end end |
#restore_snapshot_online(snapshot_name, allow_remote_copy_parent, debug = false) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/puppet/util/hpe3par_api.rb', line 192 def restore_snapshot_online(snapshot_name, allow_remote_copy_parent, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) optional = {:online => true, :allowRemoteCopyParent => allow_remote_copy_parent } cl.restore_snapshot(snapshot_name, optional) ensure cl.logout end end |
#resync_clone(clone_name, debug = false) ⇒ Object
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1037 def resync_clone(clone_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.resync_physical_copy(clone_name) ensure cl.logout end end |
#set_snap_cpg(volume_name, snap_cpg, debug = false) ⇒ Object
458 459 460 |
# File 'lib/puppet/util/hpe3par_api.rb', line 458 def set_snap_cpg(volume_name, snap_cpg, debug = false) modify_volume(volume_name, nil, nil, nil, snap_cpg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) end |
#stop_clone(clone_name, debug = false) ⇒ Object
1059 1060 1061 1062 1063 1064 1065 1066 1067 |
# File 'lib/puppet/util/hpe3par_api.rb', line 1059 def stop_clone(clone_name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.stop_offline_physical_copy(clone_name) ensure cl.logout end end |
#validate ⇒ Object
33 34 35 36 37 |
# File 'lib/puppet/util/hpe3par_api.rb', line 33 def validate raise ArgumentError, "Invalid scheme #{@url.scheme}. Must be https" unless @url.scheme == 'https' raise ArgumentError, "User must be specified" unless @url.user raise ArgumentError, "Password must be specified" unless @url.password end |
#vlun_exists?(volume_name, lunid, host_name = nil, node = nil, slot = nil, card_port = nil, debug = false) ⇒ Boolean
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/puppet/util/hpe3par_api.rb', line 327 def vlun_exists?(volume_name, lunid, host_name=nil, node = nil, slot = nil, card_port = nil, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin port_pos = nil if !node.nil? && !slot.nil? && !card_port.nil? port_pos={ :node => node, :slot => slot, :cardPort => card_port } end cl.login(@url.user, @url.password) cl.vlun_exists?(volume_name, lunid, host_name, port_pos) ensure cl.logout end end |
#volume_exists?(name, debug = false) ⇒ Boolean
619 620 621 622 623 624 625 626 627 |
# File 'lib/puppet/util/hpe3par_api.rb', line 619 def volume_exists?(name, debug = false) ca = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin ca.login(@url.user, @url.password) ca.volume_exists?(name) ensure ca.logout end end |
#volume_set_exists?(name, debug = false) ⇒ Boolean
653 654 655 656 657 658 659 660 661 |
# File 'lib/puppet/util/hpe3par_api.rb', line 653 def volume_set_exists?(name, debug = false) cl = Hpe3parSdk::Client.new(@rest_url, debug: debug) begin cl.login(@url.user, @url.password) cl.volume_set_exists?(name) ensure cl.logout end end |