ibm_power_hmc 0.19.0 → 0.20.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: 8e8b824464b658e795023dba5c23ec80a7b90e830c204d7184a786029d37f276
4
- data.tar.gz: 5eb6491fd0d3f7d465acc0a8bbdac0063ceb1e028ad4c7b14b3ac92e7f79d622
3
+ metadata.gz: 49c35a3e54753bb8c31a1eafc7c6e98e0ad2a662d4d24c284e873ec3d30aa144
4
+ data.tar.gz: 8429c8a52729102cfcdd2294fc25a2a27dd3f01b0ba9f3f0e46ebbea931903ac
5
5
  SHA512:
6
- metadata.gz: 1a13e2dc82679cadc1ee2de5029aa30346402bf4d41e26932ab16325e097b63814d482ffcdd2d9e1fd14cb21e771231ca3ec52e5c5af6b2317fc1e43c3fd4adf
7
- data.tar.gz: 1e502b797270f3b71bb9d01280dc40a3f60e81ed2782027273ca75e045347872b641499622f915ed36f1dc75605468c6b86caa5c4bbd1894cff38189b6023ded
6
+ metadata.gz: 7b0cdb3f5348b221cd5fd147e63d391719b06324a49eec554fd1820d90f8000fb4000e005d5e638e6445be0608f7ea30a3a1db1d1345ac1cbf32526fd428f01f
7
+ data.tar.gz: 06d590cf0b6f2d92fbdd685d511ebd499597a285a248807cbe2814e5d569ad237753c7b2196c03b40d9f4be25d08071f990dc3d9d3fad0b20e4f5a8ef7a64438
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v0.20.0
2
+ * Add permissive option (`ignoreError=true`) for cluster APIs
3
+ * Fix `modify_object` method when URI has a query part
4
+ * Add `chcomgmt` method
5
+ * Add `grow_lu` method
6
+ * Add `shared_memory_pool` method
7
+ * Improve schema definitions for CPU and memory
8
+ * Add schema definition for shared memory pool
1
9
  ## v0.19.0
2
10
  * Major code refactoring
3
11
  * Add `serviceable_events` method
data/README.md CHANGED
@@ -70,6 +70,14 @@ Shutting down a logical partition:
70
70
  hc.poweroff_lpar(lpar_uuid, { "operation" => "shutdown" })
71
71
  ```
72
72
 
73
+ Setting the memory of a logical partition to 32GB:
74
+
75
+ ```ruby
76
+ hc.modify_object do
77
+ hc.lpar(lpar_uuid).tap { |lpar| lpar.desired_memory = 32_768 }
78
+ end
79
+ ```
80
+
73
81
  Listing serviceable events:
74
82
 
75
83
  ```ruby
@@ -184,7 +184,7 @@ module IbmPowerHmc
184
184
  # Use ETag to ensure object has not changed.
185
185
  headers = headers.merge("If-Match" => obj.etag, :content_type => obj.content_type)
186
186
  begin
187
- request(:post, method_url.nil? ? obj.href.path : method_url, headers, obj.xml.to_s)
187
+ request(:post, method_url.nil? ? obj.href.to_s : method_url, headers, obj.xml.to_s)
188
188
  break
189
189
  rescue HttpError => e
190
190
  attempts -= 1
@@ -193,8 +193,8 @@ module IbmPowerHmc
193
193
  method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer"
194
194
  end
195
195
  query = {}
196
- query["ignoreError"] = "true" if permissive
197
196
  query["group"] = group_name unless group_name.nil?
197
+ query["ignoreError"] = "true" if permissive
198
198
  method_url += "?" + query.map { |h| h.join("=") }.join("&") unless query.empty?
199
199
 
200
200
  response = request(:get, method_url)
@@ -413,11 +413,12 @@ module IbmPowerHmc
413
413
  end
414
414
 
415
415
  ##
416
- # @!method clusters
416
+ # @!method clusters(permissive = true)
417
417
  # Retrieve the list of clusters managed by the HMC.
418
+ # @param permissive [Boolean] Ignore errors generated from bad clusters.
418
419
  # @return [Array<IbmPowerHmc::Cluster>] The list of clusters.
419
- def clusters
420
- method_url = "/rest/api/uom/Cluster"
420
+ def clusters(permissive = true)
421
+ method_url = "/rest/api/uom/Cluster#{'?ignoreError=true' if permissive}"
421
422
  response = request(:get, method_url)
422
423
  FeedParser.new(response.body).objects(:Cluster)
423
424
  end
@@ -434,11 +435,12 @@ module IbmPowerHmc
434
435
  end
435
436
 
436
437
  ##
437
- # @!method ssps
438
+ # @!method ssps(permissive = true)
438
439
  # Retrieve the list of shared storage pools managed by the HMC.
440
+ # @param permissive [Boolean] Ignore errors generated from bad clusters.
439
441
  # @return [Array<IbmPowerHmc::SharedStoragePool>] The list of shared storage pools.
440
- def ssps
441
- method_url = "/rest/api/uom/SharedStoragePool"
442
+ def ssps(permissive = true)
443
+ method_url = "/rest/api/uom/SharedStoragePool#{'?ignoreError=true' if permissive}"
442
444
  response = request(:get, method_url)
443
445
  FeedParser.new(response.body).objects(:SharedStoragePool)
444
446
  end
@@ -455,13 +457,17 @@ module IbmPowerHmc
455
457
  end
456
458
 
457
459
  ##
458
- # @!method tiers(group_name = nil)
460
+ # @!method tiers(group_name = nil, permissive = true)
459
461
  # Retrieve the list of tiers that are part of shared storage pools managed by the HMC.
460
462
  # @param group_name [String] The extended group attributes.
463
+ # @param permissive [Boolean] Ignore errors generated from bad clusters.
461
464
  # @return [Array<IbmPowerHmc::Tier>] The list of tiers.
462
- def tiers(group_name = nil)
465
+ def tiers(group_name = nil, permissive = true)
463
466
  method_url = "/rest/api/uom/Tier"
464
- method_url += "?group=#{group_name}" unless group_name.nil?
467
+ query = {}
468
+ query["group"] = group_name unless group_name.nil?
469
+ query["ignoreError"] = "true" if permissive
470
+ method_url += "?" + query.map { |h| h.join("=") }.join("&") unless query.empty?
465
471
  response = request(:get, method_url)
466
472
  FeedParser.new(response.body).objects(:Tier)
467
473
  end
@@ -503,6 +509,24 @@ module IbmPowerHmc
503
509
  end
504
510
  end
505
511
 
512
+ ##
513
+ # @!method shared_memory_pool(sys_uuid, pool_uuid = nil)
514
+ # Retrieve information about Shared Memory Pools.
515
+ # @param sys_uuid [String] The UUID of the managed system.
516
+ # @param pool_uuid [String] The UUID of the shared memory pool (return all pools if omitted)
517
+ # @return [Array<IbmPowerHmc::SharedMemoryPool>, IbmPowerHmc::SharedMemoryPool] The list of shared memory pools.
518
+ def shared_memory_pool(sys_uuid, pool_uuid = nil)
519
+ if pool_uuid.nil?
520
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/SharedMemoryPool"
521
+ response = request(:get, method_url)
522
+ FeedParser.new(response.body).objects(:SharedMemoryPool)
523
+ else
524
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/SharedMemoryPool/#{pool_uuid}"
525
+ response = request(:get, method_url)
526
+ Parser.new(response.body).object(:SharedMemoryPool)
527
+ end
528
+ end
529
+
506
530
  ##
507
531
  # @!method poweron_lpar(lpar_uuid, params = {}, sync = true)
508
532
  # Power on a logical partition.
@@ -602,6 +626,21 @@ module IbmPowerHmc
602
626
  job
603
627
  end
604
628
 
629
+ ##
630
+ # @!method chcomgmt(sys_uuid, status)
631
+ # Change the co-management settings for a managed system.
632
+ # @param sys_uuid [String] The UUID of the managed system.
633
+ # @param status [String] The new co-management status ("rel", "norm", "keep").
634
+ # @return [IbmPowerHmc::HmcJob] The HMC job.
635
+ def chcomgmt(sys_uuid, status)
636
+ operation = status == "rel" ? "ReleaseController" : "RequestController"
637
+ method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/do/#{operation}"
638
+
639
+ params = {}
640
+ params["coManagementControllerStatus"] = status unless status == "rel"
641
+ HmcJob.new(self, method_url, operation, "ManagedSystem", params).tap(&:run)
642
+ end
643
+
605
644
  ##
606
645
  # @!method cli_run(hmc_uuid, cmd, sync = true)
607
646
  # Run a CLI command on the HMC as a job.
@@ -621,6 +660,23 @@ module IbmPowerHmc
621
660
  job
622
661
  end
623
662
 
663
+ ##
664
+ # @!method grow_lu(cl_uuid, lu_uuid, capacity)
665
+ # Increase the size of a logical unit in a cluster.
666
+ # @param cl_uuid [String] The UUID of the cluster.
667
+ # @param lu_uuid [String] The UUID of the logical unit.
668
+ # @param capacity [Float] The new logical unit size (in GB).
669
+ # @return [IbmPowerHmc::HmcJob] The HMC job.
670
+ def grow_lu(cl_uuid, lu_uuid, capacity)
671
+ method_url = "/rest/api/uom/Cluster/#{cl_uuid}/do/GrowLogicalUnit"
672
+
673
+ params = {
674
+ "LogicalUnitUDID" => lu_uuid,
675
+ "Capacity" => capacity
676
+ }
677
+ HmcJob.new(self, method_url, "GrowLogicalUnit", "Cluster", params).tap(&:run)
678
+ end
679
+
624
680
  ##
625
681
  # @!method next_events(wait = true)
626
682
  # Retrieve a list of events that occured since last call.
@@ -129,8 +129,13 @@ module IbmPowerHmc
129
129
  :state => "PartitionState",
130
130
  :type => "PartitionType",
131
131
  :memory => "PartitionMemoryConfiguration/CurrentMemory",
132
+ :desired_memory => "PartitionMemoryConfiguration/DesiredMemory",
133
+ :min_memory => "PartitionMemoryConfiguration/MinimumMemory",
134
+ :max_memory => "PartitionMemoryConfiguration/MaximumMemory",
132
135
  :dedicated => "PartitionProcessorConfiguration/CurrentHasDedicatedProcessors",
133
136
  :sharing_mode => "PartitionProcessorConfiguration/CurrentSharingMode",
137
+ :uncapped_weight => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/CurrentUncappedWeight",
138
+ :desired_uncapped_weight => "PartitionProcessorConfiguration/SharedProcessorConfiguration/UncappedWeight",
134
139
  :rmc_state => "ResourceMonitoringControlState",
135
140
  :rmc_ipaddr => "ResourceMonitoringIPAddress",
136
141
  :os => "OperatingSystemVersion",
@@ -138,6 +143,12 @@ module IbmPowerHmc
138
143
  :procs => "PartitionProcessorConfiguration/CurrentDedicatedProcessorConfiguration/CurrentProcessors",
139
144
  :proc_units => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/CurrentProcessingUnits",
140
145
  :vprocs => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/AllocatedVirtualProcessors",
146
+ :desired_proc_units => "PartitionProcessorConfiguration/SharedProcessorConfiguration/DesiredProcessingUnits",
147
+ :desired_vprocs => "PartitionProcessorConfiguration/SharedProcessorConfiguration/DesiredVirtualProcessors",
148
+ :minimum_proc_units => "PartitionProcessorConfiguration/SharedProcessorConfiguration/MinimumProcessingUnits",
149
+ :minimum_vprocs => "PartitionProcessorConfiguration/SharedProcessorConfiguration/MinimumVirtualProcessors",
150
+ :maximum_proc_units => "PartitionProcessorConfiguration/SharedProcessorConfiguration/MaximumProcessingUnits",
151
+ :maximum_vprocs => "PartitionProcessorConfiguration/SharedProcessorConfiguration/MaximumVirtualProcessors",
141
152
  :cpu_compat_mode => "CurrentProcessorCompatibilityMode",
142
153
  :description => "Description"
143
154
  }.freeze
@@ -795,6 +806,38 @@ module IbmPowerHmc
795
806
  end
796
807
  end
797
808
 
809
+ # Shared Memory Pool
810
+ class SharedMemoryPool < AbstractRest
811
+ ATTRS = {
812
+ :pool_mb => "CurrentPoolMemory",
813
+ :available_mb => "CurrentAvailablePoolMemory",
814
+ :max_mb => "CurrentMaximumPoolMemory",
815
+ :sys_mb =>"SystemFirmwarePoolMemory",
816
+ :pool_id => "PoolID",
817
+ :dedup => "MemoryDeduplicationEnabled"
818
+ }.freeze
819
+
820
+ def paging_vios_uuids
821
+ ["PagingServicePartitionOne", "PagingServicePartitionTwo"].map do |attr|
822
+ if (vios_href = singleton(attr, "href"))
823
+ uuid_from_href(vios_href)
824
+ end
825
+ end
826
+ end
827
+
828
+ def lpar_uuids
829
+ REXML::XPath.match(xml, "PagingDevices/ReservedStorageDevice").map do |dev|
830
+ if (lpar = dev.elements["AssociatedLogicalPartition"])
831
+ uuid_from_href(lpar.attributes["href"])
832
+ end
833
+ end.compact
834
+ end
835
+
836
+ def sys_uuid
837
+ uuid_from_href(href, -3)
838
+ end
839
+ end
840
+
798
841
  # HMC Event
799
842
  class Event < AbstractRest
800
843
  attr_accessor :usertask
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.19.0"
4
+ VERSION = "0.20.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.19.0
4
+ version: 0.20.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-26 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client