ibm_power_hmc 0.23.1 → 0.24.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: 664a0abb7f7694b46dfc2b6df5bd77d4302dc95388a31b39700cee8c2f8aa577
4
- data.tar.gz: aa33a336fb9acb8f5b638d3e0d141a39700b6557c055aa21e03d3caa74a4e06f
3
+ metadata.gz: fa2829db70216f23c73d2d06e8daebdbc2be4f3bde1f8f17d2659961288caa19
4
+ data.tar.gz: cb7a7cabacbf9efffe013715af8b0e4c5cc4fdf6b941cd0ef42cc8d19861fea5
5
5
  SHA512:
6
- metadata.gz: fccd5b4c9a95d02e36e06fe171f9f6f62aef3632f4698c0954bb05d31ce0d7c8e815cd5d280d9f397da2d7962223dd46e7b1813a64afd71f3c5685ef00f6fea0
7
- data.tar.gz: '011009cf620e6d618c936f69e4593a7369e3c7cb11e70c20778c7422806386995b62f20cf4d5141c07b6ec725df7aacc599f2bd52b508e7b41281d5830d91c70'
6
+ metadata.gz: 390b00cf4dd7f4fd83ef4c8619d25274f3b708fe5bdc075eef77b8bd7f199875b2003cbc203ecdf3adbee4518a8905bd59003bd238a7c81033504e0763971943
7
+ data.tar.gz: 7fee8e0a80ce4b266b27469706e00dd8804a5f706a272301751680bc660bf04d6398583c8268a0b8e28176da6e4f96c161b22f4d71813c4b1b101c6c5872fa5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.24.0
2
+ * Add schema methods to modify VSCSI and VFC mappings
3
+ * Add schema definition for IOSlot
4
+ * Add schema definition for IORDevice
1
5
  ## v0.23.0
2
6
  * Enhance schema definition for physical fibre channel adapters
3
7
  ## v0.22.0
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.23.1"
4
+ VERSION = "0.24.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.23.1
4
+ version: 0.24.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-23 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client