ibm_power_hmc 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ibm_power_hmc/connection.rb +57 -0
- data/lib/ibm_power_hmc/parser.rb +48 -26
- data/lib/ibm_power_hmc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 288ed57579492fd505491fe8e56f9dbd371cb6aaae118f98c14202fd20e8bf85
|
4
|
+
data.tar.gz: b21286ee62bfa69e14d609ad001b72f012ccbe3fdebc59f090320d03877e6d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d5010709dd4a423ca131c99d3891ef78c4de8a479e87afe402eb554db660f03f2d85b24728d22773ff1681263f4346ff303e08078c4e9b91519e5ad6398a40a
|
7
|
+
data.tar.gz: fd6e00f6bb1039b0320d7fb7959f6a3a2206047fe6ebcb1cc795a6f0f37e92e8740cbe8d980d4fa496bfa6c00d3de6efeafba6f4136b7974630b5d187e4bbc7d
|
@@ -262,6 +262,44 @@ module IbmPowerHmc
|
|
262
262
|
network_adapter("VirtualIOServer", vios_uuid, netadap_uuid)
|
263
263
|
end
|
264
264
|
|
265
|
+
##
|
266
|
+
# @!method sriov_elp_lpar(lpar_uuid, sriov_elp_uuid = nil)
|
267
|
+
# Retrieve one or all SR-IOV ethernet logical ports attached to a logical partition.
|
268
|
+
# @param lpar_uuid [String] UUID of the logical partition.
|
269
|
+
# @param netadap_uuid [String] UUID of the port to match (returns all ports if omitted).
|
270
|
+
# @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of ports.
|
271
|
+
def sriov_elp_lpar(lpar_uuid, sriov_elp_uuid = nil)
|
272
|
+
sriov_ethernet_port("LogicalPartition", lpar_uuid, sriov_elp_uuid)
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# @!method network_adapter_vios(vios_uuid, netadap_uuid = nil)
|
277
|
+
# Retrieve one or all SR-IOV ethernet logical ports attached to a Virtual I/O Server.
|
278
|
+
# @param vios_uuid [String] UUID of the Virtual I/O Server.
|
279
|
+
# @param netadap_uuid [String] UUID of the port to match (returns all ports if omitted).
|
280
|
+
# @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of ports.
|
281
|
+
def sriov_elp_vios(vios_uuid, sriov_elp_uuid = nil)
|
282
|
+
sriov_ethernet_port("VirtualIOServer", vios_uuid, sriov_elp_uuid)
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# @!method vnic_dedicated(lpar_uuid, vnic_uuid = nil)
|
287
|
+
# Retrieve one or all dedicated virtual network interface controller (vNIC) attached to a logical partition.
|
288
|
+
# @param lpar_uuid [String] UUID of the logical partition.
|
289
|
+
# @param netadap_uuid [String] UUID of the vNIC to match (returns all vNICs if omitted).
|
290
|
+
# @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of vNICs.
|
291
|
+
def vnic_dedicated(lpar_uuid, vnic_uuid = nil)
|
292
|
+
if vnic_uuid.nil?
|
293
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualNICDedicated"
|
294
|
+
response = request(:get, method_url)
|
295
|
+
FeedParser.new(response.body).objects(:VirtualNICDedicated)
|
296
|
+
else
|
297
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualNICDedicated/#{vnic_uuid}"
|
298
|
+
response = request(:get, method_url)
|
299
|
+
Parser.new(response.body).object(:VirtualNICDedicated)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
265
303
|
##
|
266
304
|
# @!method poweron_lpar(lpar_uuid, params = {}, sync = true)
|
267
305
|
# Power on a logical partition.
|
@@ -518,5 +556,24 @@ module IbmPowerHmc
|
|
518
556
|
Parser.new(response.body).object(:ClientNetworkAdapter)
|
519
557
|
end
|
520
558
|
end
|
559
|
+
|
560
|
+
##
|
561
|
+
# @!method sriov_ethernet_port(vm_type, lpar_uuid, sriov_elp_uuid)
|
562
|
+
# Retrieve one or all SR-IOV Ethernet loical ports attached to a Logical Partition or a Virtual I/O Server.
|
563
|
+
# @param vm_type [String] "LogicalPartition" or "VirtualIOServer".
|
564
|
+
# @param lpar_uuid [String] UUID of the Logical Partition or the Virtual I/O Server.
|
565
|
+
# @param netadap_uuid [String] UUID of the port to match (returns all ports if nil).
|
566
|
+
# @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of ports.
|
567
|
+
def sriov_ethernet_port(vm_type, lpar_uuid, sriov_elp_uuid)
|
568
|
+
if sriov_elp_uuid.nil?
|
569
|
+
method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/SRIOVEthernetLogicalPort"
|
570
|
+
response = request(:get, method_url)
|
571
|
+
FeedParser.new(response.body).objects(:SRIOVEthernetLogicalPort)
|
572
|
+
else
|
573
|
+
method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/SRIOVEthernetLogicalPort/#{sriov_elp_uuid}"
|
574
|
+
response = request(:get, method_url)
|
575
|
+
Parser.new(response.body).object(:SRIOVEthernetLogicalPort)
|
576
|
+
end
|
577
|
+
end
|
521
578
|
end
|
522
579
|
end
|
data/lib/ibm_power_hmc/parser.rb
CHANGED
@@ -116,8 +116,14 @@ module IbmPowerHmc
|
|
116
116
|
attr.nil? ? elem.text&.strip : elem.attributes[attr]
|
117
117
|
end
|
118
118
|
|
119
|
-
def extract_uuid_from_href(href)
|
120
|
-
URI(href).path.split('/')
|
119
|
+
def extract_uuid_from_href(href, index = -1)
|
120
|
+
URI(href).path.split('/')[index]
|
121
|
+
end
|
122
|
+
|
123
|
+
def uuids_from_links(elem, index = -1)
|
124
|
+
xml.get_elements("#{elem}/link[@href]").map do |link|
|
125
|
+
extract_uuid_from_href(link.attributes["href"], index)
|
126
|
+
end.compact
|
121
127
|
end
|
122
128
|
end
|
123
129
|
|
@@ -165,9 +171,7 @@ module IbmPowerHmc
|
|
165
171
|
}.freeze
|
166
172
|
|
167
173
|
def managed_systems_uuids
|
168
|
-
|
169
|
-
extract_uuid_from_href(link.attributes["href"])
|
170
|
-
end.compact
|
174
|
+
uuids_from_links("ManagedSystems")
|
171
175
|
end
|
172
176
|
end
|
173
177
|
|
@@ -189,15 +193,19 @@ module IbmPowerHmc
|
|
189
193
|
}.freeze
|
190
194
|
|
191
195
|
def lpars_uuids
|
192
|
-
|
193
|
-
extract_uuid_from_href(link.attributes["href"])
|
194
|
-
end.compact
|
196
|
+
uuids_from_links("AssociatedLogicalPartitions")
|
195
197
|
end
|
196
198
|
|
197
199
|
def vioses_uuids
|
198
|
-
|
199
|
-
|
200
|
-
|
200
|
+
uuids_from_links("AssociatedVirtualIOServers")
|
201
|
+
end
|
202
|
+
|
203
|
+
def vswitches_uuids
|
204
|
+
uuids_from_links("AssociatedSystemIOConfiguration/AssociatedSystemVirtualNetwork/VirtualSwitches")
|
205
|
+
end
|
206
|
+
|
207
|
+
def networks_uuids
|
208
|
+
uuids_from_links("AssociatedSystemIOConfiguration/AssociatedSystemVirtualNetwork/VirtualNetworks")
|
201
209
|
end
|
202
210
|
end
|
203
211
|
|
@@ -225,9 +233,11 @@ module IbmPowerHmc
|
|
225
233
|
end
|
226
234
|
|
227
235
|
def net_adap_uuids
|
228
|
-
|
229
|
-
|
230
|
-
|
236
|
+
uuids_from_links("ClientNetworkAdapters")
|
237
|
+
end
|
238
|
+
|
239
|
+
def sriov_elp_uuids
|
240
|
+
uuids_from_links("SRIOVEthernetLogicalPorts")
|
231
241
|
end
|
232
242
|
|
233
243
|
def name=(name)
|
@@ -238,6 +248,9 @@ module IbmPowerHmc
|
|
238
248
|
|
239
249
|
# Logical Partition information
|
240
250
|
class LogicalPartition < BasePartition
|
251
|
+
def vnic_dedicated_uuids
|
252
|
+
uuids_from_links("DedicatedVirtualNICs")
|
253
|
+
end
|
241
254
|
end
|
242
255
|
|
243
256
|
# VIOS information
|
@@ -257,9 +270,7 @@ module IbmPowerHmc
|
|
257
270
|
end
|
258
271
|
|
259
272
|
def networks_uuids
|
260
|
-
|
261
|
-
extract_uuid_from_href(link.attributes["href"])
|
262
|
-
end.compact
|
273
|
+
uuids_from_links("VirtualNetworks")
|
263
274
|
end
|
264
275
|
end
|
265
276
|
|
@@ -278,9 +289,7 @@ module IbmPowerHmc
|
|
278
289
|
end
|
279
290
|
|
280
291
|
def lpars_uuids
|
281
|
-
|
282
|
-
extract_uuid_from_href(link.attributes["href"])
|
283
|
-
end.compact
|
292
|
+
uuids_from_links("ConnectedPartitions")
|
284
293
|
end
|
285
294
|
end
|
286
295
|
|
@@ -299,24 +308,37 @@ module IbmPowerHmc
|
|
299
308
|
ATTRS = ATTRS.merge({
|
300
309
|
:macaddr => "MACAddress",
|
301
310
|
:vswitch_id => "VirtualSwitchID",
|
302
|
-
:vlan_id => "PortVLANID"
|
311
|
+
:vlan_id => "PortVLANID",
|
312
|
+
:location => "LocationCode"
|
303
313
|
}.freeze)
|
304
314
|
|
305
315
|
def vswitch_uuid
|
306
|
-
|
307
|
-
extract_uuid_from_href(href)
|
316
|
+
uuids_from_links("AssociatedVirtualSwitch").first
|
308
317
|
end
|
309
318
|
end
|
310
319
|
|
311
320
|
# Client Network Adapter information
|
312
321
|
class ClientNetworkAdapter < VirtualEthernetAdapter
|
313
322
|
def networks_uuids
|
314
|
-
|
315
|
-
extract_uuid_from_href(link.attributes["href"])
|
316
|
-
end.compact
|
323
|
+
uuids_from_links("VirtualNetworks")
|
317
324
|
end
|
318
325
|
end
|
319
326
|
|
327
|
+
class SRIOVEthernetLogicalPort < AbstractRest
|
328
|
+
ATTRS = {
|
329
|
+
:macaddr => "MACAddress",
|
330
|
+
:location => "LocationCode"
|
331
|
+
}.freeze
|
332
|
+
end
|
333
|
+
|
334
|
+
class VirtualNICDedicated < AbstractRest
|
335
|
+
ATTRS = {
|
336
|
+
:macaddr => "Details/MACAddress",
|
337
|
+
:slot => "VirtualSlotNumber",
|
338
|
+
:location => "DynamicReconfigurationConnectorName"
|
339
|
+
}.freeze
|
340
|
+
end
|
341
|
+
|
320
342
|
# HMC Event
|
321
343
|
class Event < AbstractRest
|
322
344
|
ATTRS = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_power_hmc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IBM Power
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|