ibm_power_hmc 0.16.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28ceda6d2c9095912e1bcf9b7a24bcb0153bc34a5c437a41966be9036fffb858
4
- data.tar.gz: 94d8d1706954d560303e96f8c793fde5e9b0a181a7e2657a75d5f37fb5977fa3
3
+ metadata.gz: 4a067e3697998766bac04fad91eafee2e1563a5203c9bdcd9570cccea7b8cf3d
4
+ data.tar.gz: 0152c5e104b2fe95acb8a232e448708c3e44fd59cf2754a743da35a2856cc3a8
5
5
  SHA512:
6
- metadata.gz: c001400d781dbadea9f68df8dc4eb5266ac6c3e74a9d8035ed7c112b404ec7553c8b97eab297dd72ce22919b024d8eaa3cfb30bf133514df1eae266ce198252b
7
- data.tar.gz: 62dd1000797804b87a22528c711e777c07071d80df40621f6007d88e5b68ed90da6413888eee5e185379a15a9da522cfb0cbaa9c693640ccedecad23b2af9bd9
6
+ metadata.gz: dc1d8e450a39902ea9aaee7765b2bd8c8850a9d7dc99abca96ee320287852d0d3fb7738fd4820edd3827c00030e66edaada481aab2de9e3850a9d8b32c98e2c1
7
+ data.tar.gz: 01c46f3e296b808afccfcf37e4a3f259b51b807fc051929965e4f2d5eba0cd3f4e14e0432819c9626b36647128d0fb59e9a1e1b0b6c740e839662308991f3079
@@ -80,17 +80,32 @@ module IbmPowerHmc
80
80
  end
81
81
 
82
82
  ##
83
- # @!method managed_systems(search = nil)
83
+ # @!method managed_systems(search = nil, group_name = nil)
84
84
  # Retrieve the list of systems managed by the HMC.
85
85
  # @param search [String] The optional search criteria.
86
+ # @param group_name [String] The extended group attributes.
86
87
  # @return [Array<IbmPowerHmc::ManagedSystem>] The list of managed systems.
87
- def managed_systems(search = nil)
88
+ def managed_systems(search = nil, group_name = nil)
88
89
  method_url = "/rest/api/uom/ManagedSystem"
89
90
  method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
91
+ method_url += "?group=#{group_name}" unless group_name.nil?
90
92
  response = request(:get, method_url)
91
93
  FeedParser.new(response.body).objects(:ManagedSystem)
92
94
  end
93
95
 
96
+ ##
97
+ # @!method managed_system(sys_uuid, group_name = nil)
98
+ # Retrieve information about a managed system.
99
+ # @param sys_uuid [String] The UUID of the managed system.
100
+ # @param group_name [String] The extended group attributes.
101
+ # @return [IbmPowerHmc::ManagedSystem] The managed system.
102
+ def managed_system(sys_uuid, group_name = nil)
103
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}"
104
+ method_url += "?group=#{group_name}" unless group_name.nil?
105
+ response = request(:get, method_url)
106
+ Parser.new(response.body).object(:ManagedSystem)
107
+ end
108
+
94
109
  ##
95
110
  # @!method managed_systems_quick
96
111
  # Retrieve the list of systems managed by the HMC (using Quick API).
@@ -115,32 +130,20 @@ module IbmPowerHmc
115
130
  end
116
131
 
117
132
  ##
118
- # @!method managed_system(lpar_uuid, sys_uuid = nil, group_name = nil)
119
- # Retrieve information about a managed system.
120
- # @param sys_uuid [String] The UUID of the managed system.
121
- # @param group_name [String] The extended group attributes.
122
- # @return [IbmPowerHmc::ManagedSystem] The managed system.
123
- def managed_system(sys_uuid, group_name = nil)
124
- method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}"
125
- method_url += "?group=#{group_name}" unless group_name.nil?
126
-
127
- response = request(:get, method_url)
128
- Parser.new(response.body).object(:ManagedSystem)
129
- end
130
-
131
- ##
132
- # @!method lpars(sys_uuid = nil, search = nil)
133
+ # @!method lpars(sys_uuid = nil, search = nil, group_name = nil)
133
134
  # Retrieve the list of logical partitions managed by the HMC.
134
135
  # @param sys_uuid [String] The UUID of the managed system.
135
136
  # @param search [String] The optional search criteria.
137
+ # @param group_name [String] The extended group attributes.
136
138
  # @return [Array<IbmPowerHmc::LogicalPartition>] The list of logical partitions.
137
- def lpars(sys_uuid = nil, search = nil)
139
+ def lpars(sys_uuid = nil, search = nil, group_name = nil)
138
140
  if sys_uuid.nil?
139
141
  method_url = "/rest/api/uom/LogicalPartition"
140
142
  method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
141
143
  else
142
144
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/LogicalPartition"
143
145
  end
146
+ method_url += "?group=#{group_name}" unless group_name.nil?
144
147
  response = request(:get, method_url)
145
148
  FeedParser.new(response.body).objects(:LogicalPartition)
146
149
  end
@@ -159,11 +162,25 @@ module IbmPowerHmc
159
162
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/LogicalPartition/#{lpar_uuid}"
160
163
  end
161
164
  method_url += "?group=#{group_name}" unless group_name.nil?
162
-
163
165
  response = request(:get, method_url)
164
166
  Parser.new(response.body).object(:LogicalPartition)
165
167
  end
166
168
 
169
+ ##
170
+ # @!method lpars_quick(sys_uuid = nil)
171
+ # Retrieve the list of logical partitions managed by the HMC (using Quick API).
172
+ # @param sys_uuid [String] The UUID of the managed system.
173
+ # @return [Array<Hash>] The list of logical partitions.
174
+ def lpars_quick(sys_uuid = nil)
175
+ if sys_uuid.nil?
176
+ method_url = "/rest/api/uom/LogicalPartition/quick/All"
177
+ else
178
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/LogicalPartition/quick/All"
179
+ end
180
+ response = request(:get, method_url)
181
+ JSON.parse(response.body)
182
+ end
183
+
167
184
  ##
168
185
  # @!method lpar_quick_property(lpar_uuid, property_name)
169
186
  # Retrieve a quick property of a logical partition.
@@ -177,17 +194,6 @@ module IbmPowerHmc
177
194
  response.body[1..-2]
178
195
  end
179
196
 
180
- ##
181
- # @!method rename_lpar(lpar_uuid, new_name)
182
- # Rename a logical partition.
183
- # @param lpar_uuid [String] The UUID of the logical partition.
184
- # @param new_name [String] The new name of the logical partition.
185
- def rename_lpar(lpar_uuid, new_name)
186
- modify_object do
187
- lpar(lpar_uuid).tap { |lpar| lpar.name = new_name }
188
- end
189
- end
190
-
191
197
  ##
192
198
  # @!method lpar_migrate_validate(lpar_uuid, target_sys_name, sync = true)
193
199
  # Validate if a logical partition can be migrated to another managed system.
@@ -226,20 +232,25 @@ module IbmPowerHmc
226
232
  end
227
233
 
228
234
  ##
229
- # @!method vioses(sys_uuid = nil, search = nil, permissive = true)
235
+ # @!method vioses(sys_uuid = nil, search = nil, group_name = nil, permissive = true)
230
236
  # Retrieve the list of virtual I/O servers managed by the HMC.
231
237
  # @param sys_uuid [String] The UUID of the managed system.
232
238
  # @param search [String] The optional search criteria.
239
+ # @param group_name [String] The extended group attributes.
233
240
  # @param permissive [Boolean] Skip virtual I/O servers that have error conditions.
234
241
  # @return [Array<IbmPowerHmc::VirtualIOServer>] The list of virtual I/O servers.
235
- def vioses(sys_uuid = nil, search = nil, permissive = true)
242
+ def vioses(sys_uuid = nil, search = nil, group_name = nil, permissive = true)
236
243
  if sys_uuid.nil?
237
244
  method_url = "/rest/api/uom/VirtualIOServer"
238
245
  method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
239
246
  else
240
247
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer"
241
248
  end
242
- method_url += "?ignoreError=true" if permissive
249
+ query = {}
250
+ query["ignoreError"] = "true" if permissive
251
+ query["group"] = group_name unless group_name.nil?
252
+ method_url += "?" + query.map { |h| h.join("=") }.join("&") unless query.empty?
253
+
243
254
  response = request(:get, method_url)
244
255
  FeedParser.new(response.body).objects(:VirtualIOServer)
245
256
  end
@@ -258,11 +269,25 @@ module IbmPowerHmc
258
269
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer/#{vios_uuid}"
259
270
  end
260
271
  method_url += "?group=#{group_name}" unless group_name.nil?
261
-
262
272
  response = request(:get, method_url)
263
273
  Parser.new(response.body).object(:VirtualIOServer)
264
274
  end
265
275
 
276
+ ##
277
+ # @!method vioses_quick(sys_uuid = nil)
278
+ # Retrieve the list of virtual I/O servers managed by the HMC (using Quick API).
279
+ # @param sys_uuid [String] The UUID of the managed system.
280
+ # @return [Array<Hash>] The list of virtual I/O servers.
281
+ def vioses_quick(sys_uuid = nil)
282
+ if sys_uuid.nil?
283
+ method_url = "/rest/api/uom/VirtualIOServer/quick/All"
284
+ else
285
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer/quick/All"
286
+ end
287
+ response = request(:get, method_url)
288
+ JSON.parse(response.body)
289
+ end
290
+
266
291
  ##
267
292
  # @!method groups
268
293
  # Retrieve the list of groups defined on the HMC.
@@ -492,7 +517,7 @@ module IbmPowerHmc
492
517
  # @!method shared_processor_pool(sys_uuid, pool_uuid = nil)
493
518
  # Retrieve information about Shared Processor Pools.
494
519
  # @param sys_uuid [String] The UUID of the managed system.
495
- # @param pool_uuid [String] The UUID of the shared storage pool (return all pools if omitted)
520
+ # @param pool_uuid [String] The UUID of the shared processor pool (return all pools if omitted)
496
521
  # @return [Array<IbmPowerHmc::SharedProcessorPool>, IbmPowerHmc::SharedProcessorPool] The list of shared processor pools.
497
522
  def shared_processor_pool(sys_uuid, pool_uuid = nil)
498
523
  if pool_uuid.nil?
@@ -379,6 +379,11 @@ module IbmPowerHmc
379
379
  def io_adapters
380
380
  collection_of("PartitionIOConfiguration/ProfileIOSlots/ProfileIOSlot/AssociatedIOSlot/RelatedIOAdapter", "*[1]")
381
381
  end
382
+
383
+ def shared_processor_pool_uuid
384
+ href = singleton("ProcessorPool", "href")
385
+ uuid_from_href(href) unless href.nil?
386
+ end
382
387
  end
383
388
 
384
389
  # Logical Partition information
@@ -414,6 +419,14 @@ module IbmPowerHmc
414
419
  def vfc_mappings
415
420
  collection_of("VirtualFibreChannelMappings", "VirtualFibreChannelMapping")
416
421
  end
422
+
423
+ def seas
424
+ collection_of("SharedEthernetAdapters", "SharedEthernetAdapter")
425
+ end
426
+
427
+ def trunks
428
+ collection_of("TrunkAdapters", "TrunkAdapter")
429
+ end
417
430
  end
418
431
 
419
432
  # Group information
@@ -437,6 +450,53 @@ module IbmPowerHmc
437
450
  end
438
451
  end
439
452
 
453
+ # SEA information
454
+ class SharedEthernetAdapter < AbstractNonRest
455
+ ATTRS = {
456
+ :udid => "UniqueDeviceID",
457
+ :name => "DeviceName",
458
+ :state => "ConfigurationState",
459
+ :large_send => "LargeSend",
460
+ :vlan_id => "PortVLANID",
461
+ :ha_mode => "HighAvailabilityMode",
462
+ :qos_mode => "QualityOfServiceMode",
463
+ :jumbo => "JumboFramesEnabled",
464
+ :queue_size => "QueueSize",
465
+ :primary => "IsPrimary"
466
+ }.freeze
467
+
468
+ def iface
469
+ elem = xml.elements["IPInterface"]
470
+ IPInterface.new(elem) unless elem.nil?
471
+ end
472
+
473
+ def device
474
+ elem = xml.elements["BackingDeviceChoice/*[1]"]
475
+ begin
476
+ Module.const_get("IbmPowerHmc::#{elem.name}").new(elem) unless elem.nil?
477
+ rescue NameError
478
+ nil
479
+ end
480
+ end
481
+
482
+ def trunks
483
+ collection_of("TrunkAdapters", "TrunkAdapter")
484
+ end
485
+ end
486
+
487
+ # IP Interface information
488
+ class IPInterface < AbstractNonRest
489
+ ATTRS = {
490
+ :name => "InterfaceName",
491
+ :state => "State",
492
+ :hostname => "HostName",
493
+ :ip => "IPAddress",
494
+ :netmask => "SubnetMask",
495
+ :gateway => "Gateway",
496
+ :prefix => "IPV6Prefix",
497
+ }.freeze
498
+ end
499
+
440
500
  # Empty parent class to match K2 schema definition
441
501
  class VirtualSCSIStorage < AbstractNonRest; end
442
502
 
@@ -547,6 +607,7 @@ module IbmPowerHmc
547
607
  # Virtual Ethernet Adapter information
548
608
  class VirtualEthernetAdapter < VirtualIOAdapter
549
609
  ATTRS = ATTRS.merge({
610
+ :name => "DeviceName",
550
611
  :macaddr => "MACAddress",
551
612
  :vswitch_id => "VirtualSwitchID",
552
613
  :vlan_id => "PortVLANID",
@@ -565,9 +626,17 @@ module IbmPowerHmc
565
626
  end
566
627
  end
567
628
 
568
- # LP-HEA information
569
- class EthernetBackingDevice < IOAdapter; end
629
+ # Trunk Adapter information
630
+ class TrunkAdapter < VirtualEthernetAdapter; end
631
+
632
+ class EthernetBackingDevice < IOAdapter
633
+ def iface
634
+ elem = xml.elements["IPInterface"]
635
+ IPInterface.new(elem) unless elem.nil?
636
+ end
637
+ end
570
638
 
639
+ # LP-HEA information
571
640
  class HostEthernetAdapterLogicalPort < EthernetBackingDevice
572
641
  ATTRS = ATTRS.merge({
573
642
  :macaddr => "MACAddress",
@@ -933,6 +1002,10 @@ module IbmPowerHmc
933
1002
  def lpar_uuids
934
1003
  uuids_from_links("AssignedPartitions")
935
1004
  end
1005
+
1006
+ def sys_uuid
1007
+ uuid_from_href(href, -3)
1008
+ end
936
1009
  end
937
1010
 
938
1011
  class PartitionTemplateSummary < AbstractRest
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.16.1"
4
+ VERSION = "0.18.0"
5
5
  end
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.16.1
4
+ version: 0.18.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: 2022-10-10 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client