hpe3par_sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ # specific language governing permissions and limitations under the License.
11
+
12
+ require 'bundler/gem_tasks'
13
+ require 'rake/clean'
14
+
15
+ task :console do
16
+ exec 'irb -r Hpe3parSdk -I ./lib'
17
+ end
18
+
19
+ namespace :build do
20
+ begin
21
+ require 'rspec/core/rake_task'
22
+
23
+ RSpec::Core::RakeTask.new(:spec) do |t|
24
+ puts '', 'RSpec Task started....'
25
+ t.pattern = Dir.glob('spec/**/*_spec.rb')
26
+ t.rspec_opts = '--format html --out test_reports/rspec_results.html'
27
+ t.fail_on_error = true
28
+ end
29
+
30
+ task default: :spec
31
+ rescue LoadError => le
32
+ # no rspec available
33
+ puts "(#{le.message})"
34
+ end
35
+
36
+ begin
37
+ require 'rubocop/rake_task'
38
+ desc 'Run RuboCop - Ruby static code analyzer'
39
+ RuboCop::RakeTask.new(:rubocop) do |task|
40
+ puts '', 'Rubocop Task started....'
41
+ # task.patterns = ['lib/**/*.rb']
42
+ task.fail_on_error = false
43
+ task.formatters = ['html']
44
+ task.options = ['--out', 'rubocop_report.html']
45
+ end
46
+ rescue LoadError => le
47
+ # no rspec available
48
+ puts "(#{le.message})"
49
+ end
50
+
51
+
52
+ # $stdout.reopen("ruby_lint_report.txt", "w")
53
+ # $stdout.sync = true
54
+ require 'ruby-lint/rake_task'
55
+ RubyLint::RakeTask.new do |task|
56
+ task.name = 'lint'
57
+ task.description = 'Rake task to run ruby-lint on lib'
58
+ task.debug = TrueClass
59
+ task.files = ['./lib/']
60
+ # task.configuration = ''
61
+ end
62
+ # $stdout = STDOUT
63
+
64
+ require 'rdoc/task'
65
+ Rake::RDocTask.new(:rdoc) do |rd|
66
+ rd.title = 'Ruby 3PAR Library'
67
+ rd.rdoc_files.include('lib/**/*.rb', 'README.md')
68
+ rd.rdoc_dir = 'rdoc'
69
+ rd.main = 'README.md'
70
+ end
71
+
72
+ desc 'Clean up previous build'
73
+ task :clobber do
74
+ CLOBBER << 'rubocop_report.html'
75
+ CLOBBER << 'test_reports'
76
+ CLOBBER << 'coverage'
77
+ CLOBBER << 'Gemfile.lock'
78
+ Rake::Task['clobber'].invoke
79
+ Rake::Task['build:clobber_rdoc'].invoke
80
+ end
81
+
82
+ require 'bundler/inline'
83
+
84
+ task :deploy do
85
+ gemfile(true) do
86
+ source 'https://rubygems.org'
87
+ gem 'nexus'
88
+ end
89
+ end
90
+
91
+
92
+ end
93
+
94
+ desc 'Run RDoc, ruby-lint, rubocop, unit tests, coverage and generate gemfile of the project'
95
+ task :build_client do
96
+ Rake::Task['build:clobber'].invoke
97
+ Rake::Task['build:spec'].invoke
98
+ Rake::Task['build'].invoke
99
+ Rake::Task['build:rdoc'].invoke
100
+ Rake::Task['build:lint'].invoke
101
+ Rake::Task['build:rubocop'].invoke
102
+ Rake::Task['build:deploy'].invoke
103
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software distributed
10
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
12
+ # specific language governing permissions and limitations under the License.
13
+
14
+ require 'bundler/setup'
15
+ require 'Hpe3parSdk'
16
+
17
+ # You can add fixtures and/or initialization code here to make experimenting
18
+ # with your gem easier. You can also use a different console, if you like.
19
+
20
+ # (If you use this, don't forget to add pry to your Gemfile!)
21
+ # require "pry"
22
+ # Pry.start
23
+
24
+ require 'irb'
25
+ IRB.start
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software distributed
10
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
12
+ # specific language governing permissions and limitations under the License.
13
+
14
+ set -euo pipefail
15
+ IFS=$'\n\t'
16
+ set -vx
17
+
18
+ bundle install
19
+
20
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ # specific language governing permissions and limitations under the License.
11
+
12
+ # coding: utf-8
13
+ lib = File.expand_path('../lib', __FILE__)
14
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
15
+ require 'Hpe3parSdk/version'
16
+
17
+ Gem::Specification.new do |spec|
18
+ spec.name = 'hpe3par_sdk'
19
+ spec.version = Hpe3parSdk::VERSION
20
+ spec.authors = ['Hewlett Packard Enterprise']
21
+ spec.email = ['hpe_storage_ruby_sdk@groups.ext.hpe.com']
22
+
23
+ spec.summary = 'HPE 3PAR Software Development Kit for Ruby'
24
+ spec.description = 'HPE 3PAR Software Development Kit for Ruby'
25
+ spec.homepage = 'https://github.com/HewlettPackard/hpe3par_ruby_sdk'
26
+ spec.license = 'Apache-2.0'
27
+
28
+
29
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ spec.required_ruby_version = '>= 2.1'
35
+
36
+ spec.add_dependency 'net-ssh', '~> 4'
37
+ spec.add_runtime_dependency 'httparty', '~> 0.15.6'
38
+
39
+ spec.add_development_dependency 'bundler', '~> 1.14'
40
+ spec.add_development_dependency 'rake', '~> 10.0'
41
+ spec.add_development_dependency 'rspec', '~> 3.0'
42
+ spec.add_development_dependency 'rubocop', '~> 0.52'
43
+ spec.add_development_dependency 'simplecov', '~> 0.15.0'
44
+ spec.add_development_dependency 'ruby-lint', '~> 2.0', '>= 2.0.4'
45
+ end
@@ -0,0 +1,19 @@
1
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ # specific language governing permissions and limitations under the License.
11
+
12
+ require 'Hpe3parSdk/version'
13
+
14
+ module Hpe3parSdk
15
+ require 'Hpe3parSdk/exceptions'
16
+ require 'Hpe3parSdk/constants'
17
+ require 'Hpe3parSdk/client'
18
+ require 'Hpe3parSdk/models'
19
+ end
@@ -0,0 +1,2647 @@
1
+ # (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software distributed
8
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
+ # specific language governing permissions and limitations under the License.
11
+
12
+ require_relative 'http'
13
+ require_relative 'ssh'
14
+ require_relative 'util'
15
+ require_relative 'volume_manager'
16
+ require_relative 'cpg_manager'
17
+ require_relative 'volume_set_manager'
18
+ require_relative 'qos_manager'
19
+ require_relative 'vlun_manager'
20
+ require_relative 'host_manager'
21
+ require_relative 'host_set_manager'
22
+ require_relative 'flash_cache_manager'
23
+ require_relative 'port_manager'
24
+ require_relative 'task_manager'
25
+ require_relative 'wsapi_version'
26
+
27
+ module Hpe3parSdk
28
+ class Client
29
+ def initialize(api_url,debug:false, secure: false, timeout: nil, suppress_ssl_warnings: false, app_type: 'ruby-3parclient', log_file_path: nil)
30
+ unless api_url.is_a?(String)
31
+ raise Hpe3parSdk::HPE3PARException.new(nil,
32
+ "'api_url' parameter is mandatory and should be of type String")
33
+ end
34
+
35
+ @api_url = api_url
36
+ @debug = debug
37
+ @secure = secure
38
+ @timeout = timeout
39
+ @suppress_ssl_warnings = suppress_ssl_warnings
40
+ @log_level = Logger::INFO
41
+ @log_file_path = log_file_path
42
+ init_log
43
+ @http = HTTPJSONRestClient.new(
44
+ @api_url, @secure, @debug,
45
+ @suppress_ssl_warnings, @timeout = nil
46
+ )
47
+ check_WSAPI_version
48
+ @vlun_query_supported = false
49
+ @cpg = CPGManager.new(@http)
50
+ @qos = QOSManager.new(@http)
51
+ @flash_cache = FlashCacheManager.new(@http)
52
+ @port = PortManager.new(@http)
53
+ @task = TaskManager.new(@http)
54
+ @host_and_vv_set_filter_supported = false
55
+ @ssh = nil
56
+ @vlun = VlunManager.new(@http, @vlun_query_supported)
57
+ @host = HostManager.new(@http, @vlun_query_supported)
58
+ @volume_set = VolumeSetManager.new(@http, @host_and_vv_set_filter_supported)
59
+ @host_set = HostSetManager.new(@http, @host_and_vv_set_filter_supported)
60
+ @app_type = app_type
61
+ end
62
+
63
+
64
+ private def init_log
65
+ unless @log_file_path.nil?
66
+ client_logger = Logger.new(@log_file_path, 'daily', formatter: CustomFormatter.new)
67
+ else
68
+ client_logger = Logger.new(STDOUT)
69
+ end
70
+ if @debug
71
+ @log_level = Logger::DEBUG
72
+ end
73
+ Hpe3parSdk.logger = MultiLog.new(:level => @log_level, :loggers => client_logger)
74
+ end
75
+
76
+
77
+ private def check_WSAPI_version
78
+ begin
79
+ @api_version = get_ws_api_version
80
+ rescue HPE3PARException => ex
81
+ ex_message = ex.message
82
+ if ex_message && ex_message.include?('SSL Certificate Verification Failed')
83
+ raise Hpe3parSdk::SSLCertFailed
84
+ else
85
+ msg = "Error: #{ex_message} - Error communicating with 3PAR WSAPI. '
86
+ 'Check proxy settings. If error persists, either the '
87
+ '3PAR WSAPI is not running OR the version of the WSAPI is '
88
+ 'not supported."
89
+ raise Hpe3parSdk::HPE3PARException(message: msg)
90
+ end
91
+ end
92
+
93
+ compare_version(@api_version)
94
+
95
+ end
96
+
97
+ private def set_ssh_options(username, password, port=22, conn_timeout=nil)
98
+ @ssh=Hpe3parSdk::SSH.new(@api_url.split("//")[1].split(":")[0], username, password)
99
+ end
100
+
101
+ private def compare_version(api_version)
102
+ @min_version = WSAPIVersion
103
+ .parse(WSAPIVersionSupport::WSAPI_MIN_SUPPORTED_VERSION)
104
+ @min_version_with_compression = WSAPIVersion
105
+ .parse(WSAPIVersionSupport::WSAPI_MIN_VERSION_COMPRESSION_SUPPORT)
106
+
107
+ @current_version = WSAPIVersion.new(api_version['major'], api_version['minor'],
108
+ api_version['revision'])
109
+ if @current_version < @min_version
110
+ err_msg = "Unsupported 3PAR WS API version #{@current_version}, min supported version is, #{WSAPIVersionSupport::WSAPI_MIN_SUPPORTED_VERSION}"
111
+ raise Hpe3parSdk::UnsupportedVersion.new(nil, err_msg)
112
+ end
113
+
114
+ # Check for VLUN query support.
115
+ min_vlun_query_support_version = WSAPIVersion
116
+ .parse(WSAPIVersionSupport::WSAPI_MIN_VERSION_VLUN_QUERY_SUPPORT)
117
+ if @current_version >= min_vlun_query_support_version
118
+ @vlun_query_supported = true
119
+ end
120
+
121
+ # Check for Host and VV Set query support
122
+ if @current_version >= @min_version_with_compression
123
+ @host_and_vv_set_filter_supported = true
124
+ end
125
+
126
+ end
127
+
128
+ # Get the 3PAR WS API version.
129
+ #
130
+ # ==== Returns
131
+ #
132
+ # WSAPI version hash
133
+ def get_ws_api_version
134
+ # remove everything down to host:port
135
+ host_url = @api_url.split('/api')
136
+ @http.set_url(host_url[0])
137
+ begin
138
+ # get the api version
139
+ response = @http.get('/api')
140
+ response[1]
141
+ rescue => ex
142
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
143
+ raise ex
144
+ end
145
+ ensure
146
+ # reset the url
147
+ @http.set_url(@api_url)
148
+ end
149
+
150
+ # Gets the WSAPI Configuration.
151
+ #
152
+ # ==== Returns
153
+ #
154
+ # WSAPI configuration hash
155
+ def get_ws_api_configuration_info
156
+ begin
157
+ response = @http.get('/wsapiconfiguration')
158
+ response[1]
159
+ rescue => ex
160
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
161
+ raise ex
162
+ end
163
+ end
164
+
165
+ # Creates a new FlashCache
166
+ #
167
+ # ==== Attributes
168
+ #
169
+ # * size_in_gib - Specifies the node pair size of the Flash Cache on the system
170
+ # type size_in_gib: Integer
171
+ # * mode - Values supported Simulator: 1, Real: 2 (default)
172
+ # type mode: Integer
173
+ #
174
+ # ==== Raises
175
+ #
176
+ # * Hpe3parSdk::HTTPBadRequest
177
+ # - NO_SPACE - Not enough space is available for the operation.
178
+ # * Hpe3parSdk::HTTPBadRequest
179
+ # - INV_INPUT_EXCEEDS_RANGE - A JSON input object contains a name-value pair with a numeric value that exceeds the expected range. Flash Cache exceeds the expected range. The HTTP ref member contains the name.
180
+ # * Hpe3parSdk::HTTPConflict
181
+ # - EXISTENT_FLASH_CACHE - The Flash Cache already exists.
182
+ # * Hpe3parSdk::HTTPForbidden
183
+ # - FLASH_CACHE_NOT_SUPPORTED - Flash Cache is not supported.
184
+ # * Hpe3parSdk::HTTPBadRequest
185
+ # - INV_FLASH_CACHE_SIZE - Invalid Flash Cache size. The size must be a multiple of 16 G.
186
+ def create_flash_cache(size_in_gib, mode = nil)
187
+ begin
188
+ @flash_cache.create_flash_cache(size_in_gib, mode)
189
+ rescue => ex
190
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
191
+ raise ex
192
+ end
193
+
194
+ end
195
+
196
+ # Get Flash Cache information
197
+ #
198
+ # ==== Returns
199
+ #
200
+ # FlashCache - Details of the specified flash cache
201
+ def get_flash_cache
202
+ begin
203
+ @flash_cache.get_flash_cache
204
+ rescue => ex
205
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
206
+ raise ex
207
+ end
208
+ end
209
+
210
+ # Deletes an existing Flash Cache
211
+ #
212
+ # ==== Raises
213
+ #
214
+ # * Hpe3parSdk::HTTPForbidden
215
+ # - FLASH_CACHE_IS_BEING_REMOVED - Unable to delete the Flash Cache, the Flash Cache is being removed.
216
+ # * Hpe3parSdk::HTTPForbidden
217
+ # - FLASH_CACHE_NOT_SUPPORTED - Flash Cache is not supported on this system.
218
+ # * Hpe3parSdk::HTTPNotFound
219
+ # - NON_EXISTENT_FLASH_CACHE - The Flash Cache does not exist.
220
+ def delete_flash_cache
221
+ begin
222
+ @flash_cache.delete_flash_cache
223
+ rescue => ex
224
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
225
+ raise ex
226
+ end
227
+ end
228
+
229
+ # Gets the Storage System Information
230
+ #
231
+ # ==== Returns
232
+ #
233
+ # Hash of Storage System Info
234
+ def get_storage_system_info
235
+ begin
236
+ response = @http.get('/system')
237
+ response[1]
238
+ rescue => ex
239
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
240
+ raise ex
241
+ end
242
+ end
243
+
244
+ # Gets the overall system capacity for the 3PAR server.
245
+ #
246
+ # ==== Returns
247
+ #
248
+ # Hash of system capacity information
249
+ #
250
+ #
251
+ # capacity = {
252
+ # "allCapacity"=> { # Overall system capacity
253
+ # # includes FC, NL, SSD
254
+ # # device types
255
+ # "totalMiB"=>20054016, # Total system capacity
256
+ # # in MiB
257
+ # "allocated"=>{ # Allocated space info
258
+ # "totalAllocatedMiB"=>12535808, # Total allocated
259
+ # # capacity
260
+ # "volumes"=> { # Volume capacity info
261
+ # "totalVolumesMiB"=>10919936, # Total capacity
262
+ # # allocated to volumes
263
+ # "nonCPGsMiB"=> 0, # Total non-CPG capacity
264
+ # "nonCPGUserMiB"=> 0, # The capacity allocated
265
+ # # to non-CPG user space
266
+ # "nonCPGSnapshotMiB"=>0, # The capacity allocated
267
+ # # to non-CPG snapshot
268
+ # # volumes
269
+ # "nonCPGAdminMiB"=> 0, # The capacity allocated
270
+ # # to non-CPG
271
+ # # administrative volumes
272
+ # "CPGsMiB"=>10919936, # Total capacity
273
+ # # allocated to CPGs
274
+ # "CPGUserMiB"=>7205538, # User CPG space
275
+ # "CPGUserUsedMiB"=>7092550, # The CPG allocated to
276
+ # # user space that is
277
+ # # in use
278
+ # "CPGUserUnusedMiB"=>112988, # The CPG allocated to
279
+ # # user space that is not
280
+ # # in use
281
+ # "CPGSnapshotMiB"=>2411870, # Snapshot CPG space
282
+ # "CPGSnapshotUsedMiB"=>210256, # CPG allocated to
283
+ # # snapshot that is in use
284
+ # "CPGSnapshotUnusedMiB"=>2201614, # CPG allocated to
285
+ # # snapshot space that is
286
+ # # not in use
287
+ # "CPGAdminMiB"=>1302528, # Administrative volume
288
+ # # CPG space
289
+ # "CPGAdminUsedMiB"=> 115200, # The CPG allocated to
290
+ # # administrative space
291
+ # # that is in use
292
+ # "CPGAdminUnusedMiB"=>1187328, # The CPG allocated to
293
+ # # administrative space
294
+ # # that is not in use
295
+ # "unmappedMiB"=>0 # Allocated volume space
296
+ # # that is unmapped
297
+ # },
298
+ # "system"=> { # System capacity info
299
+ # "totalSystemMiB"=> 1615872, # System space capacity
300
+ # "internalMiB"=>780288, # The system capacity
301
+ # # allocated to internal
302
+ # # resources
303
+ # "spareMiB"=> 835584, # Total spare capacity
304
+ # "spareUsedMiB"=> 0, # The system capacity
305
+ # # allocated to spare resources
306
+ # # in use
307
+ # "spareUnusedMiB"=> 835584 # The system capacity
308
+ # # allocated to spare resources
309
+ # # that are unused
310
+ # }
311
+ # },
312
+ # "freeMiB"=> 7518208, # Free capacity
313
+ # "freeInitializedMiB"=> 7518208, # Free initialized capacity
314
+ # "freeUninitializedMiB"=> 0, # Free uninitialized capacity
315
+ # "unavailableCapacityMiB"=> 0, # Unavailable capacity in MiB
316
+ # "failedCapacityMiB"=> 0 # Failed capacity in MiB
317
+ # },
318
+ # "FCCapacity"=> { # System capacity from FC devices only
319
+ # ... # Same structure as above
320
+ # },
321
+ # "NLCapacity"=> { # System capacity from NL devices only
322
+ # ... # Same structure as above
323
+ # },
324
+ # "SSDCapacity"=> { # System capacity from SSD devices only
325
+ # ... # Same structure as above
326
+ # }
327
+ # }
328
+ def get_overall_system_capacity
329
+ begin
330
+ response = @http.get('/capacity')
331
+ response[1]
332
+ rescue => ex
333
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
334
+ raise ex
335
+ end
336
+ end
337
+
338
+ # This authenticates against the 3PAR WSAPI server and creates a session.
339
+
340
+ # ==== Attributes
341
+ #
342
+ # * username - The username
343
+ # type username: String
344
+ # * password - The Password
345
+ # type password: String
346
+ def login(username, password, optional = nil)
347
+ set_ssh_options(username, password, port=22, conn_timeout=nil)
348
+ @volume = VolumeManager.new(@http, @ssh, @app_type)
349
+ @http.authenticate(username, password, optional)
350
+ end
351
+
352
+ # Get the list of all 3PAR Tasks
353
+ #
354
+ # ==== Returns
355
+ #
356
+ # Array of Task
357
+ def get_all_tasks
358
+ begin
359
+ @task.get_all_tasks
360
+ rescue => ex
361
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
362
+ raise ex
363
+ end
364
+ end
365
+
366
+ # Get the status of a 3PAR Task
367
+ #
368
+ # ==== Attributes
369
+ #
370
+ # * task_id - the task id
371
+ # type task_id: Integer
372
+ #
373
+ # ==== Returns
374
+ #
375
+ # Task
376
+ #
377
+ # ==== Raises
378
+ #
379
+ # * Hpe3parSdk::HTTPBadRequest
380
+ # - INV_INPUT_BELOW_RANGE - Bad Request Task ID must be a positive value.
381
+ # * Hpe3parSdk::HTTPBadRequest
382
+ # - INV_INPUT_EXCEEDS_RANGE - Bad Request Task ID is too large.
383
+ # * Hpe3parSdk::HTTPNotFound
384
+ # - NON_EXISTENT_TASK - Task with the specified Task ID does not exist.
385
+ # * Hpe3parSdk::HTTPBadRequest
386
+ # - INV_INPUT_WRONG_TYPE - Task ID is not an integer.
387
+ def get_task(task_id)
388
+ begin
389
+ @task.get_task(task_id)
390
+ rescue => ex
391
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
392
+ raise ex
393
+ end
394
+ end
395
+
396
+
397
+ def vlun_exists?(volname,lunid,host=nil,port=nil)
398
+ begin
399
+ @vlun.vlun_exists?(volname,lunid,host,port)
400
+ rescue => ex
401
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
402
+ raise ex
403
+ end
404
+ end
405
+
406
+ # Creates a new VLUN.
407
+ #
408
+ # When creating a VLUN, the volumeName is required. The lun member is
409
+ # not required if auto is set to True.
410
+ # Either hostname or portPos (or both in the case of matched sets) is
411
+ # also required. The noVcn and overrideLowerPriority members are
412
+ # optional.
413
+ # * volume_name: Name of the volume to be exported
414
+ # type volume_name: String
415
+ # * lun: LUN id
416
+ # type lun: Integer
417
+ # * host_name: Name of the host which the volume is to be exported.
418
+ # type host_name: String
419
+ # * port_pos: System port of VLUN exported to. It includes node number, slot number, and card port number
420
+ # type port_pos: Hash
421
+ # port_pos = {'node'=> 1, # System node (0-7)
422
+ # 'slot'=> 2, # PCI bus slot in the node (0-5)
423
+ # 'port'=> 1} # Port number on the FC card (0-4)
424
+ # * no_vcn: A VLUN change notification (VCN) not be issued after export (-novcn).
425
+ # type no_vcn: Boolean
426
+ # * override_lower_priority: Existing lower priority VLUNs will be overridden (-ovrd). Use only if hostname member exists.
427
+ # type override_lower_priority: Boolean
428
+ #
429
+ # ==== Returns
430
+ #
431
+ # VLUN id
432
+ # ==== Raises
433
+ #
434
+ # * Hpe3parSdk::HTTPBadRequest
435
+ # - INV_INPUT_ MISSING_REQUIRED - Missing volume or hostname or lunid.
436
+ # * Hpe3parSdk::HTTPNotFound
437
+ # - NON_EXISTENT_VOL MISSING_REQUIRED - Specified volume does not exist.
438
+ # * Hpe3parSdk::HTTPNotFound
439
+ # - NON_EXISTENT_HOST - Specified hostname not found.
440
+ # * Hpe3parSdk::HTTPNotFound
441
+ # - NON_EXISTENT_PORT - Specified port does not exist.
442
+ def create_vlun(volume_name, lun = nil, host_name = nil, port_pos = nil, no_vcn = false, override_lower_priority = false, auto = false)
443
+ begin
444
+ @vlun.create_vlun(volume_name, host_name, lun, port_pos, no_vcn, override_lower_priority, auto)
445
+ rescue => ex
446
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
447
+ raise ex
448
+ end
449
+ end
450
+
451
+ # Gets VLUNs.
452
+ #
453
+ # ==== Returns
454
+ #
455
+ # Array of VLUN objects
456
+ def get_vluns
457
+ begin
458
+ @vlun.get_vluns
459
+ rescue => ex
460
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
461
+ raise ex
462
+ end
463
+ end
464
+
465
+ # Gets information about a VLUN.
466
+ #
467
+ # ==== Attributes
468
+ #
469
+ # * volume_name: The volume name of the VLUN to find
470
+ # type volume_name: String
471
+ #
472
+ # ==== Returns
473
+ #
474
+ # VLUN object
475
+ #
476
+ # ==== Raises
477
+ #
478
+ # * Hpe3parSdk::HTTPNotFound
479
+ # - NON_EXISTENT_VLUN - VLUN doesn't exist
480
+ def get_vlun(volume_name)
481
+ begin
482
+ @vlun.get_vlun(volume_name)
483
+ rescue => ex
484
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
485
+ raise ex
486
+ end
487
+ end
488
+
489
+ # Deletes a VLUN.
490
+ #
491
+ # ==== Attributes
492
+ #
493
+ # * volume_name: Volume name of the VLUN
494
+ # type volume_name: String
495
+ # * lun_id: LUN ID
496
+ # type lun_id: Integer
497
+ # * host_name: Name of the host which the volume is exported. For VLUN of port type,the value is empty
498
+ # type host_name: String
499
+ # * 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>
500
+ # type port: Hash
501
+ #
502
+ # port = {'node'=> 1, # System node (0-7)
503
+ # 'slot'=> 2, # PCI bus slot in the node (0-5)
504
+ # 'port'=>1} # Port number on the FC card (0-4)
505
+ # ==== Raises
506
+ #
507
+ # * Hpe3parSdk::HTTPBadRequest
508
+ # - INV_INPUT_MISSING_REQUIRED - Incomplete VLUN info. Missing
509
+ # volumeName or lun, or both hostname and port.
510
+ # * Hpe3parSdk::HTTPBadRequest
511
+ # - INV_INPUT_PORT_SELECTION - Specified port is invalid.
512
+ # * Hpe3parSdk::HTTPBadRequest
513
+ # - INV_INPUT_EXCEEDS_RANGE - The LUN specified exceeds expected
514
+ # range.
515
+ # * Hpe3parSdk::HTTPNotFound
516
+ # - NON_EXISTENT_HOST - The host does not exist
517
+ # * Hpe3parSdk::HTTPNotFound
518
+ # - NON_EXISTENT_VLUN - The VLUN does not exist
519
+ # * Hpe3parSdk::HTTPNotFound
520
+ # - NON_EXISTENT_PORT - The port does not exist
521
+ # * Hpe3parSdk::HTTPForbidden
522
+ # - PERM_DENIED - Permission denied
523
+ def delete_vlun(volume_name, lun_id, host_name = nil, port = nil)
524
+ begin
525
+ @vlun.delete_vlun(volume_name, lun_id, host_name, port)
526
+ rescue => ex
527
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
528
+ raise ex
529
+ end
530
+ end
531
+
532
+ # Gets QoS Rules.
533
+ #
534
+ # ==== Returns
535
+ #
536
+ # Array of QoSRule objects
537
+ #
538
+ def query_qos_rules
539
+ begin
540
+ @qos.query_qos_rules
541
+ rescue => ex
542
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
543
+ raise ex
544
+ end
545
+ end
546
+
547
+ # Queries a QoS rule
548
+ #
549
+ # ==== Attributes
550
+ #
551
+ # * target_name : Name of the target. When targetType is sys, target name must be sys:all_others.
552
+ # type target_name: String
553
+ # * target_type : Target type is vvset or sys
554
+ # type target_type: String
555
+ # ==== Returns
556
+ #
557
+ # QoSRule object
558
+ #
559
+ # ==== Raises
560
+ #
561
+ # * Hpe3parSdk::HTTPNotFound
562
+ # - NON_EXISTENT_QOS_RULE - QoS rule does not exist.
563
+ # * Hpe3parSdk::HTTPBadRequest
564
+ # - INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.
565
+ def query_qos_rule(target_name, target_type = 'vvset')
566
+ begin
567
+ @qos.query_qos_rule(target_name, target_type)
568
+ rescue => ex
569
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
570
+ raise ex
571
+ end
572
+ end
573
+
574
+ def qos_rule_exists?(target_name, target_type = 'vvset')
575
+ begin
576
+ @qos.qos_rule_exists?(target_name, target_type)
577
+ rescue => ex
578
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
579
+ raise ex
580
+ end
581
+ end
582
+
583
+ # Creates QOS rules
584
+
585
+ # The QoS rule can be applied to VV sets. By using sys:all_others,
586
+ # you can apply the rule to all volumes in the system for which no
587
+ # QoS rule has been defined.
588
+ # ioMinGoal and ioMaxLimit must be used together to set I/O limits.
589
+ # Similarly, bwMinGoalKB and bwMaxLimitKB must be used together.
590
+ # If ioMaxLimitOP is set to 2 (no limit), ioMinGoalOP must also be
591
+ # to set to 2 (zero), and vice versa. They cannot be set to
592
+ # 'none' individually. Similarly, if bwMaxLimitOP is set to 2 (no
593
+ # limit), then bwMinGoalOP must also be set to 2.
594
+ # If ioMaxLimitOP is set to 1 (no limit), ioMinGoalOP must also be
595
+ # to set to 1 (zero) and vice versa. Similarly, if bwMaxLimitOP is
596
+ # set to 1 (zero), then bwMinGoalOP must also be set to 1.
597
+ # The ioMinGoalOP and ioMaxLimitOP fields take precedence over
598
+ # the ioMinGoal and ioMaxLimit fields.
599
+ # The bwMinGoalOP and bwMaxLimitOP fields take precedence over
600
+ # the bwMinGoalKB and bwMaxLimitKB fields
601
+ #
602
+ # ==== Attributes
603
+ #
604
+ # * target_type: Type of QoS target, either enum TARGET_TYPE_VVS or TARGET_TYPE_SYS.
605
+ # type target_type: VVSET or SYS. Refer QoStargetType::VVSET for complete enumeration
606
+ # * target_name: Name of the target object on which the QoS rule will be created.
607
+ # type target_name: String
608
+ # * qos_rules: QoS options
609
+ # type qos_rules: Hash
610
+ # qos_rules = {
611
+ # 'priority'=> 2, # Refer Hpe3parSdk::QoSpriorityEnumeration for complete enumeration
612
+ # 'bwMinGoalKB'=> 1024, # bandwidth rate minimum goal in
613
+ # # kilobytes per second
614
+ # 'bwMaxLimitKB'=> 1024, # bandwidth rate maximum limit in
615
+ # # kilobytes per second
616
+ # 'ioMinGoal'=> 10000, # I/O-per-second minimum goal
617
+ # 'ioMaxLimit'=> 2000000, # I/0-per-second maximum limit
618
+ # 'enable'=> false, # QoS rule for target enabled?
619
+ # 'bwMinGoalOP'=> 1, # zero none operation enum, when set to
620
+ # # 1, bandwidth minimum goal is 0
621
+ # # when set to 2, the bandwidth mimumum
622
+ # # goal is none (NoLimit)
623
+ # 'bwMaxLimitOP'=> 1, # zero none operation enum, when set to
624
+ # # 1, bandwidth maximum limit is 0
625
+ # # when set to 2, the bandwidth maximum
626
+ # # limit is none (NoLimit)
627
+ # 'ioMinGoalOP'=>1, # zero none operation enum, when set to
628
+ # # 1, I/O minimum goal is 0
629
+ # # when set to 2, the I/O minimum goal is
630
+ # # none (NoLimit)
631
+ # 'ioMaxLimitOP'=> 1, # zero none operation enum, when set to
632
+ # # 1, I/O maximum limit is 0
633
+ # # when set to 2, the I/O maximum limit
634
+ # # is none (NoLimit)
635
+ # 'latencyGoal'=>5000, # Latency goal in milliseconds
636
+ # 'defaultLatency'=> false# Use latencyGoal or defaultLatency?
637
+ # }
638
+ #
639
+ # ==== Raises
640
+ #
641
+ # * Hpe3parSdk::HTTPBadRequest
642
+ # - INV_INPUT_EXCEEDS_RANGE - Invalid input: number exceeds expected range.
643
+ # * Hpe3parSdk::HTTPNotFound
644
+ # - NON_EXISTENT_QOS_RULE - QoS rule does not exists.
645
+ # * Hpe3parSdk::HTTPBadRequest
646
+ # - INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.
647
+ # * Hpe3parSdk::HTTPBadRequest
648
+ # - EXISTENT_QOS_RULE - QoS rule already exists.
649
+ # * Hpe3parSdk::HTTPBadRequest
650
+ # - INV_INPUT_MIN_GOAL_GRT_MAX_LIMIT - I/O-per-second maximum limit should be greater than the minimum goal.
651
+ # * Hpe3parSdk::HTTPBadRequest
652
+ # - INV_INPUT_BW_MIN_GOAL_GRT_MAX_LIMIT - Bandwidth maximum limit should be greater than the mimimum goal.
653
+ # * Hpe3parSdk::HTTPBadRequest
654
+ # - INV_INPUT_BELOW_RANGE - I/O-per-second limit is below range.Bandwidth limit is below range.
655
+ # * Hpe3parSdk::HTTPBadRequest
656
+ # - UNLICENSED_FEATURE - The system is not licensed for QoS.
657
+ def create_qos_rules(target_name, qos_rules, target_type = QoStargetType::VVSET)
658
+ if @current_version < @min_version && !qos_rules.nil?
659
+ qos_rules.delete_if { |key, _value| key == :latencyGoaluSecs }
660
+ end
661
+ begin
662
+ @qos.create_qos_rules(target_name, qos_rules, target_type)
663
+ rescue => ex
664
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
665
+ raise ex
666
+ end
667
+ end
668
+
669
+ # Modifies an existing QOS rules
670
+ #
671
+ # The QoS rule can be applied to VV sets. By using sys:all_others,
672
+ # you can apply the rule to all volumes in the system for which no
673
+ # QoS rule has been defined.
674
+ # ioMinGoal and ioMaxLimit must be used together to set I/O limits.
675
+ # Similarly, bwMinGoalKB and bwMaxLimitKB must be used together.
676
+ # If ioMaxLimitOP is set to 2 (no limit), ioMinGoalOP must also be
677
+ # to set to 2 (zero), and vice versa. They cannot be set to
678
+ # 'none' individually. Similarly, if bwMaxLimitOP is set to 2 (no
679
+ # limit), then bwMinGoalOP must also be set to 2.
680
+ # If ioMaxLimitOP is set to 1 (no limit), ioMinGoalOP must also be
681
+ # to set to 1 (zero) and vice versa. Similarly, if bwMaxLimitOP is
682
+ # set to 1 (zero), then bwMinGoalOP must also be set to 1.
683
+ # The ioMinGoalOP and ioMaxLimitOP fields take precedence over
684
+ # the ioMinGoal and ioMaxLimit fields.
685
+ # The bwMinGoalOP and bwMaxLimitOP fields take precedence over
686
+ # the bwMinGoalKB and bwMaxLimitKB fields
687
+ #
688
+ # ==== Attributes
689
+ #
690
+ # * target_name: Name of the target object on which the QoS rule will be created.
691
+ # type target_name: String
692
+ # * target_type: Type of QoS target, either vvset or sys.Refer Hpe3parSdk::QoStargetTypeConstants for complete enumeration
693
+ # type target_type: String
694
+ # * qos_rules: QoS options
695
+ # type qos_rules: Hash
696
+ # qos_rules = {
697
+ # 'priority'=> 2, # Refer Hpe3parSdk::QoSpriorityEnumeration for complete enumeration
698
+ # 'bwMinGoalKB'=> 1024, # bandwidth rate minimum goal in
699
+ # # kilobytes per second
700
+ # 'bwMaxLimitKB'=> 1024, # bandwidth rate maximum limit in
701
+ # # kilobytes per second
702
+ # 'ioMinGoal'=> 10000, # I/O-per-second minimum goal.
703
+ # 'ioMaxLimit'=> 2000000, # I/0-per-second maximum limit
704
+ # 'enable'=> True, # QoS rule for target enabled?
705
+ # 'bwMinGoalOP'=> 1, # zero none operation enum, when set to
706
+ # # 1, bandwidth minimum goal is 0
707
+ # # when set to 2, the bandwidth minimum
708
+ # # goal is none (NoLimit)
709
+ # 'bwMaxLimitOP'=> 1, # zero none operation enum, when set to
710
+ # # 1, bandwidth maximum limit is 0
711
+ # # when set to 2, the bandwidth maximum
712
+ # # limit is none (NoLimit)
713
+ # 'ioMinGoalOP'=> 1, # zero none operation enum, when set to
714
+ # # 1, I/O minimum goal minimum goal is 0
715
+ # # when set to 2, the I/O minimum goal is
716
+ # # none (NoLimit)
717
+ # 'ioMaxLimitOP'=> 1, # zero none operation enum, when set to
718
+ # # 1, I/O maximum limit is 0
719
+ # # when set to 2, the I/O maximum limit
720
+ # # is none (NoLimit)
721
+ # 'latencyGoal'=> 5000, # Latency goal in milliseconds
722
+ # 'defaultLatency'=> false# Use latencyGoal or defaultLatency?
723
+ # }
724
+ #
725
+ # ==== Raises
726
+ #
727
+ # * Hpe3parSdk::HTTPBadRequest
728
+ # INV_INPUT_EXCEEDS_RANGE - Invalid input: number exceeds expected
729
+ # range.
730
+ # * Hpe3parSdk::HTTPNotFound
731
+ # NON_EXISTENT_QOS_RULE - QoS rule does not exists.
732
+ # * Hpe3parSdk::HTTPBadRequest
733
+ # INV_INPUT_ILLEGAL_CHAR - Illegal character in the input.
734
+ # * Hpe3parSdk::HTTPBadRequest
735
+ # EXISTENT_QOS_RULE - QoS rule already exists.
736
+ # * Hpe3parSdk::HTTPBadRequest
737
+ # INV_INPUT_IO_MIN_GOAL_GRT_MAX_LIMIT - I/O-per-second maximum limit
738
+ # should be greater than the minimum goal.
739
+ # * Hpe3parSdk::HTTPBadRequest
740
+ # INV_INPUT_BW_MIN_GOAL_GRT_MAX_LIMIT - Bandwidth maximum limit
741
+ # should be greater than the minimum goal.
742
+ # * Hpe3parSdk::HTTPBadRequest
743
+ # INV_INPUT_BELOW_RANGE - I/O-per-second limit is below
744
+ # range. Bandwidth limit is below range.
745
+ # * Hpe3parSdk::HTTPBadRequest
746
+ # UNLICENSED_FEATURE - The system is not licensed for QoS.
747
+ def modify_qos_rules(target_name, qos_rules, target_type = QoStargetTypeConstants::VVSET)
748
+ if @current_version < @min_version && !qos_rules.nil?
749
+ qos_rules.delete_if { |key, _value| key == :latencyGoaluSecs }
750
+ end
751
+ begin
752
+ @qos.modify_qos_rules(target_name, qos_rules, target_type)
753
+ rescue => ex
754
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
755
+ raise ex
756
+ end
757
+ end
758
+
759
+ # Deletes QoS rules.
760
+ #
761
+ # ==== Attributes
762
+ #
763
+ # * target_name: Name of the target. When target_type is sys, target_name must be sys:all_others.
764
+ # type target_name: String
765
+ # * target_type: target type is vvset or sys
766
+ # type target_type: String
767
+ #
768
+ # ==== Raises
769
+ #
770
+ # * Hpe3parSdk::HTTPNotFound
771
+ # NON_EXISTENT_QOS_RULE - QoS rule does not exist.
772
+ # * Hpe3parSdk::HTTPBadRequest
773
+ # INV_INPUT_ILLEGAL_CHAR - Illegal character in the input
774
+ def delete_qos_rules(target_name, target_type = QoStargetTypeConstants::VVSET)
775
+ begin
776
+ @qos.delete_qos_rules(target_name, target_type)
777
+ rescue => ex
778
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
779
+ raise ex
780
+ end
781
+ end
782
+
783
+ # Gets all hosts.
784
+ #
785
+ # ==== Returns
786
+ #
787
+ # Array of Host.
788
+ def get_hosts
789
+ begin
790
+ @host.get_hosts
791
+ rescue => ex
792
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
793
+ raise ex
794
+ end
795
+ end
796
+
797
+ # Gets host information by name.
798
+ #
799
+ # ==== Attributes
800
+ #
801
+ # * name - The name of the host to find.
802
+ # type name: String
803
+ #
804
+ # ==== Returns
805
+ #
806
+ # Host.
807
+ #
808
+ # ==== Raises
809
+ #
810
+ # * Hpe3parSdk::HTTPBadRequest
811
+ # - INV_INPUT - Invalid URI syntax.
812
+ # * Hpe3parSdk::HTTPNotFound
813
+ # - NON_EXISTENT_HOST - Host not found.
814
+ # * Hpe3parSdk::HTTPInternalServerError
815
+ # - INT_SERV_ERR - Internal server error.
816
+ # * Hpe3parSdk::HTTPBadRequest
817
+ # - INV_INPUT_ILLEGAL_CHAR - Host name contains invalid character.
818
+ def get_host(name)
819
+ begin
820
+ @host.get_host(name)
821
+ rescue => ex
822
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
823
+ raise ex
824
+ end
825
+ end
826
+
827
+ # Creates a new Host.
828
+ #
829
+ # ==== Attributes
830
+ #
831
+ # * name - The name of the host.
832
+ # type name: String
833
+ # * iscsi_names - Array of iSCSI iqns.
834
+ # type iscsi_names: Array
835
+ # * fcwwns - Array of Fibre Channel World Wide Names.
836
+ # type fcwwns: Array
837
+ # * optional - The optional stuff.
838
+ # type optional: Hash
839
+ # optional = {
840
+ # 'persona'=> 1, # Refer Hpe3parSdk::HostPersona for complete enumeration.
841
+ # # 3.1.3 default: Generic-ALUA
842
+ # # 3.1.2 default: General
843
+ # 'domain'=> 'myDomain', # Create the host in the
844
+ # # specified domain, or default
845
+ # # domain if unspecified.
846
+ # 'forceTearDown'=> false, # If True, force to tear down
847
+ # # low-priority VLUN exports.
848
+ # 'descriptors'=>
849
+ # {'location'=> 'earth', # The host's location
850
+ # 'IPAddr'=> '10.10.10.10', # The host's IP address
851
+ # 'os'=> 'linux', # The operating system running on the host.
852
+ # 'model'=> 'ex', # The host's model
853
+ # 'contact'=> 'Smith', # The host's owner and contact
854
+ # 'comment'=> "Joe's box"} # Additional host information
855
+ # }
856
+ #
857
+ # ==== Raises
858
+ #
859
+ # * Hpe3parSdk::HTTPForbidden
860
+ # - PERM_DENIED - Permission denied.
861
+ # * Hpe3parSdk::HTTPBadRequest
862
+ # - INV_INPUT_MISSING_REQUIRED - Name not specified.
863
+ # * Hpe3parSdk::HTTPBadRequest
864
+ # - INV_INPUT_PARAM_CONFLICT - FCWWNs and iSCSINames are both specified.
865
+ # * Hpe3parSdk::HTTPBadRequest
866
+ # - INV_INPUT_EXCEEDS_LENGTH - Host name, domain name, or iSCSI name is too long.
867
+ # * Hpe3parSdk::HTTPBadRequest
868
+ # - INV_INPUT_EMPTY_STR - Input string (for domain name, iSCSI name, etc.) is empty.
869
+ # * Hpe3parSdk::HTTPBadRequest
870
+ # - INV_INPUT_ILLEGAL_CHAR - Any error from host-name or domain-name parsing.
871
+ # * Hpe3parSdk::HTTPBadRequest
872
+ # - INV_INPUT_TOO_MANY_WWN_OR_iSCSI - More than 1024 WWNs or iSCSI names are specified.
873
+ # * Hpe3parSdk::HTTPBadRequest
874
+ # - INV_INPUT_WRONG_TYPE - The length of WWN is not 16. WWN specification contains non-hexadecimal digit.
875
+ # * Hpe3parSdk::HTTPConflict
876
+ # - EXISTENT_PATH - host WWN/iSCSI name already used by another host.
877
+ # * Hpe3parSdk::HTTPConflict
878
+ # - EXISTENT_HOST - host name is already used.
879
+ # * Hpe3parSdk::HTTPBadRequest
880
+ # - NO_SPACE - No space to create host.
881
+ def create_host(name, iscsi_names = nil, fcwwns = nil, optional = nil)
882
+ begin
883
+ @host.create_host(name, iscsi_names, fcwwns, optional)
884
+ rescue => ex
885
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
886
+ raise ex
887
+ end
888
+ end
889
+
890
+ # Modifies an existing Host.
891
+ #
892
+ # ==== Attributes
893
+ #
894
+ # * name - Name of the host.
895
+ # type name: String
896
+ # * mod_request - Objects for host modification request.
897
+ # type mod_request: Hash
898
+ # mod_request = {
899
+ # 'newName'=> 'myNewName', # New name of the host
900
+ # 'pathOperation'=> 1, # Refer Hpe3parSdk::HostEditOperation for complete enumeration
901
+ # 'FCWWNs'=> [], # One or more WWN to set for the host.
902
+ # 'iSCSINames'=> [], # One or more iSCSI names to set for the host.
903
+ # 'forcePathRemoval'=> false, # If True, remove SSN(s) or
904
+ # # iSCSI(s) even if there are
905
+ # # VLUNs exported to host
906
+ # 'persona'=> 1, # Refer Hpe3parSdk::HostPersona for complete enumeration.
907
+ # 'descriptors'=>
908
+ # {'location'=> 'earth', # The host's location
909
+ # 'IPAddr'=> '10.10.10.10', # The host's IP address
910
+ # 'os'=> 'linux', # The operating system running on the host.
911
+ # 'model'=> 'ex', # The host's model
912
+ # 'contact'=> 'Smith', # The host's owner and contact
913
+ # 'comment'=> 'Joes box'} # Additional host information
914
+ # 'chapOperation'=> 1, # Refer Hpe3parSdk::HostEditOperation for complete enumeration
915
+ # 'chapOperationMode'=> TARGET, # Refer Hpe3parSdk::ChapOperationMode for complete enumeration
916
+ # 'chapName'=> 'MyChapName', # The chap name
917
+ # 'chapSecret'=> 'xyz', # The chap secret for the host or the target
918
+ # 'chapSecretHex'=> false, # If True, the chapSecret is treated as Hex.
919
+ # 'chapRemoveTargetOnly'=> true # If True, then remove target chap only
920
+ # }
921
+ #
922
+ # ==== Raises
923
+ #
924
+ # * Hpe3parSdk::HTTPBadRequest
925
+ # - INV_INPUT - Missing host name.
926
+ # * Hpe3parSdk::HTTPBadRequest
927
+ # - INV_INPUT_PARAM_CONFLICT - Both iSCSINames & FCWWNs are specified. (lot of other possibilities).
928
+ # * Hpe3parSdk::HTTPBadRequest
929
+ # - INV_INPUT_ONE_REQUIRED - iSCSINames or FCWwns missing.
930
+ # * Hpe3parSdk::HTTPBadRequest
931
+ # - INV_INPUT_ONE_REQUIRED - No path operation specified.
932
+ # * Hpe3parSdk::HTTPBadRequest
933
+ # - INV_INPUT_BAD_ENUM_VALUE - Invalid enum value.
934
+ # * Hpe3parSdk::HTTPBadRequest
935
+ # - INV_INPUT_MISSING_REQUIRED - Required fields missing.
936
+ # * Hpe3parSdk::HTTPBadRequest
937
+ # - INV_INPUT_EXCEEDS_LENGTH - Host descriptor argument length, new host name, or iSCSI name is too long.
938
+ # * Hpe3parSdk::HTTPBadRequest
939
+ # - INV_INPUT_ILLEGAL_CHAR - Error parsing host or iSCSI name.
940
+ # * Hpe3parSdk::HTTPConflict
941
+ # - EXISTENT_HOST - New host name is already used.
942
+ # * Hpe3parSdk::HTTPNotFound
943
+ # - NON_EXISTENT_HOST - Host to be modified does not exist.
944
+ # * Hpe3parSdk::HTTPBadRequest
945
+ # - INV_INPUT_TOO_MANY_WWN_OR_iSCSI - More than 1024 WWNs or iSCSI names are specified.
946
+ # * Hpe3parSdk::HTTPBadRequest
947
+ # - INV_INPUT_WRONG_TYPE - Input value is of the wrong type.
948
+ # * Hpe3parSdk::HTTPConflict
949
+ # - EXISTENT_PATH - WWN or iSCSI name is already claimed by other host.
950
+ # * Hpe3parSdk::HTTPBadRequest
951
+ # - INV_INPUT_BAD_LENGTH - CHAP hex secret length is not 16 bytes, or chap ASCII secret length is not 12 to 16 characters.
952
+ # * Hpe3parSdk::HTTPNotFound
953
+ # - NO_INITIATOR_CHAP - Setting target CHAP without initiator CHAP.
954
+ # * Hpe3parSdk::HTTPNotFound
955
+ # - NON_EXISTENT_CHAP - Remove non-existing CHAP.
956
+ # * Hpe3parSdk::HTTPConflict
957
+ # - NON_UNIQUE_CHAP_SECRET - CHAP secret is not unique.
958
+ # * Hpe3parSdk::HTTPConflict
959
+ # - EXPORTED_VLUN - Setting persona with active export; remove a host path on an active export.
960
+ # * Hpe3parSdk::HTTPBadRequest
961
+ # - NON_EXISTENT_PATH - Remove a non-existing path.
962
+ # * Hpe3parSdk::HTTPConflict
963
+ # - LUN_HOSTPERSONA_CONFLICT - LUN number and persona capability conflict.
964
+ # * Hpe3parSdk::HTTPBadRequest
965
+ # - INV_INPUT_DUP_PATH - Duplicate path specified.
966
+ def modify_host(name, mod_request)
967
+ begin
968
+ @host.modify_host(name, mod_request)
969
+ rescue => ex
970
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
971
+ raise ex
972
+ end
973
+ end
974
+
975
+ # Deletes a host.
976
+ #
977
+ # ==== Attributes
978
+ #
979
+ # * name - The name of host to be deleted.
980
+ # type name: String
981
+ #
982
+ # ==== Raises
983
+ #
984
+ # * Hpe3parSdk::HTTPNotFound
985
+ # - NON_EXISTENT_HOST - Host not found
986
+ # * Hpe3parSdk::HTTPConflict
987
+ # - HOST_IN_SET - Host is a member of a set
988
+ def delete_host(name)
989
+ begin
990
+ @host.delete_host(name)
991
+ rescue => ex
992
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
993
+ raise ex
994
+ end
995
+ end
996
+
997
+ # Finds the host with the specified FC WWN path.
998
+ #
999
+ # ==== Attributes
1000
+ #
1001
+ # * wwn - Lookup based on WWN.
1002
+ # type wwn: String
1003
+ #
1004
+ # ==== Returns
1005
+ #
1006
+ # Host with specified FC WWN.
1007
+ #
1008
+ # ==== Raises
1009
+ #
1010
+ # * Hpe3parSdk::HTTPBadRequest
1011
+ # - INV_INPUT - Invalid URI syntax.
1012
+ # * Hpe3parSdk::HTTPNotFound
1013
+ # - NON_EXISTENT_HOST - HOST Not Found
1014
+ # * Hpe3parSdk::HTTPInternalServerError
1015
+ # - INTERNAL_SERVER_ERR - Internal server error.
1016
+ # * Hpe3parSdk::HTTPBadRequest
1017
+ # - INV_INPUT_ILLEGAL_CHAR - Host name contains invalid character.
1018
+ def query_host_by_fc_path(wwn = nil)
1019
+ begin
1020
+ @host.query_host_by_fc_path(wwn)
1021
+ rescue => ex
1022
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1023
+ raise ex
1024
+ end
1025
+ end
1026
+
1027
+ # Finds the host with the specified iSCSI initiator.
1028
+ #
1029
+ # ==== Attributes
1030
+ #
1031
+ # * iqn - Lookup based on iSCSI initiator.
1032
+ # type iqn: String
1033
+ #
1034
+ # ==== Returns
1035
+ #
1036
+ # Host with specified IQN.
1037
+ #
1038
+ # ==== Raises
1039
+ #
1040
+ # * Hpe3parSdk::HTTPBadRequest
1041
+ # - INV_INPUT - Invalid URI syntax.
1042
+ # * Hpe3parSdk::HTTPNotFound
1043
+ # - NON_EXISTENT_HOST - The specified host not found.
1044
+ # * Hpe3parSdk::HTTPInternalServerError
1045
+ # - INTERNAL_SERVER_ERR - Internal server error.
1046
+ # * Hpe3parSdk::HTTPBadRequest
1047
+ # - INV_INPUT_ILLEGAL_CHAR - The host name contains invalid character.
1048
+ def query_host_by_iscsi_path(iqn = nil)
1049
+ begin
1050
+ @host.query_host_by_iscsi_path(iqn)
1051
+ rescue => ex
1052
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1053
+ raise ex
1054
+ end
1055
+ end
1056
+
1057
+ # Gets all host sets.
1058
+ #
1059
+ # ==== Returns
1060
+ #
1061
+ # Array of HostSet.
1062
+ def get_host_sets
1063
+ begin
1064
+ @host_set.get_host_sets
1065
+ rescue => ex
1066
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1067
+ raise ex
1068
+ end
1069
+ end
1070
+
1071
+ # Creates a new HostSet.
1072
+ #
1073
+ # ==== Attributes
1074
+ #
1075
+ # * name - Name of the host set to be created.
1076
+ # type name: String
1077
+ # * domain - The domain in which the host set will be created.
1078
+ # type domain: String
1079
+ # * comment - Comment for the host set.
1080
+ # type comment: String
1081
+ # * setmembers - The hosts to be added to the set. The existence of the host will not be checked.
1082
+ # type setmembers: Array of String
1083
+ #
1084
+ # ==== Raises
1085
+ #
1086
+ # * Hpe3parSdk::HTTPBadRequest
1087
+ # - EXISTENT_SET - The set already exits.
1088
+ # * Hpe3parSdk::HTTPNotFound
1089
+ # - NON_EXISTENT_DOMAIN - The domain does not exist.
1090
+ # * Hpe3parSdk::HTTPConflict
1091
+ # - MEMBER_IN_DOMAINSET - The host is in a domain set.
1092
+ # * Hpe3parSdk::HTTPConflict
1093
+ # - MEMBER_IN_SET - The object is already part of the set.
1094
+ # * Hpe3parSdk::HTTPConflict
1095
+ # - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.
1096
+ # * Hpe3parSdk::HTTPNotFound
1097
+ # - NON_EXISTENT_HOST - The host does not exists.
1098
+ # * Hpe3parSdk::HTTPBadRequest
1099
+ # - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
1100
+ def create_host_set(name, domain = nil, comment = nil, setmembers = nil)
1101
+ begin
1102
+ @host_set.create_host_set(name, domain, comment, setmembers)
1103
+ rescue => ex
1104
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1105
+ raise ex
1106
+ end
1107
+ end
1108
+
1109
+ # Deletes a HostSet.
1110
+ #
1111
+ # ==== Attributes
1112
+ #
1113
+ # * name - The hostset to delete.
1114
+ # type name: String
1115
+ #
1116
+ # ==== Raises
1117
+ #
1118
+ # * Hpe3parSdk::HTTPNotFound
1119
+ # - NON_EXISTENT_SET - The set does not exists.
1120
+ # * Hpe3parSdk::HTTPConflict
1121
+ # - EXPORTED_VLUN - The host set has exported VLUNs.
1122
+ def delete_host_set(name)
1123
+ begin
1124
+ @host_set.delete_host_set(name)
1125
+ rescue => ex
1126
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1127
+ raise ex
1128
+ end
1129
+ end
1130
+
1131
+ # Modifies a HostSet.
1132
+ #
1133
+ # ==== Attributes
1134
+ #
1135
+ # * name - Hostset name
1136
+ # type name: String
1137
+ # * action - Add or Remove host(s) from the set
1138
+ # type action: Refer values of Hpe3parSdk::SetCustomAction::MEM_ADD and Hpe3parSdk::SetCustomAction::MEM_REMOVE
1139
+ # * setmembers - Host(s) to add to the set, the existence of the host(s) will not be checked
1140
+ # type setmembers: Array of String
1141
+ # * new_name - New name of set
1142
+ # type new_name: String
1143
+ # * comment - New comment for the set
1144
+ # type comment: String
1145
+ #
1146
+ # ==== Raises
1147
+ #
1148
+ # * Hpe3parSdk::HTTPBadRequest
1149
+ # - EXISTENT_SET - The set already exits.
1150
+ # * Hpe3parSdk::HTTPNotFound
1151
+ # - NON_EXISTENT_SET - The set does not exists.
1152
+ # * Hpe3parSdk::HTTPConflict
1153
+ # - MEMBER_IN_DOMAINSET - The host is in a domain set.
1154
+ # * Hpe3parSdk::HTTPConflict
1155
+ # - MEMBER_IN_SET - The object is already part of the set.
1156
+ # * Hpe3parSdk::HTTPNotFound
1157
+ # - MEMBER_NOT_IN_SET - The object is not part of the set.
1158
+ # * Hpe3parSdk::HTTPConflict
1159
+ # - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to perform this operation.
1160
+ # * Hpe3parSdk::HTTPBadRequest
1161
+ # - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
1162
+ # * Hpe3parSdk::HTTPBadRequest
1163
+ # - INV_INPUT_PARAM_CONFLICT - Invalid input (parameters cannot be present at the same time).
1164
+ # * Hpe3parSdk::HTTPBadRequest
1165
+ # - INV_INPUT_ILLEGAL_CHAR - Invalid contains one or more illegal characters.
1166
+ def modify_host_set(name, action = nil, setmembers = nil, new_name = nil, comment = nil)
1167
+ begin
1168
+ @host_set.modify_host_set(name, action, setmembers, new_name, comment)
1169
+ rescue => ex
1170
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1171
+ raise ex
1172
+ end
1173
+ end
1174
+
1175
+ # Adds host(s) to a host set.
1176
+ #
1177
+ # ==== Attributes
1178
+ #
1179
+ # * set_name - Hostset name.
1180
+ # type set_name: String
1181
+ # * setmembers - Array of host names to add to the set.
1182
+ # type setmembers: Array of String
1183
+ def add_hosts_to_host_set(set_name, setmembers)
1184
+ begin
1185
+ @host_set.add_hosts_to_host_set(set_name, setmembers)
1186
+ rescue => ex
1187
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1188
+ raise ex
1189
+ end
1190
+ end
1191
+
1192
+ # Removes host(s) from a host set.
1193
+ #
1194
+ # ==== Attributes
1195
+ #
1196
+ # * set_name - The host set name.
1197
+ # type set_name: String
1198
+ # * setmembers - Array of host names to remove from the set.
1199
+ # type setmembers: Array of String
1200
+ def remove_hosts_from_host_set(set_name, setmembers)
1201
+ begin
1202
+ @host_set.remove_hosts_from_host_set(set_name, setmembers)
1203
+ rescue => ex
1204
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1205
+ raise ex
1206
+ end
1207
+ end
1208
+
1209
+ # Returns an array of every Hostset the given host is a part of. The array can contain zero, one, or multiple items.
1210
+ #
1211
+ # ==== Attributes
1212
+ #
1213
+ # * host_name - The host name of whose hostset is to be found.
1214
+ # type host_name: String
1215
+ #
1216
+ # ==== Returns
1217
+ #
1218
+ # Array of HostSet.
1219
+ def find_host_sets(host_name)
1220
+ begin
1221
+ @host_set.find_host_sets(host_name)
1222
+ rescue => ex
1223
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1224
+ raise ex
1225
+ end
1226
+ end
1227
+
1228
+ # Gets hostset information by name.
1229
+ #
1230
+ # ==== Attributes
1231
+ #
1232
+ # * name - The name of the hostset to find.
1233
+ # type name: String
1234
+ #
1235
+ # ==== Returns
1236
+ #
1237
+ # HostSet.
1238
+ #
1239
+ # ==== Raises
1240
+ #
1241
+ # * Hpe3parSdk::HTTPNotFound
1242
+ # - NON_EXISTENT_SET - The set does not exist.
1243
+ def get_host_set(name)
1244
+ begin
1245
+ @host_set.get_host_set(name)
1246
+ rescue => ex
1247
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1248
+ raise ex
1249
+ end
1250
+ end
1251
+
1252
+ # Gets all of the VLUNs on a specific host.
1253
+ #
1254
+ # ==== Attributes
1255
+ #
1256
+ # * host_name - Name of the host.
1257
+ # type host_name: String
1258
+ #
1259
+ # ==== Returns
1260
+ #
1261
+ # Array of VLUN.
1262
+ #
1263
+ # ==== Raises
1264
+ #
1265
+ # * Hpe3parSdk::HTTPNotFound
1266
+ # - NON_EXISTENT_HOST - The specified host not found.
1267
+ def get_host_vluns(host_name)
1268
+ begin
1269
+ @host.get_host_vluns(host_name)
1270
+ rescue => ex
1271
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1272
+ raise ex
1273
+ end
1274
+ end
1275
+
1276
+ # Gets all Volumes in the array
1277
+ #
1278
+ # ==== Returns
1279
+ #
1280
+ # Array of VirtualVolume
1281
+ def get_volumes
1282
+ begin
1283
+ @volume.get_volumes(VolumeCopyType::BASE_VOLUME)
1284
+ rescue => ex
1285
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1286
+ raise ex
1287
+ end
1288
+ end
1289
+
1290
+ # Gets the list of snapshots in the array
1291
+ #
1292
+ # ==== Returns
1293
+ #
1294
+ # Array of VirtualVolume
1295
+ def get_snapshots
1296
+ begin
1297
+ @volume.get_volumes(VolumeCopyType::VIRTUAL_COPY)
1298
+ rescue => ex
1299
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1300
+ raise ex
1301
+ end
1302
+ end
1303
+
1304
+ # Gets information about a volume by name
1305
+ #
1306
+ # ==== Attributes
1307
+ #
1308
+ # * name - The name of the volume to find
1309
+ # type name: String
1310
+ #
1311
+ # ==== Returns
1312
+ #
1313
+ # VirtualVolume
1314
+ #
1315
+ # ==== Raises
1316
+ #
1317
+ # * Hpe3parSdk::HPE3PARException
1318
+ # Error with code: 23 message: volume does not exist
1319
+ def get_volume(name)
1320
+ begin
1321
+ @volume.get_volume(name)
1322
+ rescue => ex
1323
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1324
+ raise ex
1325
+ end
1326
+ end
1327
+
1328
+ # Gets information about a volume by wwn
1329
+ #
1330
+ # ==== Attributes
1331
+ #
1332
+ # * wwn - The wwn of the volume to find
1333
+ # type wwn: String
1334
+ #
1335
+ # ==== Returns
1336
+ #
1337
+ # * VirtualVolume
1338
+ #
1339
+ # ==== Raises
1340
+ #
1341
+ # * Hpe3parSdk::HPE3PARException
1342
+ # Error with code: 23 message: volume does not exist
1343
+ def get_volume_by_wwn(wwn)
1344
+ begin
1345
+ @volume.get_volume_by_wwn(wwn)
1346
+ rescue => ex
1347
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1348
+ raise ex
1349
+ end
1350
+ end
1351
+
1352
+ # Creates a new volume.
1353
+ #
1354
+ # ==== Attributes
1355
+ #
1356
+ # * name - the name of the volume
1357
+ # type name: String
1358
+ # * cpg_name - the name of the destination CPG
1359
+ # type cpg_name: String
1360
+ # * size_MiB - size in MiB for the volume
1361
+ # type size_MiB: Integer
1362
+ # * optional - hash of other optional items
1363
+ # type optional: hash
1364
+ #
1365
+ # optional = {
1366
+ # 'id' => 12, # Volume ID. If not specified, next
1367
+ # # available is chosen
1368
+ # 'comment' => 'some comment', # Additional information up to 511
1369
+ # # characters
1370
+ # 'policies: { # Specifies VV policies
1371
+ # 'staleSS' => false, # True allows stale snapshots.
1372
+ # 'oneHost' => true, # True constrains volume export to
1373
+ # # single host or host cluster
1374
+ # 'zeroDetect' => true, # True requests Storage System to
1375
+ # # scan for zeros in incoming write
1376
+ # # data
1377
+ # 'system' => false, # True special volume used by system
1378
+ # # False is normal user volume
1379
+ # 'caching' => true}, # Read-only. True indicates write &
1380
+ # # read caching & read ahead enabled
1381
+ # 'snapCPG' => 'CPG name', # CPG Used for snapshots
1382
+ # 'ssSpcAllocWarningPct' => 12, # Snapshot space allocation warning
1383
+ # 'ssSpcAllocLimitPct' => 22, # Snapshot space allocation limit
1384
+ # 'tpvv' => true, # True: Create TPVV
1385
+ # # False (default) Create FPVV
1386
+ # 'usrSpcAllocWarningPct' => 22, # Enable user space allocation
1387
+ # # warning
1388
+ # 'usrSpcAllocLimitPct' => 22, # User space allocation limit
1389
+ # 'expirationHours' => 256, # Relative time from now to expire
1390
+ # # volume (max 43,800 hours)
1391
+ # 'retentionHours' => 256 # Relative time from now to retain
1392
+ # }
1393
+ #
1394
+ # ==== Raises
1395
+ #
1396
+ # * Hpe3parSdk::HTTPBadRequest
1397
+ # - INV_INPUT - Invalid Parameter
1398
+ # * Hpe3parSdk::HTTPBadRequest
1399
+ # - TOO_LARGE - Volume size above limit
1400
+ # * Hpe3parSdk::HTTPBadRequest
1401
+ # - NO_SPACE - Not Enough space is available
1402
+ # * Hpe3parSdk::HTTPForbidden
1403
+ # - PERM_DENIED - Permission denied
1404
+ # * Hpe3parSdk::HTTPConflict
1405
+ # - EXISTENT_SV - Volume Exists already
1406
+ def create_volume(name, cpg_name, size_MiB, optional = nil)
1407
+ if @current_version < @min_version_with_compression && !optional.nil?
1408
+ optional.delete_if { |key, _value| key == :compression }
1409
+ end
1410
+ begin
1411
+ @volume.create_volume(name, cpg_name, size_MiB, optional)
1412
+ rescue => ex
1413
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1414
+ raise ex
1415
+ end
1416
+ end
1417
+
1418
+ # Deletes a volume
1419
+ #
1420
+ # ==== Attributes
1421
+ #
1422
+ # * name - the name of the volume
1423
+ # type name: String
1424
+ #
1425
+ # ==== Raises
1426
+ #
1427
+ # * Hpe3parSdk::HTTPNotFound
1428
+ # - NON_EXISTENT_VOL - The volume does not exist
1429
+ # * Hpe3parSdk::HTTPForbidden
1430
+ # - PERM_DENIED - Permission denied
1431
+ # * Hpe3parSdk::HTTPForbidden
1432
+ # - RETAINED - Volume retention time has not expired
1433
+ # * Hpe3parSdk::HTTPForbidden
1434
+ # - HAS_RO_CHILD - Volume has read-only child
1435
+ # * Hpe3parSdk::HTTPConflict
1436
+ # - HAS_CHILD - The volume has a child volume
1437
+ # * Hpe3parSdk::HTTPConflict
1438
+ # - IN_USE - The volume is in use by VV set, VLUN, etc
1439
+ def delete_volume(name)
1440
+ begin
1441
+ @volume.delete_volume(name)
1442
+ rescue => ex
1443
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1444
+ raise ex
1445
+ end
1446
+ end
1447
+
1448
+ # Modifies a volume
1449
+ #
1450
+ # ==== Attributes
1451
+ #
1452
+ # * name - the name of the volume
1453
+ # type name: String
1454
+ # * volumeMods - Hash of volume attributes to change
1455
+ # type volumeMods: Hash
1456
+ # volumeMods = {
1457
+ # 'newName' => 'newName', # New volume name
1458
+ # 'comment' => 'some comment', # New volume comment
1459
+ # 'snapCPG' => 'CPG name', # Snapshot CPG name
1460
+ # 'policies: { # Specifies VV policies
1461
+ # 'staleSS' => false, # True allows stale snapshots.
1462
+ # 'oneHost' => true, # True constrains volume export to
1463
+ # # single host or host cluster
1464
+ # 'zeroDetect' => true, # True requests Storage System to
1465
+ # # scan for zeros in incoming write
1466
+ # # data
1467
+ # 'system' => false, # True special volume used by system
1468
+ # # False is normal user volume
1469
+ # 'caching' => true}, # Read-only. True indicates write &
1470
+ # # read caching & read ahead enabled
1471
+ # 'ssSpcAllocWarningPct' => 12, # Snapshot space allocation warning
1472
+ # 'ssSpcAllocLimitPct' => 22, # Snapshot space allocation limit
1473
+ # 'tpvv' => true, # True: Create TPVV
1474
+ # # False: (default) Create FPVV
1475
+ # 'usrSpcAllocWarningPct' => 22, # Enable user space allocation
1476
+ # # warning
1477
+ # 'usrSpcAllocLimitPct' => 22, # User space allocation limit
1478
+ # 'userCPG' => 'User CPG name', # User CPG name
1479
+ # 'expirationHours' => 256, # Relative time from now to expire
1480
+ # # volume (max 43,800 hours)
1481
+ # 'retentionHours' => 256, # Relative time from now to retain
1482
+ # # volume (max 43,800 hours)
1483
+ # 'rmSsSpcAllocWarning' => false, # True removes snapshot space
1484
+ # # allocation warning.
1485
+ # # False sets it when value > 0
1486
+ # 'rmUsrSpcAllocWarwaning' => false,# True removes user space
1487
+ # # allocation warning.
1488
+ # # False sets it when value > 0
1489
+ # 'rmExpTime' => false, # True resets expiration time to 0.
1490
+ # # False sets it when value > 0
1491
+ # 'rmSsSpcAllocLimit' => false, # True removes snapshot space
1492
+ # # allocation limit.
1493
+ # # False sets it when value > 0
1494
+ # 'rmUsrSpcAllocLimit' => false # True removes user space
1495
+ # # allocation limit.
1496
+ # # False sets it when value > 0
1497
+ # }
1498
+ #
1499
+ # ==== Raises:
1500
+ #
1501
+ # * Hpe3parSdk::HTTPBadRequest
1502
+ # - INV_INPUT_WARN_GT_LIMIT - Allocation warning level is higher than
1503
+ # the limit.
1504
+ # * Hpe3parSdk::HTTPBadRequest
1505
+ # - INV_INPUT_USR_ALRT_NON_TPVV - User space allocation alerts are
1506
+ # valid only with a TPVV.
1507
+ # * Hpe3parSdk::HTTPBadRequest
1508
+ # - INV_INPUT_RETAIN_GT_EXPIRE - Retention time is greater than
1509
+ # expiration time.
1510
+ # * Hpe3parSdk::HTTPBadRequest
1511
+ # - INV_INPUT_VV_POLICY - Invalid policy specification (for example,
1512
+ # caching or system is set to true).
1513
+ # * Hpe3parSdk::HTTPBadRequest
1514
+ # - INV_INPUT_EXCEEDS_LENGTH - Invalid input: string length exceeds
1515
+ # limit.
1516
+ # * Hpe3parSdk::HTTPBadRequest
1517
+ # - INV_INPUT_TIME - Invalid time specified.
1518
+ # * Hpe3parSdk::HTTPForbidden
1519
+ # - INV_OPERATION_VV_MODIFY_USR_CPG_TPVV - usr_cpg cannot be modified
1520
+ # on a TPVV.
1521
+ # * Hpe3parSdk::HTTPBadRequest
1522
+ # - UNLICENSED_FEATURE - Retention time cannot be modified on a
1523
+ # system without the Virtual Lock license.
1524
+ # * Hpe3parSdk::HTTPForbidden
1525
+ # - CPG_NOT_IN_SAME_DOMAIN - Snap CPG is not in the same domain as
1526
+ # the user CPG.
1527
+ # * Hpe3parSdk::HTTPForbidden
1528
+ # - INV_OPERATION_VV_PEER_VOLUME - Cannot modify a peer volume.
1529
+ # * Hpe3parSdk::HTTPInternalServerError
1530
+ # - INT_SERV_ERR - Metadata of the VV is corrupted.
1531
+ # * Hpe3parSdk::HTTPForbidden
1532
+ # - INV_OPERATION_VV_SYS_VOLUME - Cannot modify retention time on a
1533
+ # system volume.
1534
+ # * Hpe3parSdk::HTTPForbidden
1535
+ # - INV_OPERATION_VV_INTERNAL_VOLUME - Cannot modify an internal
1536
+ # volume
1537
+ # * Hpe3parSdk::HTTPConflict
1538
+ # - INV_OPERATION_VV_VOLUME_NOT_DEFINED_ALL_NODES - Cannot modify a
1539
+ # volume until the volume is defined on all volumes.
1540
+ # * Hpe3parSdk::HTTPConflict
1541
+ # - INVALID_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - Cannot modify a
1542
+ # volume when an online copy for that volume is in progress.
1543
+ # * Hpe3parSdk::HTTPConflict
1544
+ # - INVALID_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Cannot modify a
1545
+ # volume in the middle of a conversion operation.
1546
+ # * Hpe3parSdk::HTTPConflict
1547
+ # - INVALID_OPERATION_VV_SNAPSPACE_NOT_MOVED_TO_CPG - Snapshot space
1548
+ # of a volume needs to be moved to a CPG before the user space.
1549
+ # * Hpe3parSdk::HTTPConflict
1550
+ # - INV_OPERATION_VV_VOLUME_ACCOUNTING_IN_PROGRESS - The volume
1551
+ # cannot be renamed until snapshot accounting has finished.
1552
+ # * Hpe3parSdk::HTTPForbidden
1553
+ # - INV_OPERATION_VV_ZERO_DETECT_TPVV - The zero_detect policy can be
1554
+ # used only on TPVVs.
1555
+ # * Hpe3parSdk::HTTPConflict
1556
+ # - INV_OPERATION_VV_CPG_ON_SNAPSHOT - CPG cannot be assigned to a
1557
+ # snapshot.
1558
+ def modify_volume(name, volume_mods)
1559
+ begin
1560
+ @volume.modify_volume(name, volume_mods)
1561
+ rescue => ex
1562
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1563
+ raise ex
1564
+ end
1565
+ end
1566
+
1567
+ # Grows an existing volume by 'amount' Mebibytes.
1568
+ #
1569
+ # ==== Attributes
1570
+ #
1571
+ # * name - the name of the volume
1572
+ # type name: String
1573
+ # * amount: the additional size in MiB to add, rounded up to the next chunklet size (e.g. 256 or 1000 MiB)
1574
+ # type amount: Integer
1575
+ #
1576
+ # ==== Raises:
1577
+ #
1578
+ # * Hpe3parSdk::HTTPForbidden
1579
+ # - VV_NOT_IN_SAME_DOMAIN - The volume is not in the same domain.
1580
+ # * Hpe3parSdk::HTTPNotFound
1581
+ # - NON_EXISTENT_VOL - The volume does not exist.
1582
+ # * Hpe3parSdk::HTTPForbidden
1583
+ # - INV_OPERATION_UNSUPPORTED_VV_TYPE - Invalid operation: Cannot
1584
+ # grow this type of volume.
1585
+ # * Hpe3parSdk::HTTPConflict
1586
+ # - INV_OPERATION_VV_TUNE_IN_PROGRESS - Invalid operation: Volume
1587
+ # tuning is in progress.
1588
+ # * Hpe3parSdk::HTTPBadRequest
1589
+ # - INV_INPUT_EXCEEDS_LENGTH - Invalid input: String length exceeds
1590
+ # limit.
1591
+ # * Hpe3parSdk::HTTPBadRequest
1592
+ # - INV_INPUT_VV_GROW_SIZE - Invalid grow size.
1593
+ # * Hpe3parSdk::HTTPForbidden
1594
+ # - VV_NEW_SIZE_EXCEEDS_CPG_LIMIT - New volume size exceeds CPG limit
1595
+ # * Hpe3parSdk::HTTPForbidden
1596
+ # - INV_OPERATION_VV_INTERNAL_VOLUME - This operation is not allowed
1597
+ # on an internal volume.
1598
+ # * Hpe3parSdk::HTTPConflict
1599
+ # - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Invalid operation: VV
1600
+ # conversion is in progress.
1601
+ # * Hpe3parSdk::HTTPConflict
1602
+ # - INV_OPERATION_VV_VOLUME_COPY_IN_PROGRESS - Invalid operation:
1603
+ # online copy is in progress.
1604
+ # * Hpe3parSdk::HTTPForbidden
1605
+ # - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Internal volume cleanup is
1606
+ # in progress.
1607
+ # * Hpe3parSdk::HTTPForbidden
1608
+ # - VV_IS_BEING_REMOVED - The volume is being removed.
1609
+ # * Hpe3parSdk::HTTPForbidden
1610
+ # - VV_IN_INCONSISTENT_STATE - The volume has an internal consistency
1611
+ # error.
1612
+ # * Hpe3parSdk::HTTPForbidden
1613
+ # - VV_SIZE_CANNOT_REDUCE - New volume size is smaller than the
1614
+ # current size.
1615
+ # * Hpe3parSdk::HTTPForbidden
1616
+ # - VV_NEW_SIZE_EXCEEDS_LIMITS - New volume size exceeds the limit.
1617
+ # * Hpe3parSdk::HTTPConflict
1618
+ # - INV_OPERATION_VV_SA_SD_SPACE_REMOVED - Invalid operation: Volume
1619
+ # SA/SD space is being removed.
1620
+ # * Hpe3parSdk::HTTPConflict
1621
+ # - INV_OPERATION_VV_IS_BUSY - Invalid operation: Volume is currently
1622
+ # busy.
1623
+ # * Hpe3parSdk::HTTPForbidden
1624
+ # - VV_NOT_STARTED - Volume is not started.
1625
+ # * Hpe3parSdk::HTTPConflict
1626
+ # - INV_OPERATION_VV_IS_PCOPY - Invalid operation: Volume is a
1627
+ # physical copy.
1628
+ # * Hpe3parSdk::HTTPForbidden
1629
+ # - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - Volume state is not normal
1630
+ # * Hpe3parSdk::HTTPConflict
1631
+ # - INV_OPERATION_VV_PROMOTE_IN_PROGRESS - Invalid operation: Volume
1632
+ # promotion is in progress.
1633
+ # * Hpe3parSdk::HTTPConflict
1634
+ # - INV_OPERATION_VV_PARENT_OF_PCOPY - Invalid operation: Volume is
1635
+ # the parent of physical copy.
1636
+ # * Hpe3parSdk::HTTPBadRequest
1637
+ # - NO_SPACE - Insufficent space for requested operation.
1638
+ def grow_volume(name, amount)
1639
+ begin
1640
+ @volume.grow_volume(name, amount)
1641
+ rescue => ex
1642
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1643
+ raise ex
1644
+ end
1645
+ end
1646
+
1647
+ # Creates a physical copy of a VirtualVolume
1648
+ #
1649
+ # ==== Attributes
1650
+ #
1651
+ # * src_name - the source volume name
1652
+ # type src_name: String
1653
+ # * dest_name - the destination volume name
1654
+ # type dest_name: String
1655
+ # * dest_cpg - the destination CPG
1656
+ # type dest_cpg: String
1657
+ # * optional - Hash of optional parameters
1658
+ # type optional: Hash
1659
+ #
1660
+ # optional = {
1661
+ # 'online' => false, # should physical copy be
1662
+ # # performed online?
1663
+ # 'tpvv' => false, # use thin provisioned space
1664
+ # # for destination
1665
+ # # (online copy only)
1666
+ # 'snapCPG' => 'OpenStack_SnapCPG', # snapshot CPG for the
1667
+ # # destination
1668
+ # # (online copy only)
1669
+ # 'saveSnapshot' => false, # save the snapshot of the
1670
+ # # source volume
1671
+ # 'priority' => 1 # taskPriorityEnum (does not
1672
+ # # apply to online copy - Hpe3parSdk::TaskPriority)
1673
+ # }
1674
+ def create_physical_copy(src_name, dest_name, dest_cpg, optional = nil)
1675
+ if @current_version < @min_version_with_compression && !optional.nil?
1676
+ [:compression, :allowRemoteCopyParent, :skipZero].each { |key| optional.delete key }
1677
+ end
1678
+ begin
1679
+ @volume.create_physical_copy(src_name, dest_name, dest_cpg, optional)
1680
+ rescue => ex
1681
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1682
+ raise ex
1683
+ end
1684
+ end
1685
+
1686
+ # Deletes a physical copy
1687
+ #
1688
+ # ==== Attributes
1689
+ #
1690
+ # * name - the name of the clone volume
1691
+ # type name: String
1692
+ #
1693
+ # ==== Raises:
1694
+ # * Hpe3parSdk::HTTPNotFound
1695
+ # - NON_EXISTENT_VOL - The volume does not exist
1696
+ # * Hpe3parSdk::HTTPForbidden
1697
+ # - PERM_DENIED - Permission denied
1698
+ # * Hpe3parSdk::HTTPForbidden
1699
+ # - RETAINED - Volume retention time has not expired
1700
+ # * Hpe3parSdk::HTTPForbidden
1701
+ # - HAS_RO_CHILD - Volume has read-only child
1702
+ # * Hpe3parSdk::HTTPConflict
1703
+ # - HAS_CHILD - The volume has a child volume
1704
+ # * Hpe3parSdk::HTTPConflict
1705
+ # - IN_USE - The volume is in use by VV set, VLUN, etc
1706
+ def delete_physical_copy(name)
1707
+ begin
1708
+ @volume.delete_volume(name)
1709
+ rescue => ex
1710
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1711
+ raise ex
1712
+ end
1713
+ end
1714
+
1715
+ # Tunes a volume
1716
+ #
1717
+ # ==== Attributes
1718
+ #
1719
+ # * name - the volume name
1720
+ # type name: String
1721
+ # * tune_operation - Enum of tune operation - 1: Change User CPG, 2: Change snap CPG
1722
+ # type dest_name: Integer
1723
+ # * optional - hash of optional parameters
1724
+ # type optional: hash
1725
+ #
1726
+ # optional = {
1727
+ # 'userCPG' => 'user_cpg', # Specifies the new user
1728
+ # # CPG to which the volume
1729
+ # # will be tuned.
1730
+ # 'snapCPG' => 'snap_cpg', # Specifies the snap CPG to
1731
+ # # which the volume will be
1732
+ # # tuned.
1733
+ # 'conversionOperation' => 1, # conversion operation enum. Refer Hpe3parSdk::VolumeConversionOperation
1734
+ # 'keepVV' => 'new_volume', # Name of the new volume
1735
+ # # where the original logical disks are saved.
1736
+ # 'compression' => true # Enables (true) or disables (false) compression.
1737
+ # # You cannot compress a fully provisioned volume.
1738
+ # }
1739
+ def tune_volume(name, tune_operation, optional = nil)
1740
+ if @current_version < @min_version_with_compression && !optional.nil?
1741
+ optional.delete_if { |key, _value| key == :compression }
1742
+ end
1743
+ begin
1744
+ object_hash = @volume.tune_volume(name, tune_operation, optional)
1745
+ get_task(object_hash['taskid'])
1746
+ rescue => ex
1747
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1748
+ raise ex
1749
+ end
1750
+ end
1751
+
1752
+ # Returns an array of every VolumeSet the given volume is a part of.
1753
+ # The array can contain zero, one, or multiple items.
1754
+ #
1755
+ # ==== Attributes
1756
+ #
1757
+ # * name - the volume name
1758
+ # type name: String
1759
+ #
1760
+ # ==== Returns
1761
+ #
1762
+ # Array of VolumeSet
1763
+ #
1764
+ # ==== Raises
1765
+ #
1766
+ # * Hpe3parSdk::HTTPForbidden
1767
+ # - VV_IN_INCONSISTENT_STATE - Internal inconsistency error in vol
1768
+ # * Hpe3parSdk::HTTPForbidden
1769
+ # - VV_IS_BEING_REMOVED - The volume is being removed
1770
+ # * Hpe3parSdk::HTTPNotFound
1771
+ # - NON_EXISTENT_VOLUME - The volume does not exists
1772
+ # * Hpe3parSdk::HTTPForbidden
1773
+ # - INV_OPERATION_VV_SYS_VOLUME - Illegal op on system vol
1774
+ # * Hpe3parSdk::HTTPForbidden
1775
+ # - INV_OPERATION_VV_INTERNAL_VOLUME - Illegal op on internal vol
1776
+ def find_all_volume_sets(name)
1777
+ begin
1778
+ @volume_set.find_all_volume_sets(name)
1779
+ rescue => ex
1780
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1781
+ raise ex
1782
+ end
1783
+ end
1784
+
1785
+ # Gets the Volume Sets
1786
+ #
1787
+ # ==== Returns
1788
+ #
1789
+ # Array of VolumeSet
1790
+ def get_volume_sets
1791
+ begin
1792
+ @volume_set.get_volume_sets
1793
+ rescue => ex
1794
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1795
+ raise ex
1796
+ end
1797
+ end
1798
+
1799
+ # Gets the information about a Volume Set.
1800
+ #
1801
+ # ==== Attributes
1802
+ #
1803
+ # * name - The name of the CPG to find
1804
+ # type name: String
1805
+ #
1806
+ # ==== Returns
1807
+ #
1808
+ # VolumeSet
1809
+ #
1810
+ # ==== Raises
1811
+ #
1812
+ # * Hpe3parSdk::HPE3PARException
1813
+ # Error with code: 102 message: Set does not exist
1814
+ def get_volume_set(name)
1815
+ begin
1816
+ @volume_set.get_volume_set(name)
1817
+ rescue => ex
1818
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1819
+ raise ex
1820
+ end
1821
+ end
1822
+
1823
+ # Creates a new volume set
1824
+ #
1825
+ # ==== Attributes
1826
+ #
1827
+ # * name - the volume set to create
1828
+ # type name: String
1829
+ # * domain: the domain where the set lives
1830
+ # type domain: String
1831
+ # * comment: the comment for the vv set
1832
+ # type comment: String
1833
+ # * setmembers: the vv(s) to add to the set, the existence of the vv(s) will not be checked
1834
+ # type name: Array of String
1835
+ #
1836
+ # ==== Raises
1837
+ #
1838
+ # * Hpe3parSdk::HTTPBadRequest
1839
+ # - INV_INPUT Invalid URI Syntax.
1840
+ # * Hpe3parSdk::HTTPBadRequest
1841
+ # - NON_EXISTENT_DOMAIN - Domain doesn't exist.
1842
+ # * Hpe3parSdk::HTTPBadRequest
1843
+ # - NO_SPACE - Not Enough space is available.
1844
+ # * Hpe3parSdk::HTTPBadRequest
1845
+ # - BAD_CPG_PATTERN A Pattern in a CPG specifies illegal values.
1846
+ # * Hpe3parSdk::HTTPForbidden
1847
+ # - PERM_DENIED - Permission denied
1848
+ # * Hpe3parSdk::HTTPConflict
1849
+ # - EXISTENT_CPG - CPG Exists already
1850
+ def create_volume_set(name, domain = nil, comment = nil, setmembers = nil)
1851
+ begin
1852
+ @volume_set.create_volume_set(name, domain, comment, setmembers)
1853
+ rescue => ex
1854
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1855
+ raise ex
1856
+ end
1857
+ end
1858
+
1859
+ # Deletes the volume set. You must clear all QOS rules before a volume set can be deleted.
1860
+ #
1861
+ # ==== Attributes
1862
+ #
1863
+ # * name - The name of the VolumeSet
1864
+ # type name: String
1865
+ #
1866
+ # ==== Raises
1867
+ #
1868
+ # * Hpe3parSdk::HTTPNotFound
1869
+ # - NON_EXISTENT_SET - The set does not exists.
1870
+ # * Hpe3parSdk::HTTPConflict
1871
+ # - - EXPORTED_VLUN - The host set has exported VLUNs. The VV set was exported.
1872
+ # * Hpe3parSdk::HTTPConflict
1873
+ # - VVSET_QOS_TARGET - The object is already part of the set.
1874
+ def delete_volume_set(name)
1875
+ begin
1876
+ @volume_set.delete_volume_set(name)
1877
+ rescue => ex
1878
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1879
+ raise ex
1880
+ end
1881
+ end
1882
+
1883
+ # Modifies a volume set by adding or removing a volume from the volume
1884
+ # set. It's actions is based on the enums MEM_ADD or MEM_REMOVE.
1885
+ #
1886
+ # ==== Attributes
1887
+ #
1888
+ # * action: add or remove volume from the set
1889
+ # type name: Hpe3parSdk::SetCustomAction
1890
+ # * name: the volume set name
1891
+ # type name: String
1892
+ # * newName: new name of set
1893
+ # type newName: String
1894
+ # * comment: the comment for on the vv set
1895
+ # type comment: String
1896
+ # * flash_cache_policy: the flash-cache policy for the vv set
1897
+ # type flash_cache_policy: enum
1898
+ # * setmembers: the vv to add to the set, the existence of the vv will not be checked
1899
+ # type name: Array of String
1900
+ #
1901
+ # ==== Raises
1902
+ #
1903
+ # * Hpe3parSdk::HTTPBadRequest
1904
+ # - EXISTENT_SET - The set already exits.
1905
+ # * Hpe3parSdk::HTTPBadRequest
1906
+ # - EXISTENT_SET - The set already exits.
1907
+ # * Hpe3parSdk::HTTPNotFound
1908
+ # - NON_EXISTENT_SET - The set does not exists.
1909
+ # * Hpe3parSdk::HTTPConflict
1910
+ # - MEMBER_IN_DOMAINSET - The host is in a domain set.
1911
+ # * Hpe3parSdk::HTTPConflict
1912
+ # - MEMBER_IN_SET - The object is already part of the set.
1913
+ # * Hpe3parSdk::HTTPNotFound
1914
+ # - MEMBER_NOT_IN_SET - The object is not part of the set.
1915
+ # * Hpe3parSdk::HTTPConflict
1916
+ # - MEMBER_NOT_IN_SAME_DOMAIN - Objects must be in the same domain to
1917
+ # perform this operation.
1918
+ # * Hpe3parSdk::HTTPForbidden
1919
+ # - VV_IN_INCONSISTENT_STATE - The volume has an internal
1920
+ # inconsistency error.
1921
+ # * Hpe3parSdk::HTTPForbidden
1922
+ # - VV_IS_BEING_REMOVED - The volume is being removed.
1923
+ # * Hpe3parSdk::HTTPNotFound
1924
+ # - NON_EXISTENT_VOLUME - The volume does not exists.
1925
+ # * Hpe3parSdk::HTTPForbidden
1926
+ # - INV_OPERATION_VV_SYS_VOLUME - The operation is not allowed on a
1927
+ # system volume.
1928
+ # * Hpe3parSdk::HTTPForbidden
1929
+ # - INV_OPERATION_VV_INTERNAL_VOLUME - The operation is not allowed
1930
+ # on an internal volume.
1931
+ # * Hpe3parSdk::HTTPBadRequest
1932
+ # - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
1933
+ # * Hpe3parSdk::HTTPBadRequest
1934
+ # - INV_INPUT_PARAM_CONFLICT - Invalid input (parameters cannot be
1935
+ # present at the same time).
1936
+ # * Hpe3parSdk::HTTPBadRequest
1937
+ # - INV_INPUT_ILLEGAL_CHAR - Invalid contains one or more illegal
1938
+ # characters.
1939
+ def modify_volume_set(name, action = nil, newName = nil, comment = nil, flash_cache_policy = nil, setmembers = nil)
1940
+ begin
1941
+ @volume_set.modify_volume_set(name, action, newName, comment, flash_cache_policy, setmembers)
1942
+ rescue => ex
1943
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1944
+ raise ex
1945
+ end
1946
+ end
1947
+
1948
+
1949
+ # Adds volume(s) to a volume set.
1950
+ #
1951
+ # ==== Attributes
1952
+ #
1953
+ # * set_name - the volume set name
1954
+ # type set_name: String
1955
+ # * setmembers - the volume(s) name to add
1956
+ # type setmembers: Array of String
1957
+ def add_volumes_to_volume_set(set_name, setmembers)
1958
+ begin
1959
+ @volume_set.add_volumes_to_volume_set(set_name, setmembers)
1960
+ rescue => ex
1961
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1962
+ raise ex
1963
+ end
1964
+ end
1965
+
1966
+ # Removes a volume from a volume set
1967
+ #
1968
+ # ==== Attributes
1969
+ #
1970
+ # * set_name - the volume set name
1971
+ # type set_name: String
1972
+ # * name - the volume name to remove
1973
+ # type name: String
1974
+ def remove_volumes_from_volume_set(set_name, setmembers)
1975
+ begin
1976
+ @volume_set.remove_volumes_from_volume_set(set_name, setmembers)
1977
+ rescue => ex
1978
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
1979
+ raise ex
1980
+ end
1981
+ end
1982
+
1983
+ # Creates a snapshot of an existing VolumeSet
1984
+ #
1985
+ # ==== Attributes
1986
+ #
1987
+ # * 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: http://www.hp.com/go/storage/docs
1988
+ # type name: String
1989
+ # * copy_of_name: the name of the parent volume
1990
+ # type copy_of_name: String
1991
+ # * comment: the comment on the vv set
1992
+ # type comment: String
1993
+ # * optional: Hash of optional params
1994
+ # type optional: Hash
1995
+ # optional = {
1996
+ # 'id' => 12, # Specifies ID of the volume set
1997
+ # # set, next by default
1998
+ # 'comment' => "some comment",
1999
+ # 'readOnly' => true, # Read Only
2000
+ # 'expirationHours' => 36, # time from now to expire
2001
+ # 'retentionHours' => 12 # time from now to expire
2002
+ # }
2003
+ #
2004
+ # ==== Raises
2005
+ #
2006
+ # * Hpe3parSdk::HTTPBadRequest
2007
+ # - INVALID_INPUT_VV_PATTERN - Invalid volume pattern specified
2008
+ # * Hpe3parSdk::HTTPNotFound
2009
+ # - NON_EXISTENT_SET - The set does not exists.
2010
+ # * Hpe3parSdk::HTTPNotFound
2011
+ # - EMPTY_SET - The set is empty
2012
+ # * Hpe3parSdk::HTTPServiceUnavailable
2013
+ # - VV_LIMIT_REACHED - Maximum number of volumes reached
2014
+ # * Hpe3parSdk::HTTPNotFound
2015
+ # - NON_EXISTENT_VOL - The storage volume does not exist
2016
+ # * Hpe3parSdk::HTTPForbidden
2017
+ # - VV_IS_BEING_REMOVED - The volume is being removed
2018
+ # * Hpe3parSdk::HTTPForbidden
2019
+ # - INV_OPERATION_VV_READONLY_TO_READONLY_SNAP - Creating a read-only copy from a read-only volume is not permitted
2020
+ # * Hpe3parSdk::HTTPConflict
2021
+ # - NO_SNAP_CPG - No snapshot CPG has been configured for the volume
2022
+ # * Hpe3parSdk::HTTPBadRequest
2023
+ # - INV_INPUT_DUP_NAME - Invalid input (duplicate name).
2024
+ # * Hpe3parSdk::HTTPForbidden
2025
+ # - INV_OPERATION_VV_SNAP_PARENT_SAME_BASE - Two parent snapshots share the same base volume
2026
+ # * Hpe3parSdk::HTTPConflict
2027
+ # - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - Invalid operation. Online copyis in progress
2028
+ # * Hpe3parSdk::HTTPServiceUnavailable
2029
+ # - VV_ID_LIMIT_REACHED - Max number of volumeIDs has been reached
2030
+ # * Hpe3parSdk::HTTPNotFound
2031
+ # - NON_EXISTENT_VOLUME - The volume does not exists
2032
+ # * Hpe3parSdk::HTTPForbidden
2033
+ # - VV_IN_STALE_STATE - The volume is in a stale state.
2034
+ # * Hpe3parSdk::HTTPForbidden
2035
+ # - VV_NOT_STARTED - Volume is not started
2036
+ # * Hpe3parSdk::HTTPForbidden
2037
+ # - VV_UNAVAILABLE - The volume is not accessible
2038
+ # * Hpe3parSdk::HTTPServiceUnavailable
2039
+ # - SNAPSHOT_LIMIT_REACHED - Max number of snapshots has been reached
2040
+ # * Hpe3parSdk::HTTPServiceUnavailable
2041
+ # - CPG_ALLOCATION_WARNING_REACHED - The CPG has reached the allocation warning
2042
+ # * Hpe3parSdk::HTTPConflict
2043
+ # - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - Invalid operation: VV conversion is in progress.
2044
+ # * Hpe3parSdk::HTTPForbidden
2045
+ # - INV_OPERATION_VV_CLEANUP_IN_PROGRESS - Internal volume cleanup is in progress.
2046
+ # * Hpe3parSdk::HTTPForbidden
2047
+ # - INV_OPERATION_VV_PEER_VOLUME - Cannot modify a peer volume.
2048
+ # * Hpe3parSdk::HTTPConflict
2049
+ # - INV_OPERATION_VV_VOLUME_CONV_IN_PROGRESS - INV_OPERATION_VV_ONLINE_COPY_IN_PROGRESS - The volume is the target of an online copy.
2050
+ # * Hpe3parSdk::HTTPForbidden
2051
+ # - INV_OPERATION_VV_INTERNAL_VOLUME - Illegal op on internal vol
2052
+ # * Hpe3parSdk::HTTPConflict
2053
+ # - EXISTENT_ID - An ID exists
2054
+ # * Hpe3parSdk::HTTPForbidden
2055
+ # - INV_OPERATION_VV_NOT_IN_NORMAL_STATE - Volume state is not normal
2056
+ # * Hpe3parSdk::HTTPForbidden
2057
+ # - VV_IN_INCONSISTENT_STATE - Internal inconsistency error in vol
2058
+ # * Hpe3parSdk::HTTPBadRequest
2059
+ # - INVALID_INPUT_VV_PATTERN - - INV_INPUT_RETAIN_GT_EXPIRE - Retention time is greater than expiration time.
2060
+ # * Hpe3parSdk::HTTPBadRequest
2061
+ # - INV_INPUT_TIME - Invalid time specified.
2062
+ # * Hpe3parSdk::HTTPForbidden
2063
+ # - INV_OPERATION_SNAPSHOT_NOT_SAME_TYPE - Some snapshots in the volume set are read-only, some are read-write
2064
+ def create_snapshot_of_volume_set(name, copy_of_name, optional = nil)
2065
+ begin
2066
+ @volume_set.create_snapshot_of_volume_set(name, copy_of_name, optional)
2067
+ rescue => ex
2068
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2069
+ raise ex
2070
+ end
2071
+ end
2072
+
2073
+ # Creates a snapshot of an existing Volume.
2074
+ #
2075
+ # ==== Attributes
2076
+ #
2077
+ # * name - the name of the Snapshot
2078
+ # type name: String
2079
+ # * copy_of_name - the name of the parent volume
2080
+ # type copy_of_name: String
2081
+ # * optional - Hash of other optional items
2082
+ # type optional: Hash
2083
+ #
2084
+ # optional = {
2085
+ # 'id' => 12, # Specifies the ID of the volume,
2086
+ # # next by default
2087
+ # 'comment' => "some comment",
2088
+ # 'readOnly' => true, # Read Only
2089
+ # 'expirationHours' => 36, # time from now to expire
2090
+ # 'retentionHours' => 12 # time from now to expire
2091
+ # }
2092
+ #
2093
+ # ==== Raises
2094
+ #
2095
+ # * Hpe3parSdk::HTTPNotFound
2096
+ # - INON_EXISTENT_VOL - The volume does not exist
2097
+ # * Hpe3parSdk::HTTPForbidden
2098
+ # - PERM_DENIED - Permission denied
2099
+ def create_snapshot(name, copy_of_name, optional = nil)
2100
+ if @current_version < @min_version_with_compression && !optional.nil?
2101
+ optional.delete_if { |key, _value| key == :allowRemoteCopyParent }
2102
+ end
2103
+ begin
2104
+ @volume.create_snapshot(name, copy_of_name, optional)
2105
+ rescue => ex
2106
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2107
+ raise ex
2108
+ end
2109
+ end
2110
+
2111
+ # Restores from a snapshot to a volume
2112
+ #
2113
+ # ==== Attributes
2114
+ #
2115
+ # * name - the name of the Snapshot
2116
+ # type name: String
2117
+ # * optional - hash of other optional items
2118
+ # type name: Hash
2119
+ #
2120
+ # optional = {
2121
+ # 'online' => false, # Enables (true) or disables
2122
+ # #(false) executing the promote
2123
+ # #operation on an online volume.
2124
+ # #The default setting is false
2125
+ #
2126
+ # 'priority' => 2 #Does not apply to online promote
2127
+ # #operation or to stop promote
2128
+ # #operation.
2129
+ #
2130
+ # 'allowRemoteCopyParent' => false #Allows the promote operation to
2131
+ # #proceed even if the RW parent
2132
+ # #volume is currently in a Remote
2133
+ # #Copy volume group, if that group
2134
+ # #has not been started. If the
2135
+ # #Remote Copy group has been
2136
+ # #started, this command fails.
2137
+ # #(WSAPI 1.6 and later.)
2138
+ # }
2139
+ #
2140
+ def restore_snapshot(name, optional = nil)
2141
+ if @current_version < @min_version_with_compression && !optional.nil?
2142
+ optional.delete_if { |key, _value| key == :allowRemoteCopyParent }
2143
+ end
2144
+ begin
2145
+ @volume.restore_snapshot(name, optional)
2146
+ rescue => ex
2147
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2148
+ raise ex
2149
+ end
2150
+ end
2151
+
2152
+ # Deletes a snapshot
2153
+ #
2154
+ # ==== Attributes
2155
+ #
2156
+ # * name - the name of the snapshot volume
2157
+ # type name: String
2158
+ #
2159
+ # ==== Raises:
2160
+ #
2161
+ # * Hpe3parSdk::HTTPNotFound
2162
+ # - NON_EXISTENT_VOL - The volume does not exist
2163
+ # * Hpe3parSdk::HTTPForbidden
2164
+ # - PERM_DENIED - Permission denied
2165
+ # * Hpe3parSdk::HTTPForbidden
2166
+ # - RETAINED - Volume retention time has not expired
2167
+ # * Hpe3parSdk::HTTPForbidden
2168
+ # - HAS_RO_CHILD - Volume has read-only child
2169
+ # * Hpe3parSdk::HTTPConflict
2170
+ # - HAS_CHILD - The volume has a child volume
2171
+ # * Hpe3parSdk::HTTPConflict
2172
+ # - IN_USE - The volume is in use by VV set, VLUN, etc
2173
+ def delete_snapshot(name)
2174
+ begin
2175
+ @volume.delete_volume(name)
2176
+ rescue => ex
2177
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2178
+ raise ex
2179
+ end
2180
+ end
2181
+
2182
+ # Gets the snapshots of a particular volume
2183
+ #
2184
+ # ==== Attributes
2185
+ #
2186
+ # * name - the name of the volume
2187
+ # type name: String
2188
+ #
2189
+ # ==== Returns
2190
+ #
2191
+ # Array of VirtualVolume
2192
+ def get_volume_snapshots(name)
2193
+ begin
2194
+ @volume.get_volume_snapshots(name)
2195
+ rescue => ex
2196
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2197
+ raise ex
2198
+ end
2199
+ end
2200
+
2201
+ # Gets an array of all ports on the 3PAR.
2202
+ #
2203
+ # ==== Returns
2204
+ #
2205
+ # Array of Port.
2206
+ def get_ports
2207
+ begin
2208
+ @port.get_ports
2209
+ rescue => ex
2210
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2211
+ raise ex
2212
+ end
2213
+ end
2214
+
2215
+ # Gets an array of Fibre Channel Ports.
2216
+ #
2217
+ # * state - Port link state.
2218
+ # type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.
2219
+ #
2220
+ # ==== Returns
2221
+ #
2222
+ # Array of Fibre Channel Port.
2223
+ def get_fc_ports(state = nil)
2224
+ begin
2225
+ @port.get_fc_ports(state)
2226
+ rescue => ex
2227
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2228
+ raise ex
2229
+ end
2230
+ end
2231
+
2232
+ # Gets an array of iSCSI Ports.
2233
+ #
2234
+ # * state - Port link state.
2235
+ # type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.
2236
+ #
2237
+ # ==== Returns
2238
+ #
2239
+ # Array of iSCSI Port.
2240
+ def get_iscsi_ports(state = nil)
2241
+ begin
2242
+ @port.get_iscsi_ports(state)
2243
+ rescue => ex
2244
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2245
+ raise ex
2246
+ end
2247
+ end
2248
+
2249
+ # Gets an array of IP Ports.
2250
+ #
2251
+ # ==== Attributes
2252
+ #
2253
+ # * state - Port link state.
2254
+ # type name: Integer. Refer Hpe3parSdk::PortLinkState for complete enumeration.
2255
+ #
2256
+ # ==== Returns
2257
+ #
2258
+ # Array of IP Port.
2259
+ def get_ip_ports(state = nil)
2260
+ begin
2261
+ @port.get_ip_ports(state)
2262
+ rescue => ex
2263
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2264
+ raise ex
2265
+ end
2266
+ end
2267
+
2268
+ # Gets entire list of CPGs.
2269
+ #
2270
+ # ==== Returns
2271
+ #
2272
+ # CPG array
2273
+ def get_cpgs
2274
+ begin
2275
+ @cpg.get_cpgs
2276
+ rescue => ex
2277
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2278
+ raise ex
2279
+ end
2280
+ end
2281
+
2282
+ # Gets information about a Cpg.
2283
+ #
2284
+ # ==== Attributes
2285
+ #
2286
+ # * name - The name of the cpg to find
2287
+ # type name: String
2288
+ #
2289
+ # ==== Returns
2290
+ #
2291
+ # CPG
2292
+ #
2293
+ # ==== Raises
2294
+ #
2295
+ # * Hpe3parSdk::HPE3PARException
2296
+ # Error with code: 15 message: cpg does not exist
2297
+ def get_cpg(name)
2298
+ begin
2299
+ @cpg.get_cpg(name)
2300
+ rescue => ex
2301
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2302
+ raise ex
2303
+ end
2304
+ end
2305
+
2306
+
2307
+ # Creates a new CPG.
2308
+ #
2309
+ # ==== Attributes
2310
+ #
2311
+ # * name - Name of the cpg
2312
+ # type name: String
2313
+ # * optional - Hash of other optional items
2314
+ # type optional: Hash
2315
+ #
2316
+ # optional = {
2317
+ # 'growthIncrementMiB' 100, # Growth increment in MiB for
2318
+ # # each auto-grown operation
2319
+ # 'growthLimitMiB': 1024, # Auto-grow operation is limited
2320
+ # # to specified storage amount
2321
+ # 'usedLDWarningAlertMiB': 200, # Threshold to trigger warning
2322
+ # # of used logical disk space
2323
+ # 'domain': 'MyDomain', # Name of the domain object
2324
+ # 'LDLayout': {
2325
+ # 'RAIDType': 1, # Disk Raid Type
2326
+ # 'setSize': 100, # Size in number of chunklets
2327
+ # 'HA': 0, # Layout supports failure of
2328
+ # # one port pair (1),
2329
+ # # one cage (2),
2330
+ # # or one magazine (3)
2331
+ # 'chunkletPosPref': 2, # Chunklet location perference
2332
+ # # characteristics.
2333
+ # # Lowest Number/Fastest transfer
2334
+ # # = 1
2335
+ # # Higher Number/Slower transfer
2336
+ # # = 2
2337
+ # 'diskPatterns': []} # Patterns for candidate disks
2338
+ # }
2339
+ #
2340
+ # ==== Raises
2341
+ # * Hpe3parSdk::HTTPBadRequest
2342
+ # - INV_INPUT Invalid URI Syntax.
2343
+ # * Hpe3parSdk::HTTPBadRequest
2344
+ # - NON_EXISTENT_DOMAIN - Domain doesn't exist.
2345
+ # * Hpe3parSdk::HTTPBadRequest
2346
+ # - NO_SPACE - Not Enough space is available.
2347
+ # * Hpe3parSdk::HTTPBadRequest
2348
+ # - BAD_CPG_PATTERN A Pattern in a CPG specifies illegal values.
2349
+ # * Hpe3parSdk::HTTPForbidden
2350
+ # - PERM_DENIED - Permission denied
2351
+ # * Hpe3parSdk::HTTPConflict
2352
+ # - EXISTENT_CPG - Cpg Exists already
2353
+ def create_cpg(name, optional = nil)
2354
+ begin
2355
+ @cpg.create_cpg(name, optional)
2356
+ rescue => ex
2357
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2358
+ raise ex
2359
+ end
2360
+ end
2361
+
2362
+ # Modifies a CPG.
2363
+ #
2364
+ # ==== Attributes
2365
+ #
2366
+ # * name - Name of the CPG
2367
+ # type name: String
2368
+ # * optional - hash of other optional items
2369
+ # type optional: Hash
2370
+ #
2371
+ # optional = {
2372
+ # 'newName'=> "newCPG:, # Specifies the name of the
2373
+ # # CPG to update.
2374
+ # 'disableAutoGrow'=>false, # Enables (false) or
2375
+ # # disables (true) CPG auto
2376
+ # # grow. Defaults to false.
2377
+ # 'rmGrowthLimit'=> false, # Enables (false) or
2378
+ # # disables (true) auto grow
2379
+ # # limit enforcement. Defaults
2380
+ # # to false.
2381
+ # 'rmWarningAlert'=> false, # Enables (false) or
2382
+ # # disables (true) warning
2383
+ # # limit enforcement. Defaults
2384
+ # # to false.
2385
+ # }
2386
+ #
2387
+ def modify_cpg(name, cpg_mods)
2388
+ begin
2389
+ @cpg.modify_cpg(name, cpg_mods)
2390
+ rescue => ex
2391
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2392
+ raise ex
2393
+ end
2394
+ end
2395
+
2396
+ # Gets available space information about a cpg.
2397
+ #
2398
+ # ==== Attributes
2399
+ #
2400
+ # * name - The name of the cpg to find
2401
+ # type name: String
2402
+ #
2403
+ # ==== Returns
2404
+ #
2405
+ # Available space details in form of LDLayoutCapacity object
2406
+ #
2407
+ # ==== Raises
2408
+ #
2409
+ # * Hpe3parSdk::HPE3PARException
2410
+ # Error with code: 15 message: cpg does not exist
2411
+ def get_cpg_available_space(name)
2412
+ begin
2413
+ @cpg.get_cpg_available_space(name)
2414
+ rescue => ex
2415
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2416
+ raise ex
2417
+ end
2418
+ end
2419
+
2420
+ # Deletes a CPG.
2421
+ #
2422
+ # ==== Attributes
2423
+ #
2424
+ # * name - The name of the CPG
2425
+ # type name: String
2426
+ #
2427
+ # ==== Raises
2428
+ #
2429
+ # * Hpe3parSdk::HPE3PARException
2430
+ # Error with code: 15 message: CPG does not exist
2431
+ # * Hpe3parSdk::HTTPForbidden
2432
+ # - IN_USE - The CPG Cannot be removed because it's in use.
2433
+ # * Hpe3parSdk::HTTPForbidden
2434
+ # - PERM_DENIED - Permission denied
2435
+ def delete_cpg(name)
2436
+ begin
2437
+ @cpg.delete_cpg(name)
2438
+ rescue => ex
2439
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2440
+ raise ex
2441
+ end
2442
+ end
2443
+
2444
+ # Gets the status of an online physical copy
2445
+ #
2446
+ # ==== Attributes
2447
+ #
2448
+ # * name - The name of the volume
2449
+ # type name: str
2450
+ #
2451
+ # ==== Returns
2452
+ #
2453
+ # Status of online copy (String)
2454
+ #
2455
+ # ==== Raises
2456
+ #
2457
+ # * Hpe3parSdk::HPE3PARException
2458
+ # Error: message: Volume not an online physical copy
2459
+ def get_online_physical_copy_status(name)
2460
+ begin
2461
+ @volume.get_online_physical_copy_status(name)
2462
+ rescue => ex
2463
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2464
+ raise ex
2465
+ end
2466
+ end
2467
+
2468
+ # Stops an offline physical copy operation
2469
+ #
2470
+ # ==== Attributes
2471
+ #
2472
+ # * name - The name of the volume
2473
+ # type name: String
2474
+ def stop_offline_physical_copy(name)
2475
+ begin
2476
+ @volume.stop_offline_physical_copy(name)
2477
+ rescue => ex
2478
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2479
+ raise ex
2480
+ end
2481
+ end
2482
+
2483
+ # Stops an online physical copy operation
2484
+ #
2485
+ # ==== Attributes
2486
+ #
2487
+ # * name - The name of the volume
2488
+ # type name: String
2489
+ def stop_online_physical_copy(name)
2490
+ begin
2491
+ @volume.stop_online_physical_copy(name)
2492
+ rescue => ex
2493
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2494
+ raise ex
2495
+ end
2496
+ end
2497
+
2498
+ # Resynchronizes a physical copy.
2499
+ #
2500
+ # ==== Attributes
2501
+ #
2502
+ # * name - The name of the volume
2503
+ # type name: String
2504
+ def resync_physical_copy(name)
2505
+ begin
2506
+ @volume.resync_physical_copy(name)
2507
+ rescue => ex
2508
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2509
+ raise ex
2510
+ end
2511
+ end
2512
+
2513
+ # Waits for a 3PAR task to end.
2514
+ #
2515
+ # ==== Attributes
2516
+ #
2517
+ # * task_id - The Id of the task to be waited upon.
2518
+ # type task_id: Integer
2519
+ # * poll_rate_secs - The polling interval in seconds.
2520
+ # type poll_rate_secs: Integer
2521
+ def wait_for_task_to_end(task_id, poll_rate_secs = 15)
2522
+ begin
2523
+ @task.wait_for_task_to_end(task_id, poll_rate_secs)
2524
+ rescue => ex
2525
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2526
+ raise ex
2527
+ end
2528
+ end
2529
+
2530
+ # Cancel a 3PAR task
2531
+ #
2532
+ # ==== Attributes
2533
+ #
2534
+ # * task_id - The Id of the task to be cancelled.
2535
+ # type task_id: Integer
2536
+ # ==== Raises
2537
+ #
2538
+ # * Hpe3parSdk::HTTPBadRequest
2539
+ # - NON_ACTIVE_TASK - The task is not active at this time.
2540
+ # * Hpe3parSdk::HTTPConflict
2541
+ # - INV_OPERATION_CANNOT_CANCEL_ TASK - Invalid operation: Task cannot be cancelled.
2542
+ def cancel_task(task_id)
2543
+ begin
2544
+ @task.cancel_task(task_id)
2545
+ rescue => ex
2546
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2547
+ raise ex
2548
+ end
2549
+ end
2550
+
2551
+ def flash_cache_exists?
2552
+ begin
2553
+ @flash_cache.flash_cache_exists?
2554
+ rescue => ex
2555
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2556
+ raise ex
2557
+ end
2558
+ end
2559
+
2560
+ def volume_exists?(name)
2561
+ begin
2562
+ @volume.volume_exists?(name)
2563
+ rescue => ex
2564
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2565
+ raise ex
2566
+ end
2567
+ end
2568
+
2569
+ def volume_set_exists?(name)
2570
+ begin
2571
+ @volume_set.volume_set_exists?(name)
2572
+ rescue => ex
2573
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2574
+ raise ex
2575
+ end
2576
+ end
2577
+
2578
+ def host_exists?(host_name)
2579
+ begin
2580
+ @host.host_exists?(host_name)
2581
+ rescue => ex
2582
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2583
+ raise ex
2584
+ end
2585
+ end
2586
+
2587
+ def host_set_exists?(host_name)
2588
+ begin
2589
+ @host_set.host_set_exists?(host_name)
2590
+ rescue => ex
2591
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2592
+ raise ex
2593
+ end
2594
+ end
2595
+
2596
+ def cpg_exists?(name)
2597
+ begin
2598
+ @cpg.cpg_exists?(name)
2599
+ rescue => ex
2600
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2601
+ raise ex
2602
+ end
2603
+ end
2604
+
2605
+ def flash_cache_exists?
2606
+ begin
2607
+ @flash_cache.flash_cache_exists?
2608
+ rescue => ex
2609
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2610
+ raise ex
2611
+ end
2612
+ end
2613
+
2614
+ def online_physical_copy_exists?(src_name, phy_copy_name)
2615
+ begin
2616
+ @volume.online_physical_copy_exists?(src_name, phy_copy_name)
2617
+ rescue => ex
2618
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2619
+ raise ex
2620
+ end
2621
+ end
2622
+
2623
+ def offline_physical_copy_exists?(src_name, phy_copy_name)
2624
+ begin
2625
+ @volume.offline_physical_copy_exists?(src_name, phy_copy_name)
2626
+ rescue => ex
2627
+ Util.log_exception(ex, caller_locations(1, 1)[0].label)
2628
+ raise ex
2629
+ end
2630
+ end
2631
+
2632
+ # Logout from the 3PAR Array
2633
+ def logout
2634
+ unless @log_file_path.nil?
2635
+ if Hpe3parSdk.logger != nil
2636
+ Hpe3parSdk.logger.close
2637
+ Hpe3parSdk.logger = nil
2638
+ end
2639
+ end
2640
+ begin
2641
+ @http.unauthenticate
2642
+ rescue Hpe3parSdk::HPE3PARException => ex
2643
+ #Do nothing
2644
+ end
2645
+ end
2646
+ end
2647
+ end