ibm_power_hmc 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b3d62a8c9463bde2ffbcfc08f9005924913a5567506cf6ae2e73fae8863a2bd
4
- data.tar.gz: acc60a5a70fff620d64085ffc36a6e2aa79fc582f5644be4b6d1ef1e1484af95
3
+ metadata.gz: fa2829db70216f23c73d2d06e8daebdbc2be4f3bde1f8f17d2659961288caa19
4
+ data.tar.gz: cb7a7cabacbf9efffe013715af8b0e4c5cc4fdf6b941cd0ef42cc8d19861fea5
5
5
  SHA512:
6
- metadata.gz: 628151a41e5e7492b42dfea5a510f3030bcc48ffa8d97121e43d6b4a3ba612586bb511f8f4a46aa3644e5acfa6fbc217f04bda179c99d2e9aa23cf6c4d6bf5c9
7
- data.tar.gz: f6fea07e19239510bded7d89f7091fbf3f5398c2e2c4ac135c1ef32e75369c4a23666241f0faa7e09c3595ac0f81667539913b30679bf8568bd556008071f041
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 = {
@@ -124,11 +196,29 @@ module IbmPowerHmc
124
196
 
125
197
  # FC adapter information
126
198
  class PhysicalFibreChannelAdapter < IOAdapter
127
- def slots
199
+ def ports
128
200
  collection_of("PhysicalFibreChannelPorts", "PhysicalFibreChannelPort")
129
201
  end
130
202
  end
131
203
 
204
+ # FC port information
205
+ class PhysicalFibreChannelPort < AbstractNonRest
206
+ ATTRS = {
207
+ :location => "LocationCode",
208
+ :name => "PortName",
209
+ :udid => "UniqueDeviceID",
210
+ :wwpn => "WWPN",
211
+ :wwnn => "WWNN",
212
+ :avail_ports => "AvailablePorts",
213
+ :total_ports => "TotalPorts",
214
+ :label => "Label"
215
+ }.freeze
216
+
217
+ def pvs
218
+ collection_of("PhysicalVolumes", "PhysicalVolume")
219
+ end
220
+ end
221
+
132
222
  # Common class for LPAR and VIOS
133
223
  class BasePartition < AbstractRest
134
224
  ATTRS = {
@@ -193,10 +283,17 @@ module IbmPowerHmc
193
283
  end.compact
194
284
  end
195
285
 
286
+ # Deprecated: use io_slots.io_adapter
196
287
  def io_adapters
197
288
  collection_of("PartitionIOConfiguration/ProfileIOSlots/ProfileIOSlot/AssociatedIOSlot/RelatedIOAdapter", "*[1]")
198
289
  end
199
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
+
200
297
  def shared_processor_pool_uuid
201
298
  href = singleton("ProcessorPool", "href")
202
299
  uuid_from_href(href) unless href.nil?
@@ -260,10 +357,39 @@ module IbmPowerHmc
260
357
  collection_of("VirtualSCSIMappings", "VirtualSCSIMapping")
261
358
  end
262
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
+
263
373
  def vfc_mappings
264
374
  collection_of("VirtualFibreChannelMappings", "VirtualFibreChannelMapping")
265
375
  end
266
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
+
267
393
  def seas
268
394
  collection_of("SharedEthernetAdapters", "SharedEthernetAdapter")
269
395
  end
@@ -759,24 +885,6 @@ module IbmPowerHmc
759
885
  end
760
886
  end
761
887
 
762
- # FC port information
763
- class PhysicalFibreChannelPort < AbstractNonRest
764
- ATTRS = {
765
- :location => "LocationCode",
766
- :name => "PortName",
767
- :udid => "UniqueDeviceID",
768
- :wwpn => "WWPN",
769
- :wwnn => "WWNN",
770
- :avail_ports => "AvailablePorts",
771
- :total_ports => "TotalPorts",
772
- :label => "Label"
773
- }.freeze
774
-
775
- def pvs
776
- collection_of("PhysicalVolumes", "PhysicalVolume")
777
- end
778
- end
779
-
780
888
  # Cluster information
781
889
  class Cluster < AbstractRest
782
890
  ATTRS = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.23.0"
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.0
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