ibm_power_hmc 0.12.2 → 0.14.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 +4 -4
- data/lib/ibm_power_hmc/connection.rb +106 -13
- data/lib/ibm_power_hmc/parser.rb +22 -2
- 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: 3162f83d1c3168407716f683401e5f3f1b3c49489728561e52ab49410209beaa
|
4
|
+
data.tar.gz: c50f1ac36cda911c01262b06762fd928c06790d4df116f020958edd10ca0713e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 014ff944d75d5dccf07d894628a0b41c08fe99d3478558f57b22aff2a1e86cc9589368c3a55696dc0f196edabd59f0d9e47b0f2aa09f726b7d6b18c5d250e775
|
7
|
+
data.tar.gz: 68a388e0a6a75c9cc61e9befeca8644fa64f92e95ca8411948fe166ba81c44997bd67c0247d943567fb0f345671bb9164dbc77294bdeb153f534b394c4637334
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'erb'
|
4
|
+
|
3
5
|
# Module for IBM HMC Rest API Client
|
4
6
|
module IbmPowerHmc
|
5
7
|
class Error < StandardError; end
|
@@ -77,13 +79,13 @@ module IbmPowerHmc
|
|
77
79
|
end
|
78
80
|
|
79
81
|
##
|
80
|
-
# @!method managed_systems(search =
|
82
|
+
# @!method managed_systems(search = nil)
|
81
83
|
# Retrieve the list of systems managed by the HMC.
|
82
|
-
# @param search [
|
84
|
+
# @param search [String] The optional search criteria.
|
83
85
|
# @return [Array<IbmPowerHmc::ManagedSystem>] The list of managed systems.
|
84
|
-
def managed_systems(search =
|
86
|
+
def managed_systems(search = nil)
|
85
87
|
method_url = "/rest/api/uom/ManagedSystem"
|
86
|
-
|
88
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
87
89
|
response = request(:get, method_url)
|
88
90
|
FeedParser.new(response.body).objects(:ManagedSystem)
|
89
91
|
end
|
@@ -103,15 +105,15 @@ module IbmPowerHmc
|
|
103
105
|
end
|
104
106
|
|
105
107
|
##
|
106
|
-
# @!method lpars(sys_uuid = nil, search =
|
108
|
+
# @!method lpars(sys_uuid = nil, search = nil)
|
107
109
|
# Retrieve the list of logical partitions managed by the HMC.
|
108
110
|
# @param sys_uuid [String] The UUID of the managed system.
|
109
|
-
# @param search [
|
111
|
+
# @param search [String] The optional search criteria.
|
110
112
|
# @return [Array<IbmPowerHmc::LogicalPartition>] The list of logical partitions.
|
111
|
-
def lpars(sys_uuid = nil, search =
|
113
|
+
def lpars(sys_uuid = nil, search = nil)
|
112
114
|
if sys_uuid.nil?
|
113
115
|
method_url = "/rest/api/uom/LogicalPartition"
|
114
|
-
|
116
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
115
117
|
else
|
116
118
|
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/LogicalPartition"
|
117
119
|
end
|
@@ -162,20 +164,57 @@ module IbmPowerHmc
|
|
162
164
|
end
|
163
165
|
|
164
166
|
##
|
165
|
-
# @!method
|
167
|
+
# @!method lpar_migrate_validate(lpar_uuid, target_sys_name, sync = true)
|
168
|
+
# Validate if a logical partition can be migrated to another managed system.
|
169
|
+
# @raise [IbmPowerHmc::JobFailed] if validation fails
|
170
|
+
# @param lpar_uuid [String] The UUID of the logical partition to migrate.
|
171
|
+
# @param target_sys_name [String] The managed system to migrate partition to.
|
172
|
+
# @param sync [Boolean] Start the job and wait for its completion.
|
173
|
+
def lpar_migrate_validate(lpar_uuid, target_sys_name, sync = true)
|
174
|
+
# Need to include session token in payload so make sure we are logged in
|
175
|
+
logon if @api_session_token.nil?
|
176
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/do/MigrateValidate"
|
177
|
+
params = {
|
178
|
+
"TargetManagedSystemName" => target_sys_name
|
179
|
+
}
|
180
|
+
HmcJob.new(self, method_url, "MigrateValidate", "LogicalPartition", params).tap do |job|
|
181
|
+
job.run if sync
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# @!method lpar_migrate(lpar_uuid, target_sys_name, sync = true)
|
187
|
+
# Migrate a logical partition to another managed system.
|
188
|
+
# @param lpar_uuid [String] The UUID of the logical partition to migrate.
|
189
|
+
# @param target_sys_name [String] The managed system to migrate partition to.
|
190
|
+
# @param sync [Boolean] Start the job and wait for its completion.
|
191
|
+
def lpar_migrate(lpar_uuid, target_sys_name, sync = true)
|
192
|
+
# Need to include session token in payload so make sure we are logged in
|
193
|
+
logon if @api_session_token.nil?
|
194
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/do/Migrate"
|
195
|
+
params = {
|
196
|
+
"TargetManagedSystemName" => target_sys_name
|
197
|
+
}
|
198
|
+
HmcJob.new(self, method_url, "Migrate", "LogicalPartition", params).tap do |job|
|
199
|
+
job.run if sync
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @!method vioses(sys_uuid = nil, search = nil, permissive = true)
|
166
205
|
# Retrieve the list of virtual I/O servers managed by the HMC.
|
167
206
|
# @param sys_uuid [String] The UUID of the managed system.
|
168
|
-
# @param search [
|
207
|
+
# @param search [String] The optional search criteria.
|
169
208
|
# @param permissive [Boolean] Skip virtual I/O servers that have error conditions.
|
170
209
|
# @return [Array<IbmPowerHmc::VirtualIOServer>] The list of virtual I/O servers.
|
171
|
-
def vioses(sys_uuid = nil, search =
|
210
|
+
def vioses(sys_uuid = nil, search = nil, permissive = true)
|
172
211
|
if sys_uuid.nil?
|
173
212
|
method_url = "/rest/api/uom/VirtualIOServer"
|
174
|
-
|
175
|
-
method_url += "?ignoreError=true" if permissive
|
213
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
176
214
|
else
|
177
215
|
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer"
|
178
216
|
end
|
217
|
+
method_url += "?ignoreError=true" if permissive
|
179
218
|
response = request(:get, method_url)
|
180
219
|
FeedParser.new(response.body).objects(:VirtualIOServer)
|
181
220
|
end
|
@@ -315,6 +354,42 @@ module IbmPowerHmc
|
|
315
354
|
end
|
316
355
|
end
|
317
356
|
|
357
|
+
##
|
358
|
+
# @!method vscsi_client_adapter(lpar_uuid, adap_uuid = nil)
|
359
|
+
# Retrieve one or all virtual SCSI storage client adapters attached to a logical partition.
|
360
|
+
# @param lpar_uuid [String] UUID of the logical partition.
|
361
|
+
# @param adap_uuid [String] UUID of the adapter to match (returns all adapters if omitted).
|
362
|
+
# @return [Array<IbmPowerHmc::VirtualSCSIClientAdapter>, IbmPowerHmc::VirtualSCSIClientAdapter] The list of storage adapters.
|
363
|
+
def vscsi_client_adapter(lpar_uuid, adap_uuid = nil)
|
364
|
+
if adap_uuid.nil?
|
365
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualSCSIClientAdapter"
|
366
|
+
response = request(:get, method_url)
|
367
|
+
FeedParser.new(response.body).objects(:VirtualSCSIClientAdapter)
|
368
|
+
else
|
369
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualSCSIClientAdapter/#{adap_uuid}"
|
370
|
+
response = request(:get, method_url)
|
371
|
+
Parser.new(response.body).object(:VirtualSCSIClientAdapter)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
##
|
376
|
+
# @!method vfc_client_adapter(lpar_uuid, adap_uuid = nil)
|
377
|
+
# Retrieve one or all virtual Fibre Channel storage client adapters attached to a logical partition.
|
378
|
+
# @param lpar_uuid [String] UUID of the logical partition.
|
379
|
+
# @param adap_uuid [String] UUID of the adapter to match (returns all adapters if omitted).
|
380
|
+
# @return [Array<IbmPowerHmc::VirtualFibreChannelClientAdapter>, IbmPowerHmc::VirtualFibreChannelClientAdapter] The list of storage adapters.
|
381
|
+
def vfc_client_adapter(lpar_uuid, adap_uuid = nil)
|
382
|
+
if adap_uuid.nil?
|
383
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualFibreChannelClientAdapter"
|
384
|
+
response = request(:get, method_url)
|
385
|
+
FeedParser.new(response.body).objects(:VirtualFibreChannelClientAdapter)
|
386
|
+
else
|
387
|
+
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}/VirtualFibreChannelClientAdapter/#{adap_uuid}"
|
388
|
+
response = request(:get, method_url)
|
389
|
+
Parser.new(response.body).object(:VirtualFibreChannelClientAdapter)
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
318
393
|
##
|
319
394
|
# @!method clusters
|
320
395
|
# Retrieve the list of clusters managed by the HMC.
|
@@ -388,6 +463,24 @@ module IbmPowerHmc
|
|
388
463
|
Parser.new(response.body).object(:Tier)
|
389
464
|
end
|
390
465
|
|
466
|
+
##
|
467
|
+
# @!method shared_processor_pool(sys_uuid, pool_uuid = nil)
|
468
|
+
# Retrieve information about Shared Processor Pools.
|
469
|
+
# @param sys_uuid [String] The UUID of the managed system.
|
470
|
+
# @param pool_uuid [String] The UUID of the shared storage pool (return all pools if omitted)
|
471
|
+
# @return [Array<IbmPowerHmc::SharedProcessorPool>, IbmPowerHmc::SharedProcessorPool] The list of shared processor pools.
|
472
|
+
def shared_processor_pool(sys_uuid, pool_uuid = nil)
|
473
|
+
if pool_uuid.nil?
|
474
|
+
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/SharedProcessorPool"
|
475
|
+
response = request(:get, method_url)
|
476
|
+
FeedParser.new(response.body).objects(:SharedProcessorPool)
|
477
|
+
else
|
478
|
+
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/SharedProcessorPool/#{pool_uuid}"
|
479
|
+
response = request(:get, method_url)
|
480
|
+
Parser.new(response.body).object(:SharedProcessorPool)
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
391
484
|
##
|
392
485
|
# @!method templates_summary(draft = false)
|
393
486
|
# Retrieve the list of partition template summaries.
|
data/lib/ibm_power_hmc/parser.rb
CHANGED
@@ -262,7 +262,9 @@ module IbmPowerHmc
|
|
262
262
|
:model => "MachineTypeModelAndSerialNumber/Model",
|
263
263
|
:serial => "MachineTypeModelAndSerialNumber/SerialNumber",
|
264
264
|
:vtpm_version => "AssociatedSystemSecurity/VirtualTrustedPlatformModuleVersion",
|
265
|
-
:vtpm_lpars => "AssociatedSystemSecurity/AvailableVirtualTrustedPlatformModulePartitions"
|
265
|
+
:vtpm_lpars => "AssociatedSystemSecurity/AvailableVirtualTrustedPlatformModulePartitions",
|
266
|
+
:is_classic_hmc_mgmt => "IsClassicHMCManagement",
|
267
|
+
:is_hmc_mgmt_master => "IsHMCPowerVMManagementMaster"
|
266
268
|
}.freeze
|
267
269
|
|
268
270
|
def group_uuids
|
@@ -517,7 +519,9 @@ module IbmPowerHmc
|
|
517
519
|
:type => "AdapterType", # "Server", "Client", "Unknown"
|
518
520
|
:location => "LocationCode",
|
519
521
|
:slot => "VirtualSlotNumber",
|
520
|
-
:required => "RequiredAdapter"
|
522
|
+
:required => "RequiredAdapter",
|
523
|
+
:lpar_id => "LocalPartitionID",
|
524
|
+
:dr_name => "DynamicReconfigurationConnectorName"
|
521
525
|
}.freeze
|
522
526
|
end
|
523
527
|
|
@@ -896,6 +900,22 @@ module IbmPowerHmc
|
|
896
900
|
}.freeze
|
897
901
|
end
|
898
902
|
|
903
|
+
# Shared Processor Pool
|
904
|
+
class SharedProcessorPool < AbstractRest
|
905
|
+
ATTRS = {
|
906
|
+
:name => "PoolName",
|
907
|
+
:available => "AvailableProcUnits",
|
908
|
+
:max => "MaximumProcessingUnits",
|
909
|
+
:reserved => "CurrentReservedProcessingUnits",
|
910
|
+
:pending_reserved => "PendingReservedProcessingUnits",
|
911
|
+
:pool_id => "PoolID"
|
912
|
+
}.freeze
|
913
|
+
|
914
|
+
def lpar_uuids
|
915
|
+
uuids_from_links("AssignedPartitions")
|
916
|
+
end
|
917
|
+
end
|
918
|
+
|
899
919
|
class PartitionTemplateSummary < AbstractRest
|
900
920
|
ATTRS = {
|
901
921
|
:name => "partitionTemplateName"
|
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.14.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-09-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|