ibm_power_hmc 0.7.0 → 0.8.3
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 +20 -3
- data/lib/ibm_power_hmc/parser.rb +55 -53
- 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: 90008b33210851e9ac14f556bd7e3b42231f38adcf68b6d5d59eed7e35671678
|
4
|
+
data.tar.gz: 6c85e9814f527680bea78f9c90fcc06a8796c949ac458c41074e01d6f44f7b61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ece63d99cccdf86022d907f75be7fe48871c6cac5fd64b5469fb0470fc4a0fe25e586fff16e2cc8ee65799eae8b315ba81b34879f395a7bb7375ae04edb74d61
|
7
|
+
data.tar.gz: 767ee9bd259139e97bba680a1edd395da73f5f40ab5ec149574c1538fd4964dd081dc1d272feee5395a8bf2aabeb8b8e5d57b410c5250699f6eef6b19f07f8f9
|
@@ -383,6 +383,16 @@ module IbmPowerHmc
|
|
383
383
|
FeedParser.new(response.body).objects(:PartitionTemplateSummary)
|
384
384
|
end
|
385
385
|
|
386
|
+
##
|
387
|
+
# @!method templates
|
388
|
+
# Retrieve the list of partition templates.
|
389
|
+
# @return [Array<IbmPowerHmc::PartitionTemplate>] The list of partition templates.
|
390
|
+
def templates
|
391
|
+
method_url = "/rest/api/templates/PartitionTemplate?detail=full"
|
392
|
+
response = request(:get, method_url)
|
393
|
+
FeedParser.new(response.body).objects(:PartitionTemplate)
|
394
|
+
end
|
395
|
+
|
386
396
|
##
|
387
397
|
# @!method template(template_uuid)
|
388
398
|
# Retrieve details for a particular partition template.
|
@@ -550,8 +560,8 @@ module IbmPowerHmc
|
|
550
560
|
break if response.code != 204 || !wait
|
551
561
|
end
|
552
562
|
FeedParser.new(response.body).objects(:Event).map do |e|
|
553
|
-
data = e.data.split("/")
|
554
|
-
if data[-2].eql?("UserTask")
|
563
|
+
data = e.data.split("/") unless e.data.nil?
|
564
|
+
if !data.nil? && data.length >= 2 && data[-2].eql?("UserTask")
|
555
565
|
e.usertask = usertask(data.last)
|
556
566
|
end
|
557
567
|
e
|
@@ -566,7 +576,14 @@ module IbmPowerHmc
|
|
566
576
|
def usertask(uuid)
|
567
577
|
method_url = "/rest/api/ui/UserTask/#{uuid}"
|
568
578
|
response = request(:get, method_url)
|
569
|
-
JSON.parse(response.body)
|
579
|
+
j = JSON.parse(response.body)
|
580
|
+
if j['status'].eql?("Completed")
|
581
|
+
case j['key']
|
582
|
+
when "TEMPLATE_PARTITION_SAVE", "TEMPLATE_PARTITION_SAVE_AS", "TEMPLATE_PARTITION_CAPTURE"
|
583
|
+
j['template_uuid'] = templates_summary.find { |t| t.name.eql?(j['labelParams'].first) }&.uuid
|
584
|
+
end
|
585
|
+
end
|
586
|
+
j
|
570
587
|
end
|
571
588
|
|
572
589
|
##
|
data/lib/ibm_power_hmc/parser.rb
CHANGED
@@ -74,9 +74,6 @@ module IbmPowerHmc
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
private_constant :Parser
|
78
|
-
private_constant :FeedParser
|
79
|
-
|
80
77
|
##
|
81
78
|
# HMC generic K2 non-REST object.
|
82
79
|
# @abstract
|
@@ -135,6 +132,15 @@ module IbmPowerHmc
|
|
135
132
|
uuid_from_href(link.attributes["href"], index)
|
136
133
|
end.compact
|
137
134
|
end
|
135
|
+
|
136
|
+
def collection_of(name, type)
|
137
|
+
objtype = Module.const_get("IbmPowerHmc::#{type}")
|
138
|
+
xml.get_elements("#{name}/#{type}").map do |elem|
|
139
|
+
objtype.new(elem)
|
140
|
+
end
|
141
|
+
rescue
|
142
|
+
[]
|
143
|
+
end
|
138
144
|
end
|
139
145
|
|
140
146
|
##
|
@@ -190,12 +196,19 @@ module IbmPowerHmc
|
|
190
196
|
ATTRS = {
|
191
197
|
:name => "ManagementConsoleName",
|
192
198
|
:build_level => "VersionInfo/BuildLevel",
|
193
|
-
:version => "BaseVersion"
|
199
|
+
:version => "BaseVersion",
|
200
|
+
:ssh_pubkey => "PublicSSHKeyValue"
|
194
201
|
}.freeze
|
195
202
|
|
196
203
|
def managed_systems_uuids
|
197
204
|
uuids_from_links("ManagedSystems")
|
198
205
|
end
|
206
|
+
|
207
|
+
def ssh_authkeys
|
208
|
+
xml.get_elements("AuthorizedKeysValue/AuthorizedKey").map do |elem|
|
209
|
+
elem.text&.strip
|
210
|
+
end.compact
|
211
|
+
end
|
199
212
|
end
|
200
213
|
|
201
214
|
# Managed System information
|
@@ -232,9 +245,7 @@ module IbmPowerHmc
|
|
232
245
|
end
|
233
246
|
|
234
247
|
def io_adapters
|
235
|
-
|
236
|
-
IOAdapter.new(elem)
|
237
|
-
end
|
248
|
+
collection_of("AssociatedSystemIOConfiguration/IOSlots/IOSlot/RelatedIOAdapter", "IOAdapter")
|
238
249
|
end
|
239
250
|
|
240
251
|
def vswitches_uuids
|
@@ -266,7 +277,8 @@ module IbmPowerHmc
|
|
266
277
|
:state => "PartitionState",
|
267
278
|
:type => "PartitionType",
|
268
279
|
:memory => "PartitionMemoryConfiguration/CurrentMemory",
|
269
|
-
:dedicated => "PartitionProcessorConfiguration/
|
280
|
+
:dedicated => "PartitionProcessorConfiguration/CurrentHasDedicatedProcessors",
|
281
|
+
:sharing_mode => "PartitionProcessorConfiguration/CurrentSharingMode",
|
270
282
|
:rmc_state => "ResourceMonitoringControlState",
|
271
283
|
:rmc_ipaddr => "ResourceMonitoringIPAddress",
|
272
284
|
:os => "OperatingSystemVersion",
|
@@ -277,8 +289,8 @@ module IbmPowerHmc
|
|
277
289
|
}.freeze
|
278
290
|
|
279
291
|
def sys_uuid
|
280
|
-
|
281
|
-
uuid_from_href(
|
292
|
+
href = singleton("AssociatedManagedSystem", "href")
|
293
|
+
uuid_from_href(href) unless href.nil?
|
282
294
|
end
|
283
295
|
|
284
296
|
def net_adap_uuids
|
@@ -286,9 +298,7 @@ module IbmPowerHmc
|
|
286
298
|
end
|
287
299
|
|
288
300
|
def lhea_ports
|
289
|
-
|
290
|
-
HostEthernetAdapterLogicalPort.new(elem)
|
291
|
-
end
|
301
|
+
collection_of("HostEthernetAdapterLogicalPorts", "HostEthernetAdapterLogicalPort")
|
292
302
|
end
|
293
303
|
|
294
304
|
def sriov_elp_uuids
|
@@ -321,9 +331,7 @@ module IbmPowerHmc
|
|
321
331
|
# VIOS information
|
322
332
|
class VirtualIOServer < BasePartition
|
323
333
|
def pvs
|
324
|
-
|
325
|
-
PhysicalVolume.new(elem)
|
326
|
-
end
|
334
|
+
collection_of("PhysicalVolumes", "PhysicalVolume")
|
327
335
|
end
|
328
336
|
|
329
337
|
def rep
|
@@ -332,15 +340,11 @@ module IbmPowerHmc
|
|
332
340
|
end
|
333
341
|
|
334
342
|
def vscsi_mappings
|
335
|
-
|
336
|
-
VirtualSCSIMapping.new(elem)
|
337
|
-
end
|
343
|
+
collection_of("VirtualSCSIMappings", "VirtualSCSIMapping")
|
338
344
|
end
|
339
345
|
|
340
346
|
def vfc_mappings
|
341
|
-
|
342
|
-
VirtualFibreChannelMapping.new(elem)
|
343
|
-
end
|
347
|
+
collection_of("VirtualFibreChannelMappings", "VirtualFibreChannelMapping")
|
344
348
|
end
|
345
349
|
end
|
346
350
|
|
@@ -390,9 +394,7 @@ module IbmPowerHmc
|
|
390
394
|
}.freeze
|
391
395
|
|
392
396
|
def vopts
|
393
|
-
|
394
|
-
VirtualOpticalMedia.new(elem)
|
395
|
-
end
|
397
|
+
collection_of("OpticalMedia", "VirtualOpticalMedia")
|
396
398
|
end
|
397
399
|
end
|
398
400
|
|
@@ -424,7 +426,7 @@ module IbmPowerHmc
|
|
424
426
|
|
425
427
|
def vswitch_uuid
|
426
428
|
href = singleton("AssociatedSwitch", "href")
|
427
|
-
uuid_from_href(href)
|
429
|
+
uuid_from_href(href) unless href.nil?
|
428
430
|
end
|
429
431
|
|
430
432
|
def lpars_uuids
|
@@ -511,7 +513,7 @@ module IbmPowerHmc
|
|
511
513
|
class VirtualSCSIMapping < AbstractNonRest
|
512
514
|
def lpar_uuid
|
513
515
|
href = singleton("AssociatedLogicalPartition", "href")
|
514
|
-
uuid_from_href(href)
|
516
|
+
uuid_from_href(href) unless href.nil?
|
515
517
|
end
|
516
518
|
|
517
519
|
def client
|
@@ -562,7 +564,7 @@ module IbmPowerHmc
|
|
562
564
|
|
563
565
|
def vios_uuid
|
564
566
|
href = singleton("ConnectingPartition", "href")
|
565
|
-
uuid_from_href(href)
|
567
|
+
uuid_from_href(href) unless href.nil?
|
566
568
|
end
|
567
569
|
end
|
568
570
|
|
@@ -606,7 +608,7 @@ module IbmPowerHmc
|
|
606
608
|
class VirtualFibreChannelMapping < AbstractNonRest
|
607
609
|
def lpar_uuid
|
608
610
|
href = singleton("AssociatedLogicalPartition", "href")
|
609
|
-
uuid_from_href(href)
|
611
|
+
uuid_from_href(href) unless href.nil?
|
610
612
|
end
|
611
613
|
|
612
614
|
def client
|
@@ -636,16 +638,14 @@ module IbmPowerHmc
|
|
636
638
|
|
637
639
|
def lpar_uuid
|
638
640
|
href = singleton("ConnectingPartition", "href")
|
639
|
-
uuid_from_href(href)
|
641
|
+
uuid_from_href(href) unless href.nil?
|
640
642
|
end
|
641
643
|
end
|
642
644
|
|
643
645
|
# VFC client information
|
644
646
|
class VirtualFibreChannelClientAdapter < VirtualFibreChannelAdapter
|
645
647
|
def nport_loggedin
|
646
|
-
|
647
|
-
VirtualFibreChannelNPortLoginStatus.new(elem)
|
648
|
-
end
|
648
|
+
collection_of("NportLoggedInStatus", "VirtualFibreChannelNPortLoginStatus")
|
649
649
|
end
|
650
650
|
|
651
651
|
def server
|
@@ -699,9 +699,7 @@ module IbmPowerHmc
|
|
699
699
|
}.freeze
|
700
700
|
|
701
701
|
def pvs
|
702
|
-
|
703
|
-
PhysicalVolume.new(elem)
|
704
|
-
end
|
702
|
+
collection_of("PhysicalVolumes", "PhysicalVolume")
|
705
703
|
end
|
706
704
|
end
|
707
705
|
|
@@ -713,15 +711,17 @@ module IbmPowerHmc
|
|
713
711
|
:tier_capable => "ClusterCapabilities/IsTierCapable"
|
714
712
|
}.freeze
|
715
713
|
|
714
|
+
def repopvs
|
715
|
+
collection_of("RepositoryDisk", "PhysicalVolume")
|
716
|
+
end
|
717
|
+
|
716
718
|
def ssp_uuid
|
717
719
|
href = singleton("ClusterSharedStoragePool", "href")
|
718
|
-
uuid_from_href(href)
|
720
|
+
uuid_from_href(href) unless href.nil?
|
719
721
|
end
|
720
722
|
|
721
723
|
def nodes
|
722
|
-
|
723
|
-
Node.new(elem)
|
724
|
-
end
|
724
|
+
collection_of("Node", "Node")
|
725
725
|
end
|
726
726
|
end
|
727
727
|
|
@@ -736,13 +736,14 @@ module IbmPowerHmc
|
|
736
736
|
|
737
737
|
def vios_uuid
|
738
738
|
href = singleton("VirtualIOServer", "href")
|
739
|
-
uuid_from_href(href)
|
739
|
+
uuid_from_href(href) unless href.nil?
|
740
740
|
end
|
741
741
|
end
|
742
742
|
|
743
743
|
# SSP information
|
744
744
|
class SharedStoragePool < AbstractRest
|
745
745
|
ATTRS = {
|
746
|
+
:id => "SharedStoragePoolID",
|
746
747
|
:name => "StoragePoolName",
|
747
748
|
:udid => "UniqueDeviceID",
|
748
749
|
:capacity => "Capacity",
|
@@ -754,13 +755,11 @@ module IbmPowerHmc
|
|
754
755
|
|
755
756
|
def cluster_uuid
|
756
757
|
href = singleton("AssociatedCluster", "href")
|
757
|
-
uuid_from_href(href)
|
758
|
+
uuid_from_href(href) unless href.nil?
|
758
759
|
end
|
759
760
|
|
760
761
|
def pvs
|
761
|
-
|
762
|
-
PhysicalVolume.new(elem)
|
763
|
-
end
|
762
|
+
collection_of("PhysicalVolumes", "PhysicalVolume")
|
764
763
|
end
|
765
764
|
|
766
765
|
def tiers_uuids
|
@@ -768,9 +767,7 @@ module IbmPowerHmc
|
|
768
767
|
end
|
769
768
|
|
770
769
|
def lus
|
771
|
-
|
772
|
-
LogicalUnit.new(elem)
|
773
|
-
end
|
770
|
+
collection_of("LogicalUnits", "LogicalUnit")
|
774
771
|
end
|
775
772
|
end
|
776
773
|
|
@@ -788,7 +785,7 @@ module IbmPowerHmc
|
|
788
785
|
|
789
786
|
def ssp_uuid
|
790
787
|
href = singleton("AssociatedSharedStoragePool", "href")
|
791
|
-
uuid_from_href(href)
|
788
|
+
uuid_from_href(href) unless href.nil?
|
792
789
|
end
|
793
790
|
|
794
791
|
def lus_uuids
|
@@ -816,10 +813,15 @@ module IbmPowerHmc
|
|
816
813
|
|
817
814
|
class PartitionTemplate < AbstractRest
|
818
815
|
ATTRS = {
|
819
|
-
:name
|
820
|
-
:description
|
821
|
-
:os
|
822
|
-
:memory
|
816
|
+
:name => "partitionTemplateName",
|
817
|
+
:description => "description",
|
818
|
+
:os => "logicalPartitionConfig/osVersion",
|
819
|
+
:memory => "logicalPartitionConfig/memoryConfiguration/currMemory",
|
820
|
+
:dedicated => "logicalPartitionConfig/processorConfiguration/hasDedicatedProcessors",
|
821
|
+
:sharing_mode => "logicalPartitionConfig/processorConfiguration/sharingMode",
|
822
|
+
:vprocs => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredVirtualProcessors",
|
823
|
+
:proc_units => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredProcessingUnits",
|
824
|
+
:procs => "logicalPartitionConfig/processorConfiguration/dedicatedProcessorConfiguration/desiredProcessors"
|
823
825
|
}.freeze
|
824
826
|
end
|
825
827
|
|
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.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IBM Power
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|