ibm_power_hmc 0.3.0 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e42aa4d6eaa8915b8c37ce96aab995801533b81d8fa70b1e351bc550cc6eaa02
4
- data.tar.gz: 6022fb088c67eeb0c20e8435c20567ef62fb34e365419cfa20f6fb9bc1e769f5
3
+ metadata.gz: 128d1d4297c8885e438de247ccf25a143c856a3cdff5e2894f49c0541b475a6e
4
+ data.tar.gz: ee5304a78bf10231755750641b3ea5fc11064bea52753db4c8c42456461bbd3f
5
5
  SHA512:
6
- metadata.gz: 7ca0280aaeff1a1a0ce0cf5c53c40b6f0ddfc94725536e53d19031b1b107de4c8b44919580eaf1716e60f302bf339363508597b9188634412511bcc7869e4f83
7
- data.tar.gz: b0251d621a729e2b7d97c7655709fd68bd1e796466967f2021924ab7658a12c2dc13c34dfe71597f96f6ed2114e24c405362232c4dab2e88b653afbe2b7d679a
6
+ metadata.gz: 7924966345897965a3789b26ef307ae3df5e5dccbdf316e0d59ed665d57a2ceaaf51128f225cd08a2544b6c77d54ae634b5f75d25bfa766c3672480f01fc72da
7
+ data.tar.gz: '078600454867693aaf410ca0a898eb5464f24b4dd40db56c61caa5145fbc54685f0819f576862f6065649f4a2d46dab2d5f838938b207fc376e563cfc724c56f'
data/.gitignore CHANGED
File without changes
data/.rubocop.yml CHANGED
File without changes
data/.rubocop_local.yml CHANGED
@@ -5,3 +5,5 @@ Layout/HashAlignment:
5
5
  Enabled: false
6
6
  Style/ConditionalAssignment:
7
7
  Enabled: false
8
+ Style/OptionalBooleanParameter:
9
+ Enabled: false
data/CHANGELOG.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -52,9 +52,9 @@ Listing the logical partitions and virtual I/O servers of each managed system:
52
52
 
53
53
  ```ruby
54
54
  hc.managed_systems.each do |sys|
55
- puts sys
56
- puts hc.lpars(sys.uuid)
57
- puts hc.vioses(sys.uuid)
55
+ puts sys.name
56
+ hc.lpars(sys.uuid).each { |lpar| puts lpar.name }
57
+ hc.vioses(sys.uuid).each { |vios| puts vios.name }
58
58
  end
59
59
  ```
60
60
 
@@ -73,9 +73,9 @@ hc.poweroff_lpar(lpar_uuid, { "operation" => "shutdown" })
73
73
  Processing events:
74
74
 
75
75
  ```ruby
76
- loop
76
+ loop do
77
77
  hc.next_events.each do |event|
78
- puts event
78
+ puts event.type
79
79
  end
80
80
  end
81
81
  ```
data/Rakefile CHANGED
File without changes
File without changes
@@ -8,15 +8,15 @@ module IbmPowerHmc
8
8
  # HMC REST Client connection.
9
9
  class Connection
10
10
  ##
11
- # @!method initialize(host:, username: "hscroot", password:, port: 12_443, validate_ssl: true)
11
+ # @!method initialize(host:, password:, username: "hscroot", port: 12_443, validate_ssl: true)
12
12
  # Create a new HMC connection.
13
13
  #
14
14
  # @param host [String] Hostname of the HMC.
15
- # @param username [String] User name.
16
15
  # @param password [String] Password.
16
+ # @param username [String] User name.
17
17
  # @param port [Integer] TCP port number.
18
18
  # @param validate_ssl [Boolean] Verify SSL certificates.
19
- def initialize(host:, username: "hscroot", password:, port: 12_443, validate_ssl: true)
19
+ def initialize(host:, password:, username: "hscroot", port: 12_443, validate_ssl: true)
20
20
  @hostname = "#{host}:#{port}"
21
21
  @username = username
22
22
  @password = password
@@ -151,18 +151,13 @@ module IbmPowerHmc
151
151
  end
152
152
 
153
153
  ##
154
- # @!method rename_lpar(lpar_uuid, newname)
154
+ # @!method rename_lpar(lpar_uuid, new_name)
155
155
  # Rename a logical partition.
156
156
  # @param lpar_uuid [String] The UUID of the logical partition.
157
- # @param newname [String] The new name of the logical partition.
158
- def rename_lpar(lpar_uuid, newname)
157
+ # @param new_name [String] The new name of the logical partition.
158
+ def rename_lpar(lpar_uuid, new_name)
159
159
  method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}"
160
- headers = {
161
- :content_type => "application/vnd.ibm.powervm.uom+xml; type=LogicalPartition",
162
- }
163
- modify_object(method_url, headers) do |lpar|
164
- lpar.xml.elements["PartitionName"].text = newname
165
- end
160
+ modify_object(method_url) { |lpar| lpar.name = new_name }
166
161
  end
167
162
 
168
163
  ##
@@ -201,6 +196,227 @@ module IbmPowerHmc
201
196
  Parser.new(response.body).object(:VirtualIOServer)
202
197
  end
203
198
 
199
+ ##
200
+ # @!method virtual_switches(sys_uuid)
201
+ # Retrieve the list of virtual switches from a specified managed system.
202
+ # @param sys_uuid [String] The UUID of the managed system.
203
+ # @return [Array<IbmPowerHmc::VirtualSwitch>] The list of virtual switches.
204
+ def virtual_switches(sys_uuid)
205
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualSwitch"
206
+ response = request(:get, method_url)
207
+ FeedParser.new(response.body).objects(:VirtualSwitch)
208
+ end
209
+
210
+ ##
211
+ # @!method virtual_switch(vswitch_uuid, sys_uuid)
212
+ # Retrieve information about a virtual switch.
213
+ # @param vswitch_uuid [String] The UUID of the virtual switch.
214
+ # @param sys_uuid [String] The UUID of the managed system.
215
+ # @return [IbmPowerHmc::VirtualSwitch] The virtual switch.
216
+ def virtual_switch(vswitch_uuid, sys_uuid)
217
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualSwitch/#{vswitch_uuid}"
218
+ response = request(:get, method_url)
219
+ Parser.new(response.body).object(:VirtualSwitch)
220
+ end
221
+
222
+ ##
223
+ # @!method virtual_networks(sys_uuid)
224
+ # Retrieve the list of virtual networks from a specified managed system.
225
+ # @param sys_uuid [String] The UUID of the managed system.
226
+ # @return [Array<IbmPowerHmc::VirtualNetwork>] The list of virtual networks.
227
+ def virtual_networks(sys_uuid)
228
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualNetwork"
229
+ response = request(:get, method_url)
230
+ FeedParser.new(response.body).objects(:VirtualNetwork)
231
+ end
232
+
233
+ ##
234
+ # @!method virtual_network(vnet_uuid, sys_uuid)
235
+ # Retrieve information about a virtual network.
236
+ # @param vnet_uuid [String] The UUID of the virtual network.
237
+ # @param sys_uuid [String] The UUID of the managed system.
238
+ # @return [IbmPowerHmc::VirtualNetwork] The virtual network.
239
+ def virtual_network(vnet_uuid, sys_uuid)
240
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualNetwork/#{vnet_uuid}"
241
+ response = request(:get, method_url)
242
+ Parser.new(response.body).object(:VirtualNetwork)
243
+ end
244
+
245
+ ##
246
+ # @!method network_adapter_lpar(lpar_uuid, netadap_uuid = nil)
247
+ # Retrieve one or all virtual ethernet network adapters attached to a logical partition.
248
+ # @param lpar_uuid [String] UUID of the logical partition.
249
+ # @param netadap_uuid [String] UUID of the adapter to match (returns all adapters if omitted).
250
+ # @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of network adapters.
251
+ def network_adapter_lpar(lpar_uuid, netadap_uuid = nil)
252
+ network_adapter("LogicalPartition", lpar_uuid, netadap_uuid)
253
+ end
254
+
255
+ ##
256
+ # @!method network_adapter_vios(vios_uuid, netadap_uuid = nil)
257
+ # Retrieve one or all virtual ethernet network adapters attached to a Virtual I/O Server.
258
+ # @param vios_uuid [String] UUID of the Virtual I/O Server.
259
+ # @param netadap_uuid [String] UUID of the adapter to match (returns all adapters if omitted).
260
+ # @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of network adapters.
261
+ def network_adapter_vios(vios_uuid, netadap_uuid = nil)
262
+ network_adapter("VirtualIOServer", vios_uuid, netadap_uuid)
263
+ end
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 sriov_elp_uuid [String] UUID of the port to match (returns all ports if omitted).
270
+ # @return [Array<IbmPowerHmc::SRIOVEthernetLogicalPort>, IbmPowerHmc::SRIOVEthernetLogicalPort] 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, sriov_elp_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 sriov_elp_uuid [String] UUID of the port to match (returns all ports if omitted).
280
+ # @return [Array<IbmPowerHmc::SRIOVEthernetLogicalPort>, IbmPowerHmc::SRIOVEthernetLogicalPort] 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 vnic_uuid [String] UUID of the vNIC to match (returns all vNICs if omitted).
290
+ # @return [Array<IbmPowerHmc::VirtualNICDedicated>, IbmPowerHmc::VirtualNICDedicated] 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
+
303
+ ##
304
+ # @!method clusters
305
+ # Retrieve the list of clusters managed by the HMC.
306
+ # @return [Array<IbmPowerHmc::Cluster>] The list of clusters.
307
+ def clusters
308
+ method_url = "/rest/api/uom/Cluster"
309
+ response = request(:get, method_url)
310
+ FeedParser.new(response.body).objects(:Cluster)
311
+ end
312
+
313
+ ##
314
+ # @!method cluster(cl_uuid)
315
+ # Retrieve information about a cluster.
316
+ # @param cl_uuid [String] The UUID of the cluster.
317
+ # @return [IbmPowerHmc::Cluster] The cluster.
318
+ def cluster(cl_uuid)
319
+ method_url = "/rest/api/uom/Cluster/#{cl_uuid}"
320
+ response = request(:get, method_url)
321
+ Parser.new(response.body).object(:Cluster)
322
+ end
323
+
324
+ ##
325
+ # @!method ssps
326
+ # Retrieve the list of shared storage pools managed by the HMC.
327
+ # @return [Array<IbmPowerHmc::SharedStoragePool>] The list of shared storage pools.
328
+ def ssps
329
+ method_url = "/rest/api/uom/SharedStoragePool"
330
+ response = request(:get, method_url)
331
+ FeedParser.new(response.body).objects(:SharedStoragePool)
332
+ end
333
+
334
+ ##
335
+ # @!method ssp(ssp_uuid)
336
+ # Retrieve information about a shared storage pool.
337
+ # @param ssp_uuid [String] The UUID of the shared storage pool.
338
+ # @return [IbmPowerHmc::SharedStoragePool] The shared storage pool.
339
+ def ssp(ssp_uuid)
340
+ method_url = "/rest/api/uom/SharedStoragePool/#{ssp_uuid}"
341
+ response = request(:get, method_url)
342
+ Parser.new(response.body).object(:SharedStoragePool)
343
+ end
344
+
345
+ ##
346
+ # @!method tiers(group_name = nil)
347
+ # Retrieve the list of tiers that are part of shared storage pools managed by the HMC.
348
+ # @param group_name [String] The extended group attributes.
349
+ # @return [Array<IbmPowerHmc::Tier>] The list of tiers.
350
+ def tiers(group_name = nil)
351
+ method_url = "/rest/api/uom/Tier"
352
+ method_url += "?group=#{group_name}" unless group_name.nil?
353
+ response = request(:get, method_url)
354
+ FeedParser.new(response.body).objects(:Tier)
355
+ end
356
+
357
+ ##
358
+ # @!method tier(tier_uuid, ssp_uuid = nil, group_name = nil)
359
+ # Retrieve information about a tier.
360
+ # @param tier_uuid [String] The UUID of the tier.
361
+ # @param ssp_uuid [String] The UUID of the shared storage pool.
362
+ # @param group_name [String] The extended group attributes.
363
+ # @return [IbmPowerHmc::Tier] The tier.
364
+ def tier(tier_uuid, ssp_uuid = nil, group_name = nil)
365
+ if ssp_uuid.nil?
366
+ method_url = "/rest/api/uom/Tier/#{tier_uuid}"
367
+ else
368
+ method_url = "/rest/api/uom/SharedStoragePool/#{ssp_uuid}/Tier/#{tier_uuid}"
369
+ end
370
+ method_url += "?group=#{group_name}" unless group_name.nil?
371
+
372
+ response = request(:get, method_url)
373
+ Parser.new(response.body).object(:Tier)
374
+ end
375
+
376
+ ##
377
+ # @!method templates_summary
378
+ # Retrieve the list of partition template summaries.
379
+ # @return [Array<IbmPowerHmc::PartitionTemplateSummary>] The list of partition template summaries.
380
+ def templates_summary
381
+ method_url = "/rest/api/templates/PartitionTemplate"
382
+ response = request(:get, method_url)
383
+ FeedParser.new(response.body).objects(:PartitionTemplateSummary)
384
+ end
385
+
386
+ ##
387
+ # @!method template(template_uuid)
388
+ # Retrieve details for a particular partition template.
389
+ # @param template_uuid [String] UUID of the partition template.
390
+ # @return [IbmPowerHmc::PartitionTemplate] The partition template.
391
+ def template(template_uuid)
392
+ method_url = "/rest/api/templates/PartitionTemplate/#{template_uuid}"
393
+ response = request(:get, method_url)
394
+ Parser.new(response.body).object(:PartitionTemplate)
395
+ end
396
+
397
+ ##
398
+ # @!method capture_lpar(lpar_uuid, sys_uuid, template_name, sync = true)
399
+ # Capture partition configuration as template.
400
+ # @param lpar_uuid [String] The UUID of the logical partition.
401
+ # @param sys_uuid [String] The UUID of the managed system.
402
+ # @param template_name [String] The name to be given for the new template.
403
+ # @param sync [Boolean] Start the job and wait for its completion.
404
+ # @return [IbmPowerHmc::HmcJob] The HMC job.
405
+ def capture_lpar(lpar_uuid, sys_uuid, template_name, sync = true)
406
+ # Need to include session token in payload so make sure we are logged in
407
+ logon if @api_session_token.nil?
408
+ method_url = "/rest/api/templates/PartitionTemplate/do/capture"
409
+ params = {
410
+ "TargetUuid" => lpar_uuid,
411
+ "NewTemplateName" => template_name,
412
+ "ManagedSystemUuid" => sys_uuid,
413
+ "K_X_API_SESSION_MEMENTO" => @api_session_token
414
+ }
415
+ job = HmcJob.new(self, method_url, "Capture", "PartitionTemplate", params)
416
+ job.run if sync
417
+ job
418
+ end
419
+
204
420
  ##
205
421
  # @!method poweron_lpar(lpar_uuid, params = {}, sync = true)
206
422
  # Power on a logical partition.
@@ -219,9 +435,7 @@ module IbmPowerHmc
219
435
  ##
220
436
  # @!method poweroff_lpar(lpar_uuid, params = {}, sync = true)
221
437
  # Power off a logical partition.
222
- # @param lpar_uuid [String] The UUID of the logical partition.
223
- # @param params [Hash] Job parameters.
224
- # @param sync [Boolean] Start the job and wait for its completion.
438
+ # @param (see #poweron_lpar)
225
439
  # @return [IbmPowerHmc::HmcJob] The HMC job.
226
440
  def poweroff_lpar(lpar_uuid, params = {}, sync = true)
227
441
  method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/do/PowerOff"
@@ -249,9 +463,7 @@ module IbmPowerHmc
249
463
  ##
250
464
  # @!method poweroff_vios(vios_uuid, params = {}, sync = true)
251
465
  # Power off a virtual I/O server.
252
- # @param vios_uuid [String] The UUID of the virtual I/O server.
253
- # @param params [Hash] Job parameters.
254
- # @param sync [Boolean] Start the job and wait for its completion.
466
+ # @param (see #poweron_vios)
255
467
  # @return [IbmPowerHmc::HmcJob] The HMC job.
256
468
  def poweroff_vios(vios_uuid, params = {}, sync = true)
257
469
  method_url = "/rest/api/uom/VirtualIOServer/#{vios_uuid}/do/PowerOff"
@@ -279,9 +491,7 @@ module IbmPowerHmc
279
491
  ##
280
492
  # @!method poweroff_managed_system(sys_uuid, params = {}, sync = true)
281
493
  # Power off a managed system.
282
- # @param sys_uuid [String] The UUID of the managed system.
283
- # @param params [Hash] Job parameters.
284
- # @param sync [Boolean] Start the job and wait for its completion.
494
+ # @param (see #poweron_managed_system)
285
495
  # @return [IbmPowerHmc::HmcJob] The HMC job.
286
496
  def poweroff_managed_system(sys_uuid, params = {}, sync = true)
287
497
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/do/PowerOff"
@@ -339,7 +549,24 @@ module IbmPowerHmc
339
549
  # No need to sleep as the HMC already waits a bit before returning 204
340
550
  break if response.code != 204 || !wait
341
551
  end
342
- FeedParser.new(response.body).objects(:Event)
552
+ FeedParser.new(response.body).objects(:Event).map do |e|
553
+ data = e.data.split("/")
554
+ if data[-2].eql?("UserTask")
555
+ e.usertask = usertask(data.last)
556
+ end
557
+ e
558
+ end.compact
559
+ end
560
+
561
+ ##
562
+ # @!method usertask(uuid = true)
563
+ # Retrieve details of an event of type "user task".
564
+ # @param uuid [String] UUID of user task.
565
+ # @return [Hash] Hash of user task attributes.
566
+ def usertask(uuid)
567
+ method_url = "/rest/api/ui/UserTask/#{uuid}"
568
+ response = request(:get, method_url)
569
+ JSON.parse(response.body)
343
570
  end
344
571
 
345
572
  ##
@@ -418,6 +645,13 @@ module IbmPowerHmc
418
645
 
419
646
  private
420
647
 
648
+ # @!method modify_object(method_url, headers = {}, attempts = 5)
649
+ # Modify an object at a specified URI.
650
+ # @param method_url [String] The URL of the object to modify.
651
+ # @param headers [Hash] HTTP headers.
652
+ # @param attempts [Integer] Maximum number of retries.
653
+ # @yield [obj] The object to modify.
654
+ # @yieldparam obj [IbmPowerHmc::AbstractRest] The object to modify.
421
655
  def modify_object(method_url, headers = {}, attempts = 5)
422
656
  while attempts > 0
423
657
  response = request(:get, method_url)
@@ -426,16 +660,54 @@ module IbmPowerHmc
426
660
  yield obj
427
661
 
428
662
  # Use ETag to ensure object has not changed.
429
- headers = headers.merge("If-Match" => obj.etag)
663
+ headers = headers.merge("If-Match" => obj.etag, :content_type => obj.content_type)
430
664
  begin
431
665
  request(:post, method_url, headers, obj.xml.to_s)
432
666
  break
433
667
  rescue HttpError => e
434
668
  attempts -= 1
435
- # Will get 412 ("Precondition Failed" if ETag mismatches)
669
+ # Will get 412 ("Precondition Failed") if ETag mismatches
436
670
  raise if e.status != 412 || attempts == 0
437
671
  end
438
672
  end
439
673
  end
674
+
675
+ ##
676
+ # @!method network_adapter(vm_type, lpar_uuid, netadap_uuid)
677
+ # Retrieve one or all virtual ethernet network adapters attached to a Logical Partition or a Virtual I/O Server.
678
+ # @param vm_type [String] "LogicalPartition" or "VirtualIOServer".
679
+ # @param lpar_uuid [String] UUID of the Logical Partition or the Virtual I/O Server.
680
+ # @param netadap_uuid [String] UUID of the adapter to match (returns all adapters if nil).
681
+ # @return [Array<IbmPowerHmc::ClientNetworkAdapter>, IbmPowerHmc::ClientNetworkAdapter] The list of network adapters.
682
+ def network_adapter(vm_type, lpar_uuid, netadap_uuid)
683
+ if netadap_uuid.nil?
684
+ method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/ClientNetworkAdapter"
685
+ response = request(:get, method_url)
686
+ FeedParser.new(response.body).objects(:ClientNetworkAdapter)
687
+ else
688
+ method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/ClientNetworkAdapter/#{netadap_uuid}"
689
+ response = request(:get, method_url)
690
+ Parser.new(response.body).object(:ClientNetworkAdapter)
691
+ end
692
+ end
693
+
694
+ ##
695
+ # @!method sriov_ethernet_port(vm_type, lpar_uuid, sriov_elp_uuid)
696
+ # Retrieve one or all SR-IOV Ethernet loical ports attached to a Logical Partition or a Virtual I/O Server.
697
+ # @param vm_type [String] "LogicalPartition" or "VirtualIOServer".
698
+ # @param lpar_uuid [String] UUID of the Logical Partition or the Virtual I/O Server.
699
+ # @param sriov_elp_uuid [String] UUID of the port to match (returns all ports if nil).
700
+ # @return [Array<IbmPowerHmc::SRIOVEthernetLogicalPort>, IbmPowerHmc::SRIOVEthernetLogicalPort] The list of ports.
701
+ def sriov_ethernet_port(vm_type, lpar_uuid, sriov_elp_uuid)
702
+ if sriov_elp_uuid.nil?
703
+ method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/SRIOVEthernetLogicalPort"
704
+ response = request(:get, method_url)
705
+ FeedParser.new(response.body).objects(:SRIOVEthernetLogicalPort)
706
+ else
707
+ method_url = "/rest/api/uom/#{vm_type}/#{lpar_uuid}/SRIOVEthernetLogicalPort/#{sriov_elp_uuid}"
708
+ response = request(:get, method_url)
709
+ Parser.new(response.body).object(:SRIOVEthernetLogicalPort)
710
+ end
711
+ end
440
712
  end
441
713
  end
@@ -26,7 +26,7 @@ module IbmPowerHmc
26
26
  ##
27
27
  # @!method start
28
28
  # Start the job asynchronously.
29
- # @return [String] The ID of the job.
29
+ # @return [String] The URL of the job.
30
30
  def start
31
31
  headers = {
32
32
  :content_type => "application/vnd.ibm.powervm.web+xml; type=JobRequest"
@@ -47,7 +47,8 @@ module IbmPowerHmc
47
47
  end
48
48
  response = @conn.request(:put, @method_url, headers, doc.to_s)
49
49
  jobresp = Parser.new(response.body).object(:JobResponse)
50
- @id = jobresp.id
50
+ # Save the URL of the job (JobID is not sufficient as not all jobs are in uom).
51
+ @href = jobresp.href.path
51
52
  end
52
53
 
53
54
  # @return [Hash] The job results returned by the HMC.
@@ -58,13 +59,12 @@ module IbmPowerHmc
58
59
  # Return the status of the job.
59
60
  # @return [String] The status of the job.
60
61
  def status
61
- raise JobNotStarted unless defined?(@id)
62
+ raise JobNotStarted unless defined?(@href)
62
63
 
63
- method_url = "/rest/api/uom/jobs/#{@id}"
64
64
  headers = {
65
65
  :content_type => "application/vnd.ibm.powervm.web+xml; type=JobRequest"
66
66
  }
67
- response = @conn.request(:get, method_url, headers)
67
+ response = @conn.request(:get, @href, headers)
68
68
  jobresp = Parser.new(response.body).object(:JobResponse)
69
69
  @results = jobresp.results
70
70
  jobresp.status
@@ -100,17 +100,16 @@ module IbmPowerHmc
100
100
  start
101
101
  wait(timeout, poll_interval)
102
102
  ensure
103
- delete if defined?(@id)
103
+ delete if defined?(@href)
104
104
  end
105
105
 
106
106
  ##
107
107
  # @!method delete
108
108
  # Delete the job from the HMC.
109
109
  def delete
110
- raise JobNotStarted unless defined?(@id)
110
+ raise JobNotStarted unless defined?(@href)
111
111
 
112
- method_url = "/rest/api/uom/jobs/#{@id}"
113
- @conn.request(:delete, method_url)
112
+ @conn.request(:delete, @href)
114
113
  # Returns HTTP 204 if ok
115
114
  end
116
115
  end