vipruby 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/lib/vipruby.rb +279 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad36a27377dcf8cf199499bcd8bc954c25375101
|
4
|
+
data.tar.gz: be83ef50311baff7c1086aeaaf83e50f6ef07e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 998706d85916b3b401b0cec8d9fd5519647514a3c5cfd72805bc6221fe4239e0e06d0e4c3592d4d0b6c5566b61add24be698cc2217888dd9dd4b58f22572bd10
|
7
|
+
data.tar.gz: 3af96a3ad93a7647f4f703498226d675a8e09ac4d0f05f1c0184f9cba7700968e0cbfa4c050fb1093e0505c16b98a8e4748921ee62d4f289f665c5c2e1138e95
|
data/lib/vipruby.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'json'
|
3
|
+
require 'nokogiri'
|
3
4
|
|
4
5
|
class Vipruby
|
5
6
|
attr_accessor :tenant_uid, :auth_token, :base_url, :verify_cert
|
@@ -92,7 +93,7 @@ class Vipruby
|
|
92
93
|
accept: :json
|
93
94
|
}))
|
94
95
|
end
|
95
|
-
|
96
|
+
|
96
97
|
def add_host_and_initiators(host)
|
97
98
|
add_initiators(host.generate_initiators_json,add_host(host.generate_json)['resource']['link']['href'])
|
98
99
|
end
|
@@ -111,6 +112,283 @@ class Vipruby
|
|
111
112
|
}))
|
112
113
|
end
|
113
114
|
|
115
|
+
def get_all_vcenters
|
116
|
+
JSON.parse(RestClient::Request.execute(method: :get,url: "#{@base_url}/compute/vcenters/bulk",
|
117
|
+
verify_ssl: @verify_cert,
|
118
|
+
headers: {
|
119
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
120
|
+
accept: :json
|
121
|
+
}))
|
122
|
+
end
|
123
|
+
|
124
|
+
def find_vcenter_object(vcenter_search_hash)
|
125
|
+
JSON.parse(RestClient::Request.execute(method: :get,
|
126
|
+
url: "#{@base_url}/compute/vcenters/search?name=#{vcenter_search_hash}",
|
127
|
+
verify_ssl: @verify_cert,
|
128
|
+
headers: {
|
129
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
130
|
+
accept: :json
|
131
|
+
}))
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_vcenter(fqdn_or_ip, name, port, user_name, password)
|
135
|
+
vcenterxml = Nokogiri::XML::Builder.new do |xml|
|
136
|
+
xml.vcenter_create {
|
137
|
+
xml.ip_address fqdn_or_ip
|
138
|
+
xml.name name
|
139
|
+
xml.port_number port
|
140
|
+
xml.user_name user_name
|
141
|
+
xml.password password
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
146
|
+
url: "#{base_url}/tenants/#{@tenant_uid}/vcenters",
|
147
|
+
verify_ssl: @verify_cert,
|
148
|
+
payload: vcenterxml.to_xml,
|
149
|
+
headers: {
|
150
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
151
|
+
content_type: 'application/xml',
|
152
|
+
accept: :json
|
153
|
+
}))
|
154
|
+
end
|
155
|
+
|
156
|
+
def delete_vcenter(vcenter_id)
|
157
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
158
|
+
url: "#{base_url}/compute/vcenters/#{vcenter_id}/deactivate",
|
159
|
+
verify_ssl: @verify_cert,
|
160
|
+
headers: {
|
161
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
162
|
+
content_type: 'application/json',
|
163
|
+
accept: :json
|
164
|
+
}))
|
165
|
+
end
|
166
|
+
|
167
|
+
# EMC VMAX and VNX for block storage system version support
|
168
|
+
# => For supported versions, see the EMC ViPR Support Matrix on the EMC Community Network (community.emc.com)
|
169
|
+
# The EMC SMI-S Provider (a component of EMC Solutions Enabler) is required to use VMAX storage or VNX block.
|
170
|
+
# The following information is required to verify & add the SMI-S provider storage systems to ViPR:
|
171
|
+
# => SMI-S Provider host address
|
172
|
+
# => SMI-S Provider credentials (default is admin/#1Password)
|
173
|
+
# => SMI-S Provider port (default is 5989)
|
174
|
+
def add_emc_block_storage(name, ip_address, port_number, user_name, password, use_ssl)
|
175
|
+
emc_block_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
176
|
+
xml.storage_provider_create {
|
177
|
+
xml.name name
|
178
|
+
xml.interface_type "smis"
|
179
|
+
xml.ip_address ip_address
|
180
|
+
xml.port_number port_number
|
181
|
+
xml.user_name user_name
|
182
|
+
xml.password password
|
183
|
+
xml.use_ssl use_ssl
|
184
|
+
}
|
185
|
+
end
|
186
|
+
|
187
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
188
|
+
url: "#{base_url}/vdc/storage-providers",
|
189
|
+
verify_ssl: @verify_cert,
|
190
|
+
payload: emc_block_storage_xml.to_xml,
|
191
|
+
headers: {
|
192
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
193
|
+
content_type: 'application/xml',
|
194
|
+
accept: :json
|
195
|
+
}))
|
196
|
+
end
|
197
|
+
|
198
|
+
# EMC VNX for File storage system support
|
199
|
+
# => Supported Protocol: NFS, CIFS (Snapshot restore is not supported for Isilon storage systems.)
|
200
|
+
# VNX File Control Station default port is 443
|
201
|
+
# VNX File Onboard Storage Provider default port is 5988
|
202
|
+
def add_emc_vnx_file_storage(name, ip_address, port_number, user_name, password, smis_provider_ip, smis_port_number, smis_user_name, smis_password, smis_use_ssl)
|
203
|
+
emc_vnx_file_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
204
|
+
xml.storage_system_create {
|
205
|
+
xml.name name
|
206
|
+
xml.system_type "vnxfile"
|
207
|
+
xml.ip_address ip_address
|
208
|
+
xml.port_number port_number
|
209
|
+
xml.user_name user_name
|
210
|
+
xml.password password
|
211
|
+
xml.smis_provider_ip smis_provider_ip
|
212
|
+
xml.smis_port_number smis_port_number
|
213
|
+
xml.smis_user_name smis_user_name
|
214
|
+
xml.smis_password smis_password
|
215
|
+
xml.smis_use_ssl smis_use_ssl
|
216
|
+
}
|
217
|
+
end
|
218
|
+
|
219
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
220
|
+
url: "#{base_url}/vdc/storage-systems",
|
221
|
+
verify_ssl: @verify_cert,
|
222
|
+
payload: emc_vnx_file_storage_xml.to_xml,
|
223
|
+
headers: {
|
224
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
225
|
+
content_type: 'application/xml',
|
226
|
+
accept: :json
|
227
|
+
}))
|
228
|
+
end
|
229
|
+
|
230
|
+
# Isilon Storage System Support
|
231
|
+
# => Supported Protocol: NFS, CIFS (Snapshot restore is not supported for Isilon storage systems.)
|
232
|
+
# Port (default is 8080)
|
233
|
+
def add_emc_isilon_storage(name, ip_address, port_number, user_name, password)
|
234
|
+
emc_isilon_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
235
|
+
xml.storage_system_create {
|
236
|
+
xml.name name
|
237
|
+
xml.system_type "isilon"
|
238
|
+
xml.ip_address ip_address
|
239
|
+
xml.port_number port_number
|
240
|
+
xml.user_name user_name
|
241
|
+
xml.password password
|
242
|
+
}
|
243
|
+
end
|
244
|
+
|
245
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
246
|
+
url: "#{base_url}/vdc/storage-systems",
|
247
|
+
verify_ssl: @verify_cert,
|
248
|
+
payload: emc_isilon_storage_xml.to_xml,
|
249
|
+
headers: {
|
250
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
251
|
+
content_type: 'application/xml',
|
252
|
+
accept: :json
|
253
|
+
}))
|
254
|
+
end
|
255
|
+
|
256
|
+
# ViPR configuration requirements for VPLEX storage systems
|
257
|
+
# ViPR supports VPLEX in a Local or Metro configuration. VPLEX Geo configurations are not supported.
|
258
|
+
def add_emc_vplex_storage(name, ip_address, port_number, user_name, password, use_ssl)
|
259
|
+
emc_vplex_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
260
|
+
xml.storage_provider_create {
|
261
|
+
xml.name name
|
262
|
+
xml.interface_type "vplex"
|
263
|
+
xml.ip_address ip_address
|
264
|
+
xml.port_number port_number
|
265
|
+
xml.user_name user_name
|
266
|
+
xml.password password
|
267
|
+
xml.use_ssl
|
268
|
+
}
|
269
|
+
end
|
270
|
+
|
271
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
272
|
+
url: "#{base_url}/vdc/storage-providers",
|
273
|
+
verify_ssl: @verify_cert,
|
274
|
+
payload: emc_vplex_storage_xml.to_xml,
|
275
|
+
headers: {
|
276
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
277
|
+
content_type: 'application/xml',
|
278
|
+
accept: :json
|
279
|
+
}))
|
280
|
+
end
|
281
|
+
|
282
|
+
# Stand-alone ScaleIO support and preconfiguration requirements
|
283
|
+
# Supported versions: ScaleIO 1.21.0.20 or later
|
284
|
+
# Preconfiguration requirements:
|
285
|
+
# => Protection domains are defined.
|
286
|
+
# => All storage pools are defined.
|
287
|
+
def add_emc_scaleio_storage(name, ip_address, port_number, user_name, password)
|
288
|
+
emc_scaleio_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
289
|
+
xml.storage_provider_create {
|
290
|
+
xml.name name
|
291
|
+
xml.interface_type "scaleio"
|
292
|
+
xml.ip_address ip_address
|
293
|
+
xml.port_number port_number
|
294
|
+
xml.user_name user_name
|
295
|
+
xml.password password
|
296
|
+
}
|
297
|
+
end
|
298
|
+
|
299
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
300
|
+
url: "#{base_url}/vdc/storage-providers",
|
301
|
+
verify_ssl: @verify_cert,
|
302
|
+
payload: emc_scaleio_storage_xml.to_xml,
|
303
|
+
headers: {
|
304
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
305
|
+
content_type: 'application/xml',
|
306
|
+
accept: :json
|
307
|
+
}))
|
308
|
+
end
|
309
|
+
|
310
|
+
# Third-party block storage provider installation requirements
|
311
|
+
# ViPR uses the OpenStack Block Storage (Cinder) Service to add third-party block storage systems to ViPR.
|
312
|
+
# For supported versions, see the EMC ViPR Support Matrix available on the EMC Community Network (community.emc.com).
|
313
|
+
def add_third_party_block_storage(name, ip_address, port_number, user_name, password, use_ssl)
|
314
|
+
third_party_block_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
315
|
+
xml.storage_provider_create {
|
316
|
+
xml.name name
|
317
|
+
xml.interface_type "cinder"
|
318
|
+
xml.ip_address ip_address
|
319
|
+
xml.port_number port_number
|
320
|
+
xml.user_name user_name
|
321
|
+
xml.password password
|
322
|
+
xml.use_ssl use_ssl
|
323
|
+
}
|
324
|
+
end
|
325
|
+
|
326
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
327
|
+
url: "#{base_url}/vdc/storage-providers",
|
328
|
+
verify_ssl: @verify_cert,
|
329
|
+
payload: third_party_block_storage_xml.to_xml,
|
330
|
+
headers: {
|
331
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
332
|
+
content_type: 'application/xml',
|
333
|
+
accept: :json
|
334
|
+
}))
|
335
|
+
end
|
336
|
+
|
337
|
+
# NetApp Storage System Support
|
338
|
+
# => Supported Protocol: NFS, CIFS
|
339
|
+
def add_netapp_storage(name, ip_address, port_number, user_name, password)
|
340
|
+
netapp_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
341
|
+
xml.storage_system_create {
|
342
|
+
xml.name name
|
343
|
+
xml.system_type "netapp"
|
344
|
+
xml.ip_address ip_address
|
345
|
+
xml.port_number port_number
|
346
|
+
xml.user_name user_name
|
347
|
+
xml.password password
|
348
|
+
}
|
349
|
+
end
|
350
|
+
|
351
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
352
|
+
url: "#{base_url}/vdc/storage-systems",
|
353
|
+
verify_ssl: @verify_cert,
|
354
|
+
payload: netapp_storage_xml.to_xml,
|
355
|
+
headers: {
|
356
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
357
|
+
content_type: 'application/xml',
|
358
|
+
accept: :json
|
359
|
+
}))
|
360
|
+
end
|
361
|
+
|
362
|
+
# Hitachi Data Systems support
|
363
|
+
# For supported versions, see the EMC ViPR Support Matrix on the EMC Community Network (community.emc.com).
|
364
|
+
# Hitachi HiCommand Device Manager is required to use HDS storage with ViPR.
|
365
|
+
# You need to obtain the following information to configure and add the Hitachi HiCommand Device manager to ViPR:
|
366
|
+
# => A host or virtual machine for HiCommand Device manager setup
|
367
|
+
# => HiCommand Device Manager license, host address, credentials, and host port (default is 2001)
|
368
|
+
def add_hitachi_storage(name, ip_address, port_number, user_name, password, use_ssl)
|
369
|
+
hitachi_storage_xml = Nokogiri::XML::Builder.new do |xml|
|
370
|
+
xml.storage_provider_create {
|
371
|
+
xml.name name
|
372
|
+
xml.interface_type "hicommand"
|
373
|
+
xml.ip_address ip_address
|
374
|
+
xml.port_number port_number
|
375
|
+
xml.user_name user_name
|
376
|
+
xml.password password
|
377
|
+
xml.use_ssl use_ssl
|
378
|
+
}
|
379
|
+
end
|
380
|
+
|
381
|
+
JSON.parse(RestClient::Request.execute(method: :post,
|
382
|
+
url: "#{base_url}/vdc/storage-providers",
|
383
|
+
verify_ssl: @verify_cert,
|
384
|
+
payload: hitachi_storage_xml.to_xml,
|
385
|
+
headers: {
|
386
|
+
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
387
|
+
content_type: 'application/xml',
|
388
|
+
accept: :json
|
389
|
+
}))
|
390
|
+
end
|
391
|
+
|
114
392
|
def to_boolean(str)
|
115
393
|
str.to_s.downcase == "true"
|
116
394
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vipruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig J Smith
|
8
|
+
- Kendrick Coleman
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: json
|
@@ -38,7 +39,22 @@ dependencies:
|
|
38
39
|
- - '='
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: 1.7.2
|
41
|
-
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: nokogiri
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.6.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.6.0
|
56
|
+
description: Currently limited to host and initiator add functions along with vCenter
|
57
|
+
and storage additions
|
42
58
|
email: nctiggy@gmail.com
|
43
59
|
executables: []
|
44
60
|
extensions: []
|