ibm_power_hmc 0.16.0 → 0.17.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: faeaaee474f96b0beb9747a2d346110a1321e9060b2b196770598f1bccfd85a8
4
- data.tar.gz: 3af51fcdb06f722a95e44bcea28f8ed4f4fef9cdfd9e1332063c3bf288a00c61
3
+ metadata.gz: b656be196e11b14214f13c50871c1f9a892d6346db7729e2ce0f1cc4f976c5be
4
+ data.tar.gz: 24f50dbe1015ac99524604cece6275cd5fd9c79f0236acb2e8a01de0bcd6bd71
5
5
  SHA512:
6
- metadata.gz: 1756c8a220a30ba88da0cd0d518a681657f9d08a231c11715e461d0fe5be1c171b17e98bb290fd29f9cdb551da48cdfc699707147abded7cfa204dcde26067be
7
- data.tar.gz: 8906b25b90865262000331f4c371b546cac852eeb14714e8c75b0e7ae937422d441a1c920687d4e8913dad088a9eadbbbb7a5d740fceccd57f9733e9112ce2bc
6
+ metadata.gz: deb0194fb5f3df5bbcc69182f30f29956f11a66cf2a91740dec214d63fce5b16383626ef600f3478084616b23ee1a557620ce45cc05ff7adbdb0364719d2a371
7
+ data.tar.gz: 6c19000f0cf64c5413552d60a304e51005b688403e4171367ed3d7d5384a9315a819225e9a5255b51735ddf69f0e38c040888cacbd1ec1688b67f1c594a361e6
@@ -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 = nil, 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.
@@ -226,20 +243,25 @@ module IbmPowerHmc
226
243
  end
227
244
 
228
245
  ##
229
- # @!method vioses(sys_uuid = nil, search = nil, permissive = true)
246
+ # @!method vioses(sys_uuid = nil, search = nil, group_name = nil, permissive = true)
230
247
  # Retrieve the list of virtual I/O servers managed by the HMC.
231
248
  # @param sys_uuid [String] The UUID of the managed system.
232
249
  # @param search [String] The optional search criteria.
250
+ # @param group_name [String] The extended group attributes.
233
251
  # @param permissive [Boolean] Skip virtual I/O servers that have error conditions.
234
252
  # @return [Array<IbmPowerHmc::VirtualIOServer>] The list of virtual I/O servers.
235
- def vioses(sys_uuid = nil, search = nil, permissive = true)
253
+ def vioses(sys_uuid = nil, search = nil, group_name = nil, permissive = true)
236
254
  if sys_uuid.nil?
237
255
  method_url = "/rest/api/uom/VirtualIOServer"
238
256
  method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
239
257
  else
240
258
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer"
241
259
  end
242
- method_url += "?ignoreError=true" if permissive
260
+ query = {}
261
+ query["ignoreError"] = "true" if permissive
262
+ query["group"] = group_name unless group_name.nil?
263
+ method_url += "?" + query.map { |h| h.join("=") }.join("&") unless query.empty?
264
+
243
265
  response = request(:get, method_url)
244
266
  FeedParser.new(response.body).objects(:VirtualIOServer)
245
267
  end
@@ -258,11 +280,25 @@ module IbmPowerHmc
258
280
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer/#{vios_uuid}"
259
281
  end
260
282
  method_url += "?group=#{group_name}" unless group_name.nil?
261
-
262
283
  response = request(:get, method_url)
263
284
  Parser.new(response.body).object(:VirtualIOServer)
264
285
  end
265
286
 
287
+ ##
288
+ # @!method vioses_quick(sys_uuid = nil)
289
+ # Retrieve the list of virtual I/O servers managed by the HMC (using Quick API).
290
+ # @param sys_uuid [String] The UUID of the managed system.
291
+ # @return [Array<Hash>] The list of virtual I/O servers.
292
+ def vioses_quick(sys_uuid = nil)
293
+ if sys_uuid.nil?
294
+ method_url = "/rest/api/uom/VirtualIOServer/quick/All"
295
+ else
296
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer/quick/All"
297
+ end
298
+ response = request(:get, method_url)
299
+ JSON.parse(response.body)
300
+ end
301
+
266
302
  ##
267
303
  # @!method groups
268
304
  # Retrieve the list of groups defined on the HMC.
@@ -791,20 +827,21 @@ module IbmPowerHmc
791
827
  end
792
828
 
793
829
  ##
794
- # @!method next_events(timeout = -1)
830
+ # @!method next_events(wait = true)
795
831
  # Retrieve a list of events that occured since last call.
796
- # @param timeout [Integer] The number of seconds to wait if no event is available.
797
- # Specify -1 to wait indefinitely.
832
+ # @param wait [Boolean] If no event is available, block until new events occur.
798
833
  # @return [Array<IbmPowerHmc::Event>] The list of events.
799
- def next_events(timeout = -1)
834
+ def next_events(wait = true)
800
835
  method_url = "/rest/api/uom/Event"
801
- method_url += "?timeout=#{timeout}" if timeout >= 0
802
836
 
803
837
  response = nil
804
838
  loop do
805
839
  response = request(:get, method_url)
806
- # The HMC waits "timeout" seconds (10 if not specified) before returning 204.
807
- break if response.code != 204 || timeout >= 0
840
+ # The HMC waits 10 seconds before returning 204 if there is no event.
841
+ # There is a hidden "?timeout=X" option but it does not always work.
842
+ # It will return "REST026C Maximum number of event requests exceeded"
843
+ # after a while.
844
+ break if response.code != 204 || !wait
808
845
  end
809
846
  FeedParser.new(response.body).objects(:Event).map do |e|
810
847
  data = e.data.split("/") unless e.data.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
@@ -933,6 +938,10 @@ module IbmPowerHmc
933
938
  def lpar_uuids
934
939
  uuids_from_links("AssignedPartitions")
935
940
  end
941
+
942
+ def sys_uuid
943
+ uuid_from_href(href, -3)
944
+ end
936
945
  end
937
946
 
938
947
  class PartitionTemplateSummary < AbstractRest
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.16.0"
4
+ VERSION = "0.17.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.0
4
+ version: 0.17.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-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client