ibm_power_hmc 0.23.1 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/ibm_power_hmc/apis/templates.rb +0 -14
- data/lib/ibm_power_hmc/apis/uom.rb +6 -2
- data/lib/ibm_power_hmc/schema/uom.rb +110 -0
- data/lib/ibm_power_hmc/utils.rb +40 -0
- data/lib/ibm_power_hmc/version.rb +1 -1
- data/lib/ibm_power_hmc.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15e5d3ed25c9329a63b1655da54869b5f0a979f7775149209648d86a0fa67ad
|
4
|
+
data.tar.gz: c1c78e4c661ef6c90ea743245b3e5c29777e7ab51e276a088ca9206d814b99ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 379f4c199e6c5a818617608060d98fe75413856b588760a6c0a2a946002858d7df52ce2b86ba54a4af9a2de3b61391828d3fbca4457dae93319c37cc2813bec9
|
7
|
+
data.tar.gz: 5299f74322afac43f91af2a131b5fb1521fc0f3ca3ed87106405006ef181eaa9d776b80e1501f13dabdbdee9630ba3868a47b0839ba88458f88b2782ed43623b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v0.25.0
|
2
|
+
* Add `vios_uuid` as alias to `lpar_uuid` for VFC schema definition
|
3
|
+
* Add `lpar_delete_vios_mappings` util method
|
4
|
+
* Add option to `lpar_delete` to delete associated VIOS VSCSI/VFC mappings
|
5
|
+
## v0.24.0
|
6
|
+
* Add schema methods to modify VSCSI and VFC mappings
|
7
|
+
* Add schema definition for IOSlot
|
8
|
+
* Add schema definition for IORDevice
|
1
9
|
## v0.23.0
|
2
10
|
* Enhance schema definition for physical fibre channel adapters
|
3
11
|
## v0.22.0
|
@@ -119,20 +119,6 @@ module IbmPowerHmc
|
|
119
119
|
job
|
120
120
|
end
|
121
121
|
|
122
|
-
##
|
123
|
-
# @!method template_provision(template_uuid, target_sys_uuid, changes)
|
124
|
-
# Deploy Logical Partition from a Template (performs Check, Transform and Deploy steps in a single method).
|
125
|
-
# @param template_uuid [String] The UUID of the Template to deploy an LPAR from.
|
126
|
-
# @param target_sys_uuid [String] The UUID of the Managed System to deploy the LPAR on.
|
127
|
-
# @param changes [Hash] Modifications to apply to the Template before deploying Logical Partition.
|
128
|
-
# @return [String] The UUID of the deployed Logical Partition.
|
129
|
-
def template_provision(template_uuid, target_sys_uuid, changes)
|
130
|
-
draft_uuid = template_check(template_uuid, target_sys_uuid).results["TEMPLATE_UUID"]
|
131
|
-
template_transform(draft_uuid, target_sys_uuid)
|
132
|
-
template_modify(draft_uuid, changes)
|
133
|
-
template_deploy(draft_uuid, target_sys_uuid).results["PartitionUuid"]
|
134
|
-
end
|
135
|
-
|
136
122
|
##
|
137
123
|
# @!method template_modify(template_uuid, changes)
|
138
124
|
# Modify a template.
|
@@ -168,11 +168,15 @@ module IbmPowerHmc
|
|
168
168
|
end
|
169
169
|
|
170
170
|
##
|
171
|
-
# @!method lpar_delete(lpar_uuid)
|
171
|
+
# @!method lpar_delete(lpar_uuid, delete_vios_mappings: false)
|
172
172
|
# Delete a logical partition.
|
173
173
|
# @param lpar_uuid [String] The UUID of the logical partition to delete.
|
174
|
-
|
174
|
+
# @param delete_vios_mappings [Boolean] Delete associated VIOS VFC and VSCSI server adapters.
|
175
|
+
def lpar_delete(lpar_uuid, delete_vios_mappings: false)
|
175
176
|
method_url = "/rest/api/uom/LogicalPartition/#{lpar_uuid}"
|
177
|
+
|
178
|
+
lpar_delete_vios_mappings(lpar_uuid) if delete_vios_mappings
|
179
|
+
|
176
180
|
request(:delete, method_url)
|
177
181
|
# Returns HTTP 204 if ok
|
178
182
|
end
|
@@ -94,10 +94,15 @@ module IbmPowerHmc
|
|
94
94
|
uuids_from_links("AssociatedVirtualIOServers")
|
95
95
|
end
|
96
96
|
|
97
|
+
# Deprecated: use io_slots.io_adapter
|
97
98
|
def io_adapters
|
98
99
|
collection_of("AssociatedSystemIOConfiguration/IOSlots/IOSlot/RelatedIOAdapter", "IOAdapter")
|
99
100
|
end
|
100
101
|
|
102
|
+
def io_slots
|
103
|
+
collection_of("AssociatedSystemIOConfiguration/IOSlots", "IOSlot")
|
104
|
+
end
|
105
|
+
|
101
106
|
def vswitches_uuids
|
102
107
|
uuids_from_links("AssociatedSystemIOConfiguration/AssociatedSystemVirtualNetwork/VirtualSwitches")
|
103
108
|
end
|
@@ -107,6 +112,73 @@ module IbmPowerHmc
|
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|
115
|
+
# I/O Slot information
|
116
|
+
class IOSlot < AbstractNonRest
|
117
|
+
ATTRS = {
|
118
|
+
:description => "Description",
|
119
|
+
:lpar_id => "PartitionID",
|
120
|
+
:lpar_name => "PartitionName",
|
121
|
+
:lpar_type => "PartitionType",
|
122
|
+
:pci_class => "PCIClass",
|
123
|
+
:pci_dev => "PCIDeviceID",
|
124
|
+
:pci_subsys_dev => "PCISubsystemDeviceID",
|
125
|
+
:pci_man => "PCIManufacturerID",
|
126
|
+
:pci_rev => "PCIRevisionID",
|
127
|
+
:pci_vendor => "PCIVendorID",
|
128
|
+
:pci_subsys_vendor => "PCISubsystemVendorID",
|
129
|
+
:dr_name => "SlotDynamicReconfigurationConnectorName",
|
130
|
+
:physloc => "SlotPhysicalLocationCode",
|
131
|
+
:sriov_capable_dev => "SRIOVCapableDevice",
|
132
|
+
:sriov_capable => "SRIOVCapableSlot",
|
133
|
+
:vpd_model => "VitalProductDataModel",
|
134
|
+
:vpd_serial => "VitalProductDataSerialNumber",
|
135
|
+
:vpd_stale => "VitalProductDataStale",
|
136
|
+
:vpd_type => "VitalProductDataType"
|
137
|
+
}.freeze
|
138
|
+
|
139
|
+
def io_adapter
|
140
|
+
elem = xml.elements["RelatedIOAdapter/*[1]"]
|
141
|
+
Module.const_get("IbmPowerHmc::#{elem.name}").new(elem) unless elem.nil?
|
142
|
+
rescue NameError
|
143
|
+
nil
|
144
|
+
end
|
145
|
+
|
146
|
+
def features
|
147
|
+
xml.get_elements("FeatureCodes").map do |elem|
|
148
|
+
elem.text&.strip
|
149
|
+
end.compact
|
150
|
+
end
|
151
|
+
|
152
|
+
def ior_devices
|
153
|
+
collection_of("IORDevices", "IORDevice")
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# I/O Device information
|
158
|
+
class IORDevice < AbstractNonRest
|
159
|
+
ATTRS = {
|
160
|
+
:parent => "ParentName",
|
161
|
+
:pci_dev => "PCIDeviceId",
|
162
|
+
:pci_vendor => "PCIVendorId",
|
163
|
+
:pci_subsys_dev => "PCISubsystemDeviceId",
|
164
|
+
:pci_subsys_vendor => "PCISubsystemVendorId",
|
165
|
+
:pci_rev => "PCIRevisionId",
|
166
|
+
:pci_class => "PCIClassCode",
|
167
|
+
:type => "DeviceType",
|
168
|
+
:serial => "SerialNumber",
|
169
|
+
:fru_number => "FruNumber",
|
170
|
+
:part_number => "PartNumber",
|
171
|
+
:ccin => "CCIN",
|
172
|
+
:size => "Size",
|
173
|
+
:location => "LocationCode",
|
174
|
+
:ucode_version => "MicroCodeVersion",
|
175
|
+
:wwpn => "WWPN",
|
176
|
+
:wwnn => "WWNN",
|
177
|
+
:macaddr => "MacAddressValue",
|
178
|
+
:description => "Description"
|
179
|
+
}.freeze
|
180
|
+
end
|
181
|
+
|
110
182
|
# I/O Adapter information
|
111
183
|
class IOAdapter < AbstractNonRest
|
112
184
|
ATTRS = {
|
@@ -211,10 +283,17 @@ module IbmPowerHmc
|
|
211
283
|
end.compact
|
212
284
|
end
|
213
285
|
|
286
|
+
# Deprecated: use io_slots.io_adapter
|
214
287
|
def io_adapters
|
215
288
|
collection_of("PartitionIOConfiguration/ProfileIOSlots/ProfileIOSlot/AssociatedIOSlot/RelatedIOAdapter", "*[1]")
|
216
289
|
end
|
217
290
|
|
291
|
+
def io_slots
|
292
|
+
xml.get_elements("PartitionIOConfiguration/ProfileIOSlots/ProfileIOSlot/AssociatedIOSlot").map do |elem|
|
293
|
+
IOSlot.new(elem)
|
294
|
+
end.compact
|
295
|
+
end
|
296
|
+
|
218
297
|
def shared_processor_pool_uuid
|
219
298
|
href = singleton("ProcessorPool", "href")
|
220
299
|
uuid_from_href(href) unless href.nil?
|
@@ -278,10 +357,39 @@ module IbmPowerHmc
|
|
278
357
|
collection_of("VirtualSCSIMappings", "VirtualSCSIMapping")
|
279
358
|
end
|
280
359
|
|
360
|
+
# Remove VSCSI mapping (vhostX) from XML
|
361
|
+
def vscsi_mapping_delete!(location)
|
362
|
+
vscsi_mappings.each do |mapping|
|
363
|
+
mapping.xml.parent.delete(mapping.xml) if mapping.server&.location == location
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Remove VSCSI target (vtscsiX) from XML
|
368
|
+
def vscsi_mapping_unmap!(target)
|
369
|
+
mapping = vscsi_mappings.find { |m| m.device&.target == target }
|
370
|
+
mapping.xml.parent.delete(mapping.xml) unless mapping.nil?
|
371
|
+
end
|
372
|
+
|
281
373
|
def vfc_mappings
|
282
374
|
collection_of("VirtualFibreChannelMappings", "VirtualFibreChannelMapping")
|
283
375
|
end
|
284
376
|
|
377
|
+
# Remove VFC mapping (vfchostX) from XML
|
378
|
+
def vfc_mapping_delete!(location)
|
379
|
+
mapping = vfc_mappings.find { |m| m.server&.location == location }
|
380
|
+
mapping.xml.parent.delete(mapping.xml) unless mapping.nil?
|
381
|
+
end
|
382
|
+
|
383
|
+
# Remove FC adapter mapping (fcsX) from XML
|
384
|
+
def vfc_mapping_unmap!(location)
|
385
|
+
mapping = vfc_mappings.find { |m| m.port && m.server&.location == location }
|
386
|
+
return if mapping.nil?
|
387
|
+
|
388
|
+
mapping.port.xml.parent.delete(mapping.port.xml)
|
389
|
+
mapping.server.map_port = nil
|
390
|
+
mapping.server.xml.delete(mapping.server.port.xml) unless mapping.server.port.nil?
|
391
|
+
end
|
392
|
+
|
285
393
|
def seas
|
286
394
|
collection_of("SharedEthernetAdapters", "SharedEthernetAdapter")
|
287
395
|
end
|
@@ -735,6 +843,8 @@ module IbmPowerHmc
|
|
735
843
|
|
736
844
|
# VFC client information
|
737
845
|
class VirtualFibreChannelClientAdapter < VirtualFibreChannelAdapter
|
846
|
+
alias vios_uuid lpar_uuid
|
847
|
+
|
738
848
|
def nport_loggedin
|
739
849
|
collection_of("NportLoggedInStatus", "VirtualFibreChannelNPortLoginStatus")
|
740
850
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module IbmPowerHmc
|
4
|
+
class Connection
|
5
|
+
##
|
6
|
+
# @!method lpar_delete_vios_mappings(lpar_uuid)
|
7
|
+
# Delete VIOS VSCSI and VFC mappings associated to a given logical partition.
|
8
|
+
# @param lpar_uuid [String] The logical partition UUID.
|
9
|
+
def lpar_delete_vios_mappings(lpar_uuid)
|
10
|
+
vscsi_client_adapter(lpar_uuid).concat(vfc_client_adapter(lpar_uuid)).group_by(&:vios_uuid).each do |vios_uuid, adapters|
|
11
|
+
modify_object do
|
12
|
+
vios(vios_uuid, nil, "ViosSCSIMapping,ViosFCMapping").tap do |vios|
|
13
|
+
adapters.collect(&:server).each do |server|
|
14
|
+
case server
|
15
|
+
when VirtualSCSIServerAdapter
|
16
|
+
vios.vscsi_mapping_delete!(server.location)
|
17
|
+
when VirtualFibreChannelServerAdapter
|
18
|
+
vios.vfc_mapping_delete!(server.location)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @!method template_provision(template_uuid, target_sys_uuid, changes)
|
28
|
+
# Deploy Logical Partition from a Template (performs Check, Transform and Deploy steps in a single method).
|
29
|
+
# @param template_uuid [String] The UUID of the Template to deploy an LPAR from.
|
30
|
+
# @param target_sys_uuid [String] The UUID of the Managed System to deploy the LPAR on.
|
31
|
+
# @param changes [Hash] Modifications to apply to the Template before deploying Logical Partition.
|
32
|
+
# @return [String] The UUID of the deployed Logical Partition.
|
33
|
+
def template_provision(template_uuid, target_sys_uuid, changes)
|
34
|
+
draft_uuid = template_check(template_uuid, target_sys_uuid).results["TEMPLATE_UUID"]
|
35
|
+
template_transform(draft_uuid, target_sys_uuid)
|
36
|
+
template_modify(draft_uuid, changes)
|
37
|
+
template_deploy(draft_uuid, target_sys_uuid).results["PartitionUuid"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/ibm_power_hmc.rb
CHANGED
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.25.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-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/ibm_power_hmc/schema/sem.rb
|
69
69
|
- lib/ibm_power_hmc/schema/templates.rb
|
70
70
|
- lib/ibm_power_hmc/schema/uom.rb
|
71
|
+
- lib/ibm_power_hmc/utils.rb
|
71
72
|
- lib/ibm_power_hmc/version.rb
|
72
73
|
homepage: http://github.com/IBM/ibm_power_hmc_sdk_ruby
|
73
74
|
licenses:
|