ibm_power_hmc 0.13.0 → 0.15.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 +41 -14
- data/lib/ibm_power_hmc/parser.rb +6 -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: 795c24c54a66370ed07b6d1fdac7f156e2802f2e3ddcc874a3e63704cea8c1f9
|
4
|
+
data.tar.gz: 0cb32bfa4740e020d444e1d4b520cee210c50e14c13c7caacf3c79edc9529121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c980bfb6bea2bcf632903a5cda0dccfafc49f4115fa94d80823d6ba836cd9c385a37faa7e3951bb1c7675e8d928d92250890920689d8b07c870b8043196d532e
|
7
|
+
data.tar.gz: 7af86636d815da7b63587e459bbd4601045c55f4485cb22eb503b6875e00c43cd94f83d412882fe995e3846171547979f0fd5f93ab4e6804013e01fb9bd9d38d
|
@@ -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
|
@@ -16,12 +18,13 @@ module IbmPowerHmc
|
|
16
18
|
# @param username [String] User name.
|
17
19
|
# @param port [Integer] TCP port number.
|
18
20
|
# @param validate_ssl [Boolean] Verify SSL certificates.
|
19
|
-
def initialize(host:, password:, username: "hscroot", port: 12_443, validate_ssl: true)
|
21
|
+
def initialize(host:, password:, username: "hscroot", port: 12_443, validate_ssl: true, timeout: 60)
|
20
22
|
@hostname = "#{host}:#{port}"
|
21
23
|
@username = username
|
22
24
|
@password = password
|
23
25
|
@verify_ssl = validate_ssl
|
24
26
|
@api_session_token = nil
|
27
|
+
@timeout = timeout
|
25
28
|
end
|
26
29
|
|
27
30
|
##
|
@@ -76,17 +79,40 @@ module IbmPowerHmc
|
|
76
79
|
end
|
77
80
|
|
78
81
|
##
|
79
|
-
# @!method managed_systems(search =
|
82
|
+
# @!method managed_systems(search = nil)
|
80
83
|
# Retrieve the list of systems managed by the HMC.
|
81
|
-
# @param search [
|
84
|
+
# @param search [String] The optional search criteria.
|
82
85
|
# @return [Array<IbmPowerHmc::ManagedSystem>] The list of managed systems.
|
83
|
-
def managed_systems(search =
|
86
|
+
def managed_systems(search = nil)
|
84
87
|
method_url = "/rest/api/uom/ManagedSystem"
|
85
|
-
|
88
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
86
89
|
response = request(:get, method_url)
|
87
90
|
FeedParser.new(response.body).objects(:ManagedSystem)
|
88
91
|
end
|
89
92
|
|
93
|
+
##
|
94
|
+
# @!method managed_systems_quick
|
95
|
+
# Retrieve the list of systems managed by the HMC (using Quick API).
|
96
|
+
# @return [Array<Hash>] The list of managed systems.
|
97
|
+
def managed_systems_quick
|
98
|
+
method_url = "/rest/api/uom/ManagedSystem/quick/All"
|
99
|
+
response = request(:get, method_url)
|
100
|
+
JSON.parse(response.body)
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# @!method managed_system_quick(sys_uuid, property = nil)
|
105
|
+
# Retrieve information about a managed system (using Quick API).
|
106
|
+
# @param sys_uuid [String] The UUID of the managed system.
|
107
|
+
# @param property_name [String] The quick property name (optional).
|
108
|
+
# @return [Hash] The managed system.
|
109
|
+
def managed_system_quick(sys_uuid, property = nil)
|
110
|
+
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/quick"
|
111
|
+
method_url += "/#{property}" unless property.nil?
|
112
|
+
response = request(:get, method_url)
|
113
|
+
JSON.parse(response.body)
|
114
|
+
end
|
115
|
+
|
90
116
|
##
|
91
117
|
# @!method managed_system(lpar_uuid, sys_uuid = nil, group_name = nil)
|
92
118
|
# Retrieve information about a managed system.
|
@@ -102,15 +128,15 @@ module IbmPowerHmc
|
|
102
128
|
end
|
103
129
|
|
104
130
|
##
|
105
|
-
# @!method lpars(sys_uuid = nil, search =
|
131
|
+
# @!method lpars(sys_uuid = nil, search = nil)
|
106
132
|
# Retrieve the list of logical partitions managed by the HMC.
|
107
133
|
# @param sys_uuid [String] The UUID of the managed system.
|
108
|
-
# @param search [
|
134
|
+
# @param search [String] The optional search criteria.
|
109
135
|
# @return [Array<IbmPowerHmc::LogicalPartition>] The list of logical partitions.
|
110
|
-
def lpars(sys_uuid = nil, search =
|
136
|
+
def lpars(sys_uuid = nil, search = nil)
|
111
137
|
if sys_uuid.nil?
|
112
138
|
method_url = "/rest/api/uom/LogicalPartition"
|
113
|
-
|
139
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
114
140
|
else
|
115
141
|
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/LogicalPartition"
|
116
142
|
end
|
@@ -198,16 +224,16 @@ module IbmPowerHmc
|
|
198
224
|
end
|
199
225
|
|
200
226
|
##
|
201
|
-
# @!method vioses(sys_uuid = nil, search =
|
227
|
+
# @!method vioses(sys_uuid = nil, search = nil, permissive = true)
|
202
228
|
# Retrieve the list of virtual I/O servers managed by the HMC.
|
203
229
|
# @param sys_uuid [String] The UUID of the managed system.
|
204
|
-
# @param search [
|
230
|
+
# @param search [String] The optional search criteria.
|
205
231
|
# @param permissive [Boolean] Skip virtual I/O servers that have error conditions.
|
206
232
|
# @return [Array<IbmPowerHmc::VirtualIOServer>] The list of virtual I/O servers.
|
207
|
-
def vioses(sys_uuid = nil, search =
|
233
|
+
def vioses(sys_uuid = nil, search = nil, permissive = true)
|
208
234
|
if sys_uuid.nil?
|
209
235
|
method_url = "/rest/api/uom/VirtualIOServer"
|
210
|
-
|
236
|
+
method_url += "/search/(#{ERB::Util.url_encode(search)})" unless search.nil?
|
211
237
|
else
|
212
238
|
method_url = "/rest/api/uom/ManagedSystem/#{sys_uuid}/VirtualIOServer"
|
213
239
|
end
|
@@ -858,7 +884,8 @@ module IbmPowerHmc
|
|
858
884
|
:url => url,
|
859
885
|
:verify_ssl => @verify_ssl,
|
860
886
|
:payload => payload,
|
861
|
-
:headers => headers
|
887
|
+
:headers => headers,
|
888
|
+
:timeout => @timeout
|
862
889
|
)
|
863
890
|
rescue RestClient::Exception => e
|
864
891
|
# Do not retry on failed logon attempts.
|
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
|
|
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.15.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-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|