hpe3par_sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +55 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/Gemfile +15 -0
- data/LICENSE +201 -0
- data/README.md +192 -0
- data/Rakefile +103 -0
- data/bin/console +25 -0
- data/bin/setup +20 -0
- data/hpe3par_sdk.gemspec +45 -0
- data/lib/Hpe3parSdk.rb +19 -0
- data/lib/Hpe3parSdk/client.rb +2647 -0
- data/lib/Hpe3parSdk/constants.rb +421 -0
- data/lib/Hpe3parSdk/cpg_manager.rb +72 -0
- data/lib/Hpe3parSdk/exceptions.rb +503 -0
- data/lib/Hpe3parSdk/flash_cache_manager.rb +54 -0
- data/lib/Hpe3parSdk/host_manager.rb +152 -0
- data/lib/Hpe3parSdk/host_set_manager.rb +128 -0
- data/lib/Hpe3parSdk/http.rb +164 -0
- data/lib/Hpe3parSdk/models.rb +1850 -0
- data/lib/Hpe3parSdk/multi_log.rb +86 -0
- data/lib/Hpe3parSdk/port_manager.rb +62 -0
- data/lib/Hpe3parSdk/qos_manager.rb +64 -0
- data/lib/Hpe3parSdk/ssh.rb +46 -0
- data/lib/Hpe3parSdk/task_manager.rb +98 -0
- data/lib/Hpe3parSdk/tcl_parser.rb +15 -0
- data/lib/Hpe3parSdk/util.rb +30 -0
- data/lib/Hpe3parSdk/version.rb +14 -0
- data/lib/Hpe3parSdk/vlun_manager.rb +119 -0
- data/lib/Hpe3parSdk/volume_manager.rb +292 -0
- data/lib/Hpe3parSdk/volume_set_manager.rb +126 -0
- data/lib/Hpe3parSdk/wsapi_version.rb +73 -0
- metadata +194 -0
@@ -0,0 +1,421 @@
|
|
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
|
+
module Hpe3parSdk
|
13
|
+
class WSAPIVersionSupport
|
14
|
+
WSAPI_MIN_SUPPORTED_VERSION = '1.5.0'.freeze
|
15
|
+
WSAPI_MIN_VERSION_VLUN_QUERY_SUPPORT = '1.4.2'.freeze
|
16
|
+
WSAPI_MIN_VERSION_COMPRESSION_SUPPORT = '1.6.0'.freeze
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# This class enumerates the RAID types supported by HPE 3PAR.
|
22
|
+
class CPGRAIDType
|
23
|
+
R0 = 1
|
24
|
+
R1 = 2
|
25
|
+
R5 = 3
|
26
|
+
R6 = 4
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# This class enumerates the High Availability settings for a CPG.
|
31
|
+
class CPGHA
|
32
|
+
PORT = 1
|
33
|
+
CAGE = 2
|
34
|
+
MAG = 3
|
35
|
+
end
|
36
|
+
|
37
|
+
class RaidTypeSetSizeMap
|
38
|
+
R0 = [1]
|
39
|
+
R1 = [2, 3, 4]
|
40
|
+
R5 = [3, 4, 5, 6, 7, 8, 9]
|
41
|
+
R6 = [6, 8, 10, 12, 16]
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# This class enumerates the Chunklet position preference for a CPG.
|
46
|
+
class CPGChunkletPosPref
|
47
|
+
FIRST = 1
|
48
|
+
LAST = 2
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# This class enumerates the Detailed state values for a CPG.
|
53
|
+
class CPGDetailedState
|
54
|
+
SA_LIMIT_REACHED = 1
|
55
|
+
SD_LIMIT_REACHED = 2
|
56
|
+
SA_GROW_FAILED = 3
|
57
|
+
SD_GROW_FAILED = 4
|
58
|
+
SA_WARN_REACHED = 5
|
59
|
+
SD_WARN_REACHED = 6
|
60
|
+
INVALID = 7
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# This class enumerates the Disk type values for a CPG.
|
65
|
+
class CPGDiskType
|
66
|
+
FC = 1
|
67
|
+
NL = 2
|
68
|
+
SSD = 3
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# This class enumerates the State values for a CPG.
|
73
|
+
class CPGState
|
74
|
+
NORMAL = 1
|
75
|
+
DEGRADED = 2
|
76
|
+
FAILED = 3
|
77
|
+
UNKNOWN = 99
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# This class enumerates the Compression state values for a Volume.
|
82
|
+
class VolumeCompressionState
|
83
|
+
YES = 1
|
84
|
+
NO = 2
|
85
|
+
OFF = 3
|
86
|
+
NA = 4
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# This class enumerates the Provisioning type values for a Volume.
|
91
|
+
class VolumeProvisioningType
|
92
|
+
FULL = 1
|
93
|
+
TPVV = 2
|
94
|
+
SNP = 3
|
95
|
+
PEER = 4
|
96
|
+
UNKNOWN = 5
|
97
|
+
TDVV = 6
|
98
|
+
DDS = 7
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# This class enumerates the Copy type values for a Volume.
|
103
|
+
class VolumeCopyType
|
104
|
+
BASE_VOLUME = 1
|
105
|
+
PHYSICAL_COPY = 2
|
106
|
+
VIRTUAL_COPY = 3
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# This class enumerates the De-duplication state values for a Volume.
|
111
|
+
class VolumeDeduplicationState
|
112
|
+
YES = 1
|
113
|
+
NO = 2
|
114
|
+
NA = 3
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# This class enumerates the Detailed state values for a Volume.
|
119
|
+
class VolumeDetailedState
|
120
|
+
LDS_NOT_STARTED = 1
|
121
|
+
NOT_STARTED = 2
|
122
|
+
NEEDS_CHECK = 3
|
123
|
+
NEEDS_MAINT_CHECK = 4
|
124
|
+
INTERNAL_CONSISTENCY_ERROR = 5
|
125
|
+
SNAPDATA_INVALID = 6
|
126
|
+
PRESERVED = 7
|
127
|
+
STALE = 8
|
128
|
+
COPY_FAILED = 9
|
129
|
+
DEGRADED_AVAIL = 10
|
130
|
+
DEGRADED_PERF = 11
|
131
|
+
PROMOTING = 12
|
132
|
+
COPY_TARGET = 13
|
133
|
+
RESYNC_TARGET = 14
|
134
|
+
TUNING = 15
|
135
|
+
CLOSING = 16
|
136
|
+
REMOVING = 17
|
137
|
+
REMOVING_RETRY = 18
|
138
|
+
CREATING = 19
|
139
|
+
COPY_SOURCE = 20
|
140
|
+
IMPORTING = 21
|
141
|
+
CONVERTING = 22
|
142
|
+
INVALID = 23
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# This class enumerates the Host DIF values for a Volume.
|
147
|
+
class VolumeHostDIF
|
148
|
+
PAR_HOST_DIF = 1
|
149
|
+
STD_HOST_DIF = 2
|
150
|
+
NO_HOST_DIF = 3
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# This class enumerates the Custom actions that can be applied on a Volume.
|
155
|
+
class VolumeCustomAction
|
156
|
+
STOP_PHYSICAL_COPY = 1
|
157
|
+
RESYNC_PHYSICAL_COPY = 2
|
158
|
+
GROW_VOLUME = 3
|
159
|
+
PROMOTE_VIRTUAL_COPY = 4
|
160
|
+
STOP_PROMOTE_VIRTUAL_COPY = 5
|
161
|
+
TUNE_VOLUME = 6
|
162
|
+
UPDATE_VIRTUAL_COPY = 7
|
163
|
+
SNAPSHOT_ENUM_ACTION = 8
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# This class enumerates the Tune operations that can be applied on a Volume.
|
168
|
+
class VolumeTuneOperation
|
169
|
+
USR_CPG = 1
|
170
|
+
SNP_CPG = 2
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# This class enumerates the types of a VLUN.
|
175
|
+
class VlunType
|
176
|
+
EMPTY = 1
|
177
|
+
PORT = 2
|
178
|
+
HOST = 3
|
179
|
+
MATCHED_SET = 4
|
180
|
+
HOST_SET = 5
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# This class enumerates the types of multi-pathing for a VLUN.
|
185
|
+
class VlunMultipathing
|
186
|
+
UNKNOWN = 1
|
187
|
+
ROUND_ROBIN = 2
|
188
|
+
FAILOVER = 3
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# This class enumerates the types of failed path policies.
|
193
|
+
class VLUNfailedPathPol
|
194
|
+
UNKNOWN = 1
|
195
|
+
SCSI_TEST_UNIT_READY = 2
|
196
|
+
INQUIRY = 3
|
197
|
+
READ_SECTOR0 = 4
|
198
|
+
end
|
199
|
+
|
200
|
+
##
|
201
|
+
# This class enumerates the type of a Volume.
|
202
|
+
class VolumeConversionOperation
|
203
|
+
TPVV = 1
|
204
|
+
FPVV = 2
|
205
|
+
TDVV = 3
|
206
|
+
end
|
207
|
+
|
208
|
+
##
|
209
|
+
# This class enumerates the types QOS targets.
|
210
|
+
class QoStargetTypeConstants
|
211
|
+
VVSET = 'vvset'.freeze
|
212
|
+
SYS = 'sys'.freeze
|
213
|
+
end
|
214
|
+
|
215
|
+
##
|
216
|
+
# This class enumerates the various QOS target types.
|
217
|
+
class QoStargetType
|
218
|
+
VVSET = 1
|
219
|
+
SYS = 2
|
220
|
+
end
|
221
|
+
|
222
|
+
##
|
223
|
+
# This class enumerates the various QOS priorities.
|
224
|
+
class QoSpriorityEnumeration
|
225
|
+
LOW = 1
|
226
|
+
NORMAL = 2
|
227
|
+
HIGH = 3
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# This class enumerates options which can be used
|
232
|
+
# for QoS rule creation or modification.
|
233
|
+
# Refer HPE 3PAR WSAPI 1.6 documentation
|
234
|
+
class QosZeroNoneOperation
|
235
|
+
ZERO = 1
|
236
|
+
NOLIMIT = 2
|
237
|
+
end
|
238
|
+
|
239
|
+
|
240
|
+
##
|
241
|
+
# This class enumerates options which can be used
|
242
|
+
# for Flash Cache creation or modification.
|
243
|
+
# Refer HPE 3PAR WSAPI 1.6 documentation
|
244
|
+
class FlashCachePolicy
|
245
|
+
ENABLE = 1
|
246
|
+
DISABLE = 2
|
247
|
+
end
|
248
|
+
|
249
|
+
##
|
250
|
+
# This class enumerates custom actions which can be used
|
251
|
+
# on a VVSet.
|
252
|
+
# Refer HPE 3PAR WSAPI 1.6 documentation
|
253
|
+
class SetCustomAction
|
254
|
+
MEM_ADD = 1
|
255
|
+
MEM_REMOVE = 2
|
256
|
+
RESYNC_PHYSICAL_COPY = 3
|
257
|
+
STOP_PHYSICAL_COPY = 4
|
258
|
+
PROMOTE_VIRTUAL_COPY = 5
|
259
|
+
STOP_PROMOTE_VIRTUAL_COPY = 6
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# This class enumerates the various types of a Task.
|
264
|
+
class TaskType
|
265
|
+
VV_COPY = 1
|
266
|
+
PHYS_COPY_RESYNC = 2
|
267
|
+
MOVE_REGIONS = 3
|
268
|
+
PROMOTE_SV = 4
|
269
|
+
REMOTE_COPY_SYNC = 5
|
270
|
+
REMOTE_COPY_REVERSE = 6
|
271
|
+
REMOTE_COPY_FAILOVER = 7
|
272
|
+
REMOTE_COPY_RECOVER = 8
|
273
|
+
REMOTE_COPY_RESTORE = 9
|
274
|
+
COMPACT_CPG = 10
|
275
|
+
COMPACT_IDS = 11
|
276
|
+
SNAPSHOT_ACCOUNTING = 12
|
277
|
+
CHECK_VV = 13
|
278
|
+
SCHEDULED_TASK = 14
|
279
|
+
SYSTEM_TASK = 15
|
280
|
+
BACKGROUND_TASK = 16
|
281
|
+
IMPORT_VV = 17
|
282
|
+
ONLINE_COPY = 18
|
283
|
+
CONVERT_VV = 19
|
284
|
+
BACKGROUND_COMMAND = 20
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# This class enumerates the priorities that a Task can have.
|
289
|
+
class TaskPriority
|
290
|
+
HIGH = 1
|
291
|
+
MEDIUM = 2
|
292
|
+
LOW = 3
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# This class enumerates the statuses that a Task can have.
|
297
|
+
class TaskStatus
|
298
|
+
DONE = 1
|
299
|
+
ACTIVE = 2
|
300
|
+
CANCELLED = 3
|
301
|
+
FAILED = 4
|
302
|
+
|
303
|
+
|
304
|
+
def self.get_string(val)
|
305
|
+
case val
|
306
|
+
when 1
|
307
|
+
return 'DONE'
|
308
|
+
when 2
|
309
|
+
return 'ACTIVE'
|
310
|
+
when 3
|
311
|
+
return 'CANCELLED'
|
312
|
+
when 4
|
313
|
+
return 'FAILED'
|
314
|
+
else
|
315
|
+
raise 'Unknown value'
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# This class enumerates the modes of a Port.
|
323
|
+
class PortMode
|
324
|
+
SUSPENDED = 1
|
325
|
+
TARGET = 2
|
326
|
+
INITIATOR = 3
|
327
|
+
PEER = 4
|
328
|
+
end
|
329
|
+
|
330
|
+
##
|
331
|
+
# This class enumerates the link states of a Port.
|
332
|
+
class PortLinkState
|
333
|
+
CONFIG_WAIT = 1
|
334
|
+
ALPA_WAIT = 2
|
335
|
+
LOGIN_WAIT = 3
|
336
|
+
READY = 4
|
337
|
+
LOSS_SYNC = 5
|
338
|
+
ERROR_STATE = 6
|
339
|
+
XXX = 7
|
340
|
+
NONPARTICIPATE = 8
|
341
|
+
COREDUMP = 9
|
342
|
+
OFFLINE = 10
|
343
|
+
FWDEAD = 11
|
344
|
+
IDLE_FOR_RESET = 12
|
345
|
+
DHCP_IN_PROGRESS = 13
|
346
|
+
PENDING_RESET = 14
|
347
|
+
end
|
348
|
+
|
349
|
+
##
|
350
|
+
# This class enumerates the connection types of a Port.
|
351
|
+
class PortConnType
|
352
|
+
HOST = 1
|
353
|
+
DISK = 2
|
354
|
+
FREE = 3
|
355
|
+
IPORT = 4
|
356
|
+
RCFC = 5
|
357
|
+
PEER = 6
|
358
|
+
RCIP = 7
|
359
|
+
ISCSI = 8
|
360
|
+
CNA = 9
|
361
|
+
FS = 10
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# This class enumerates the protocols that a Port can support.
|
366
|
+
class PortProtocol
|
367
|
+
FC = 1
|
368
|
+
ISCSI = 2
|
369
|
+
FCOE = 3
|
370
|
+
IP = 4
|
371
|
+
SAS = 5
|
372
|
+
end
|
373
|
+
|
374
|
+
##
|
375
|
+
# This class enumerates the various fail over states of a Port.
|
376
|
+
class PortFailOverState
|
377
|
+
NONE = 1
|
378
|
+
FAILOVER_PENDING = 2
|
379
|
+
FAILED_OVER = 3
|
380
|
+
ACTIVE = 4
|
381
|
+
ACTIVE_DOWN = 5
|
382
|
+
ACTIVE_FAILED = 6
|
383
|
+
FAILBACK_PENDING = 7
|
384
|
+
end
|
385
|
+
|
386
|
+
##
|
387
|
+
# This class enumerates the various personae that a Host can have.
|
388
|
+
class HostPersona
|
389
|
+
GENERIC = 1
|
390
|
+
GENERIC_ALUA = 2
|
391
|
+
GENERIC_LEGACY = 3
|
392
|
+
HPUX_LEGACY = 4
|
393
|
+
AIX_LEGACY = 5
|
394
|
+
EGENERA = 6
|
395
|
+
ONTAP_LEGACY = 7
|
396
|
+
VMWARE = 8
|
397
|
+
OPENVMS = 9
|
398
|
+
HPUX = 10
|
399
|
+
WINDOWS_SERVER = 11
|
400
|
+
end
|
401
|
+
|
402
|
+
##
|
403
|
+
# This class enumerates the various Chap operation modes.
|
404
|
+
class ChapOperationMode
|
405
|
+
INITIATOR = 1
|
406
|
+
TARGET = 2
|
407
|
+
end
|
408
|
+
|
409
|
+
##
|
410
|
+
# This class enumerates the various operations related to editing a Host.
|
411
|
+
class HostEditOperation
|
412
|
+
ADD = 1
|
413
|
+
REMOVE = 2
|
414
|
+
end
|
415
|
+
|
416
|
+
##
|
417
|
+
# This class enumerates the various actions that can be applied on a Task.
|
418
|
+
class TaskAction
|
419
|
+
CANCEL_TASK = 1
|
420
|
+
end
|
421
|
+
end
|
@@ -0,0 +1,72 @@
|
|
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 'util'
|
13
|
+
|
14
|
+
module Hpe3parSdk
|
15
|
+
class CPGManager
|
16
|
+
def initialize(http)
|
17
|
+
@http = http
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_cpgs
|
21
|
+
cpg_list=[]
|
22
|
+
cpg_members = @http.get('/cpgs')[1]['members']
|
23
|
+
cpg_members.each do |cpgmember|
|
24
|
+
cpg_list.push(CPG.new(cpgmember))
|
25
|
+
end
|
26
|
+
cpg_list
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_cpg(name)
|
30
|
+
if name.nil? || name.strip.empty?
|
31
|
+
raise 'CPG name cannot be nil or empty'
|
32
|
+
else
|
33
|
+
CPG.new(@http.get("/cpgs/#{name}")[1])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_cpg(name, optional = nil)
|
38
|
+
info = { 'name' => name }
|
39
|
+
|
40
|
+
info = Util.merge_hash(info, optional) if optional
|
41
|
+
cpgs_url = '/cpgs'
|
42
|
+
response = @http.post(cpgs_url, body: info)
|
43
|
+
response[1]
|
44
|
+
end
|
45
|
+
|
46
|
+
def modify_cpg(name, cpg_mods)
|
47
|
+
@http.put("/cpgs/#{name}", body: cpg_mods)[1]
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_cpg_available_space(name)
|
51
|
+
info = { 'cpg' => name }
|
52
|
+
|
53
|
+
response = @http.post('/spacereporter', body: info)
|
54
|
+
LDLayoutCapacity.new(response[1])
|
55
|
+
end
|
56
|
+
|
57
|
+
def delete_cpg(name)
|
58
|
+
response = @http.delete("/cpgs/#{name}")
|
59
|
+
response[1]
|
60
|
+
end
|
61
|
+
|
62
|
+
def cpg_exists?(name)
|
63
|
+
begin
|
64
|
+
get_cpg(name)
|
65
|
+
return true
|
66
|
+
rescue Hpe3parSdk::HTTPNotFound => ex
|
67
|
+
return false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|