vipruby 0.1.4 → 0.1.6.1
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/.gitignore +3 -0
- data/.yardoc/checksums +7 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/doc/Host.html +910 -0
- data/doc/Vipr.html +656 -0
- data/doc/ViprBase.html +928 -0
- data/doc/ViprHost.html +1952 -0
- data/doc/ViprStorageSystem.html +2695 -0
- data/doc/ViprVcenter.html +1540 -0
- data/doc/Vipruby.html +139 -0
- data/doc/Vipruby/Auth.html +745 -0
- data/doc/_index.html +135 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +121 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +121 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +333 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/.yardoc/checksums +0 -0
- data/lib/.yardoc/object_types +0 -0
- data/lib/.yardoc/objects/root.dat +0 -0
- data/lib/.yardoc/proxy_types +0 -0
- data/lib/vipruby.rb +6 -426
- data/lib/vipruby/.yardoc/checksums +0 -0
- data/lib/vipruby/.yardoc/object_types +0 -0
- data/lib/vipruby/.yardoc/objects/root.dat +0 -0
- data/lib/vipruby/.yardoc/proxy_types +0 -0
- data/lib/vipruby/objects/host.rb +234 -0
- data/lib/vipruby/objects/storagesystem.rb +278 -0
- data/lib/vipruby/objects/vcenter.rb +162 -0
- data/lib/vipruby/version.rb +6 -0
- data/lib/vipruby/vipr.rb +45 -0
- data/lib/vipruby/viprbase.rb +84 -0
- data/vipruby.gemspec +29 -0
- metadata +100 -9
@@ -0,0 +1,114 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!top-level-namespace.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Top Level Namespace</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Top Level Namespace
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Defined Under Namespace</h2>
|
85
|
+
<p class="children">
|
86
|
+
|
87
|
+
|
88
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="ViprBase.html" title="ViprBase (module)">ViprBase</a></span>, <span class='object_link'><a href="ViprHost.html" title="ViprHost (module)">ViprHost</a></span>, <span class='object_link'><a href="ViprStorageSystem.html" title="ViprStorageSystem (module)">ViprStorageSystem</a></span>, <span class='object_link'><a href="ViprVcenter.html" title="ViprVcenter (module)">ViprVcenter</a></span>, <span class='object_link'><a href="Vipruby.html" title="Vipruby (module)">Vipruby</a></span>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Vipr.html" title="Vipr (class)">Vipr</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
</p>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="footer">
|
108
|
+
Generated on Mon Dec 15 13:52:44 2014 by
|
109
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
110
|
+
0.8.7.6 (ruby-2.1.2).
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</body>
|
114
|
+
</html>
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
data/lib/vipruby.rb
CHANGED
@@ -1,428 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'json'
|
3
|
-
require 'nokogiri'
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
#SSL_VERSION = 'TLSv1'
|
8
|
-
|
9
|
-
def initialize(base_url,user_name,password,verify_cert)
|
10
|
-
@base_url = base_url
|
11
|
-
@verify_cert = to_boolean(verify_cert)
|
12
|
-
@auth_token = get_auth_token(user_name,password)
|
13
|
-
@tenant_uid = get_tenant_uid['id']
|
14
|
-
end
|
15
|
-
|
16
|
-
def get_tenant_uid
|
17
|
-
JSON.parse(RestClient::Request.execute(method: :get,
|
18
|
-
url: "#{@base_url}/tenant",
|
19
|
-
headers: {:'X-SDS-AUTH-TOKEN' => @auth_token,
|
20
|
-
accept: :json
|
21
|
-
},
|
22
|
-
verify_ssl: @verify_cert
|
23
|
-
))
|
24
|
-
end
|
25
|
-
|
26
|
-
def login(user_name,password)
|
27
|
-
RestClient::Request.execute(method: :get,
|
28
|
-
url: "#{@base_url}/login",
|
29
|
-
user: user_name,
|
30
|
-
password: password,
|
31
|
-
verify_ssl: @verify_cert
|
32
|
-
)
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_auth_token(user_name,password)
|
36
|
-
login(user_name,password).headers[:x_sds_auth_token]
|
37
|
-
end
|
38
|
-
|
39
|
-
def add_host(host)
|
40
|
-
JSON.parse(RestClient::Request.execute(method: :post,
|
41
|
-
url: "#{base_url}/tenants/#{@tenant_uid}/hosts",
|
42
|
-
verify_ssl: @verify_cert,
|
43
|
-
payload: host,
|
44
|
-
headers: {
|
45
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
46
|
-
content_type: 'application/json',
|
47
|
-
accept: :json
|
48
|
-
}))
|
49
|
-
end
|
50
|
-
|
51
|
-
def add_initiators(initiators,host_href)
|
52
|
-
initiators.each do |initiator|
|
53
|
-
RestClient::Request.execute(method: :post,
|
54
|
-
url: "#{@base_url}#{host_href}/initiators",
|
55
|
-
verify_ssl: @verify_cert,
|
56
|
-
payload: initiator,
|
57
|
-
headers: {
|
58
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
59
|
-
content_type: 'application/json',
|
60
|
-
accept: :json
|
61
|
-
})
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def get_all_hosts
|
66
|
-
JSON.parse(RestClient::Request.execute(method: :get,
|
67
|
-
url: "#{@base_url}/tenants/#{@tenant_uid}/hosts",
|
68
|
-
verify_ssl: @verify_cert,
|
69
|
-
headers: {
|
70
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
71
|
-
accept: :json
|
72
|
-
}))
|
73
|
-
end
|
74
|
-
|
75
|
-
def get_host(host_href)
|
76
|
-
JSON.parse(RestClient::Request.execute(method: :get,
|
77
|
-
url: "#{base_url}#{host_href}",
|
78
|
-
verify_ssl: @verify_cert,
|
79
|
-
headers: {
|
80
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
81
|
-
content_type: 'application/json',
|
82
|
-
accept: :json
|
83
|
-
}))
|
84
|
-
end
|
85
|
-
|
86
|
-
def deactivate_host(host_href)
|
87
|
-
JSON.parse(RestClient::Request.execute(method: :post,
|
88
|
-
url: "#{base_url}#{host_href}/deactivate",
|
89
|
-
verify_ssl: @verify_cert,
|
90
|
-
headers: {
|
91
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
92
|
-
content_type: 'application/json',
|
93
|
-
accept: :json
|
94
|
-
}))
|
95
|
-
end
|
3
|
+
require "vipruby/version"
|
4
|
+
require "vipruby/vipr"
|
96
5
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
def host_exists?(hostname)
|
102
|
-
find_host_object(hostname)['resource'].any?
|
103
|
-
end
|
104
|
-
|
105
|
-
def find_host_object(search_hash)
|
106
|
-
JSON.parse(RestClient::Request.execute(method: :get,
|
107
|
-
url: "#{@base_url}/compute/hosts/search?name=#{search_hash}",
|
108
|
-
verify_ssl: @verify_cert,
|
109
|
-
headers: {
|
110
|
-
:'X-SDS-AUTH-TOKEN' => @auth_token,
|
111
|
-
accept: :json
|
112
|
-
}))
|
113
|
-
end
|
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
|
-
|
392
|
-
def to_boolean(str)
|
393
|
-
str.to_s.downcase == "true"
|
394
|
-
end
|
395
|
-
|
396
|
-
private :login, :get_auth_token, :get_tenant_uid, :to_boolean
|
397
|
-
end
|
398
|
-
|
399
|
-
class Host
|
400
|
-
attr_accessor :fqdn, :ip_address, :type, :name, :discoverable, :initiators_port, :initiator_node, :protocol
|
401
|
-
|
402
|
-
def initialize params = {}
|
403
|
-
params.each { |key, value| send "#{key}=", value }
|
404
|
-
end
|
405
|
-
|
406
|
-
def generate_json
|
407
|
-
{
|
408
|
-
type: @type.capitalize,
|
409
|
-
name: @name,
|
410
|
-
host_name: @fqdn,
|
411
|
-
discoverable: @discoverable.downcase
|
412
|
-
}.to_json
|
413
|
-
end
|
414
|
-
|
415
|
-
def generate_initiators_json
|
416
|
-
initiator_json = []
|
417
|
-
@initiators_port.each do |initiator|
|
418
|
-
initiator_json <<
|
419
|
-
{
|
420
|
-
protocol: @protocol.upcase,
|
421
|
-
initiator_port: initiator,
|
422
|
-
initiator_node: @initiator_node
|
423
|
-
}.to_json
|
424
|
-
end
|
425
|
-
initiator_json
|
426
|
-
end
|
427
|
-
|
428
|
-
end
|
6
|
+
#module Vipruby
|
7
|
+
# Your code goes here...
|
8
|
+
#end
|