ibm_power_hmc 0.8.0 → 0.8.5

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: caf9b3a9dcb79bb47bbe628afda5c77ecf94ec6627dc469b8e1a2f564196c8a3
4
- data.tar.gz: 031cf0f7f98a8800203281e6d7b27b83adce11651363ac3ce01d06d8c9a69865
3
+ metadata.gz: 0f3a1da6b15a6562c060f770de48558912255e5c842d11596a09490e2de98dd7
4
+ data.tar.gz: c38e2a93f8256de626de729ad0b6f044f0d9dca4d9f7c32c579de8129f857ab3
5
5
  SHA512:
6
- metadata.gz: 305a5f34bb64be2962d639b38df77fed119de4bb4800db6c0c3d0343af5ac04b336020d3ad0c58a91176ed8601d45a06ab0c6e439592accb5759a7e6924739d2
7
- data.tar.gz: 40e6fa63028817a280c26d75a7e0777cb3da60a801ec9dc742fa99405da1fb23343bc79e4b2d81ea145047a6ed1ad06ce72dd681bdc544a685b672a3b92b1805
6
+ metadata.gz: a975a0b0ff53dd9dbee3e6484b38b76199faaff9e6faba8051fe7dd99b28ac9bd47c1e12cfcf219d1d51ea96f5f1351e41c4116cee28570df4b5bebfaf8cea14
7
+ data.tar.gz: 12a5f47ceb5594e154f861f6d155be076588e4ea0bf03f8b98a57990ee0206dad283d427fedd4481d1a3920880aead0a26e48a8ac8146293fae30e0de4490ede
data/.gitignore CHANGED
File without changes
data/.rubocop.yml CHANGED
File without changes
data/.rubocop_local.yml CHANGED
@@ -7,3 +7,5 @@ Style/ConditionalAssignment:
7
7
  Enabled: false
8
8
  Style/OptionalBooleanParameter:
9
9
  Enabled: false
10
+ Style/StringConcatenation:
11
+ Enabled: false
data/CHANGELOG.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rubocop/rake_task'
3
+
2
4
  task :default => :spec
5
+
6
+ RuboCop::RakeTask.new
@@ -27,4 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_runtime_dependency "rest-client", "~> 2.1"
30
+
31
+ spec.add_development_dependency "manageiq-style", "~> 1.3"
30
32
  end
@@ -196,6 +196,18 @@ module IbmPowerHmc
196
196
  Parser.new(response.body).object(:VirtualIOServer)
197
197
  end
198
198
 
199
+ ##
200
+ # @!method groups
201
+ # Retrieve the list of groups defined on the HMC.
202
+ # A logical partition, a virtual I/O server or a managed system can be
203
+ # associated with multiple group tags.
204
+ # @return [Array<IbmPowerHmc::Group>] The list of groups.
205
+ def groups
206
+ method_url = "/rest/api/uom/Group"
207
+ response = request(:get, method_url)
208
+ FeedParser.new(response.body).objects(:Group)
209
+ end
210
+
199
211
  ##
200
212
  # @!method virtual_switches(sys_uuid)
201
213
  # Retrieve the list of virtual switches from a specified managed system.
@@ -560,8 +572,8 @@ module IbmPowerHmc
560
572
  break if response.code != 204 || !wait
561
573
  end
562
574
  FeedParser.new(response.body).objects(:Event).map do |e|
563
- data = e.data.split("/")
564
- if data[-2].eql?("UserTask")
575
+ data = e.data.split("/") unless e.data.nil?
576
+ if !data.nil? && data.length >= 2 && data[-2].eql?("UserTask")
565
577
  e.usertask = usertask(data.last)
566
578
  end
567
579
  e
@@ -580,7 +592,7 @@ module IbmPowerHmc
580
592
  if j['status'].eql?("Completed")
581
593
  case j['key']
582
594
  when "TEMPLATE_PARTITION_SAVE", "TEMPLATE_PARTITION_SAVE_AS", "TEMPLATE_PARTITION_CAPTURE"
583
- j['template_uuid'] = templates_summary.select { |t| t.name.eql?(j['labelParams'].first) }.first&.uuid
595
+ j['template_uuid'] = templates_summary.find { |t| t.name.eql?(j['labelParams'].first) }&.uuid
584
596
  end
585
597
  end
586
598
  j
File without changes
@@ -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,20 @@ 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",
201
+ :uvmid => "UVMID"
194
202
  }.freeze
195
203
 
196
204
  def managed_systems_uuids
197
205
  uuids_from_links("ManagedSystems")
198
206
  end
207
+
208
+ def ssh_authkeys
209
+ xml.get_elements("AuthorizedKeysValue/AuthorizedKey").map do |elem|
210
+ elem.text&.strip
211
+ end.compact
212
+ end
199
213
  end
200
214
 
201
215
  # Managed System information
@@ -205,6 +219,9 @@ module IbmPowerHmc
205
219
  :state => "State",
206
220
  :hostname => "Hostname",
207
221
  :ipaddr => "PrimaryIPAddress",
222
+ :description => "Description",
223
+ :location => "SystemLocation", # Rack/Unit
224
+ :ref_code => "ReferenceCode",
208
225
  :fwversion => "SystemFirmware",
209
226
  :memory => "AssociatedSystemMemoryConfiguration/InstalledSystemMemory",
210
227
  :avail_mem => "AssociatedSystemMemoryConfiguration/CurrentAvailableSystemMemory",
@@ -217,6 +234,20 @@ module IbmPowerHmc
217
234
  :vtpm_lpars => "AssociatedSystemSecurity/AvailableVirtualTrustedPlatformModulePartitions"
218
235
  }.freeze
219
236
 
237
+ def group_uuids
238
+ uuids_from_links("AssociatedGroups")
239
+ end
240
+
241
+ def time
242
+ Time.at(0, singleton("SystemTime").to_i, :millisecond).utc
243
+ end
244
+
245
+ def capabilities
246
+ xml.get_elements("AssociatedSystemCapabilities/*").map do |elem|
247
+ elem.name unless elem.text&.strip != "true"
248
+ end.compact
249
+ end
250
+
220
251
  def cpu_compat_modes
221
252
  xml.get_elements("AssociatedSystemProcessorConfiguration/SupportedPartitionProcessorCompatibilityModes").map do |elem|
222
253
  elem.text&.strip
@@ -232,9 +263,7 @@ module IbmPowerHmc
232
263
  end
233
264
 
234
265
  def io_adapters
235
- xml.get_elements("AssociatedSystemIOConfiguration/IOSlots/IOSlot/RelatedIOAdapter/IOAdapter").map do |elem|
236
- IOAdapter.new(elem)
237
- end
266
+ collection_of("AssociatedSystemIOConfiguration/IOSlots/IOSlot/RelatedIOAdapter", "IOAdapter")
238
267
  end
239
268
 
240
269
  def vswitches_uuids
@@ -266,19 +295,25 @@ module IbmPowerHmc
266
295
  :state => "PartitionState",
267
296
  :type => "PartitionType",
268
297
  :memory => "PartitionMemoryConfiguration/CurrentMemory",
269
- :dedicated => "PartitionProcessorConfiguration/HasDedicatedProcessors",
298
+ :dedicated => "PartitionProcessorConfiguration/CurrentHasDedicatedProcessors",
299
+ :sharing_mode => "PartitionProcessorConfiguration/CurrentSharingMode",
270
300
  :rmc_state => "ResourceMonitoringControlState",
271
301
  :rmc_ipaddr => "ResourceMonitoringIPAddress",
272
302
  :os => "OperatingSystemVersion",
273
303
  :ref_code => "ReferenceCode",
274
304
  :procs => "PartitionProcessorConfiguration/CurrentDedicatedProcessorConfiguration/CurrentProcessors",
275
305
  :proc_units => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/CurrentProcessingUnits",
276
- :vprocs => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/AllocatedVirtualProcessors"
306
+ :vprocs => "PartitionProcessorConfiguration/CurrentSharedProcessorConfiguration/AllocatedVirtualProcessors",
307
+ :description => "Description"
277
308
  }.freeze
278
309
 
279
310
  def sys_uuid
280
- sys_href = singleton("AssociatedManagedSystem", "href")
281
- uuid_from_href(sys_href)
311
+ href = singleton("AssociatedManagedSystem", "href")
312
+ uuid_from_href(href) unless href.nil?
313
+ end
314
+
315
+ def group_uuids
316
+ uuids_from_links("AssociatedGroups")
282
317
  end
283
318
 
284
319
  def net_adap_uuids
@@ -286,9 +321,7 @@ module IbmPowerHmc
286
321
  end
287
322
 
288
323
  def lhea_ports
289
- xml.get_elements("HostEthernetAdapterLogicalPorts/HostEthernetAdapterLogicalPort").map do |elem|
290
- HostEthernetAdapterLogicalPort.new(elem)
291
- end
324
+ collection_of("HostEthernetAdapterLogicalPorts", "HostEthernetAdapterLogicalPort")
292
325
  end
293
326
 
294
327
  def sriov_elp_uuids
@@ -321,9 +354,7 @@ module IbmPowerHmc
321
354
  # VIOS information
322
355
  class VirtualIOServer < BasePartition
323
356
  def pvs
324
- xml.get_elements("PhysicalVolumes/PhysicalVolume").map do |elem|
325
- PhysicalVolume.new(elem)
326
- end
357
+ collection_of("PhysicalVolumes", "PhysicalVolume")
327
358
  end
328
359
 
329
360
  def rep
@@ -332,15 +363,32 @@ module IbmPowerHmc
332
363
  end
333
364
 
334
365
  def vscsi_mappings
335
- xml.get_elements("VirtualSCSIMappings/VirtualSCSIMapping").map do |elem|
336
- VirtualSCSIMapping.new(elem)
337
- end
366
+ collection_of("VirtualSCSIMappings", "VirtualSCSIMapping")
338
367
  end
339
368
 
340
369
  def vfc_mappings
341
- xml.get_elements("VirtualFibreChannelMappings/VirtualFibreChannelMapping").map do |elem|
342
- VirtualFibreChannelMapping.new(elem)
343
- end
370
+ collection_of("VirtualFibreChannelMappings", "VirtualFibreChannelMapping")
371
+ end
372
+ end
373
+
374
+ # Group information
375
+ class Group < AbstractRest
376
+ ATTRS = {
377
+ :name => "GroupName",
378
+ :description => "GroupDescription",
379
+ :color => "GroupColor"
380
+ }.freeze
381
+
382
+ def sys_uuids
383
+ uuids_from_links("AssociatedManagedSystems")
384
+ end
385
+
386
+ def lpar_uuids
387
+ uuids_from_links("AssociatedLogicalPartitions")
388
+ end
389
+
390
+ def vios_uuids
391
+ uuids_from_links("AssociatedVirtualIOServers")
344
392
  end
345
393
  end
346
394
 
@@ -390,9 +438,7 @@ module IbmPowerHmc
390
438
  }.freeze
391
439
 
392
440
  def vopts
393
- xml.get_elements("OpticalMedia/VirtualOpticalMedia").map do |elem|
394
- VirtualOpticalMedia.new(elem)
395
- end
441
+ collection_of("OpticalMedia", "VirtualOpticalMedia")
396
442
  end
397
443
  end
398
444
 
@@ -424,7 +470,7 @@ module IbmPowerHmc
424
470
 
425
471
  def vswitch_uuid
426
472
  href = singleton("AssociatedSwitch", "href")
427
- uuid_from_href(href)
473
+ uuid_from_href(href) unless href.nil?
428
474
  end
429
475
 
430
476
  def lpars_uuids
@@ -465,6 +511,7 @@ module IbmPowerHmc
465
511
 
466
512
  # LP-HEA information
467
513
  class EthernetBackingDevice < IOAdapter; end
514
+
468
515
  class HostEthernetAdapterLogicalPort < EthernetBackingDevice
469
516
  ATTRS = ATTRS.merge({
470
517
  :macaddr => "MACAddress",
@@ -511,7 +558,7 @@ module IbmPowerHmc
511
558
  class VirtualSCSIMapping < AbstractNonRest
512
559
  def lpar_uuid
513
560
  href = singleton("AssociatedLogicalPartition", "href")
514
- uuid_from_href(href)
561
+ uuid_from_href(href) unless href.nil?
515
562
  end
516
563
 
517
564
  def client
@@ -562,7 +609,7 @@ module IbmPowerHmc
562
609
 
563
610
  def vios_uuid
564
611
  href = singleton("ConnectingPartition", "href")
565
- uuid_from_href(href)
612
+ uuid_from_href(href) unless href.nil?
566
613
  end
567
614
  end
568
615
 
@@ -606,7 +653,7 @@ module IbmPowerHmc
606
653
  class VirtualFibreChannelMapping < AbstractNonRest
607
654
  def lpar_uuid
608
655
  href = singleton("AssociatedLogicalPartition", "href")
609
- uuid_from_href(href)
656
+ uuid_from_href(href) unless href.nil?
610
657
  end
611
658
 
612
659
  def client
@@ -636,16 +683,14 @@ module IbmPowerHmc
636
683
 
637
684
  def lpar_uuid
638
685
  href = singleton("ConnectingPartition", "href")
639
- uuid_from_href(href)
686
+ uuid_from_href(href) unless href.nil?
640
687
  end
641
688
  end
642
689
 
643
690
  # VFC client information
644
691
  class VirtualFibreChannelClientAdapter < VirtualFibreChannelAdapter
645
692
  def nport_loggedin
646
- xml.get_elements("NportLoggedInStatus/VirtualFibreChannelNPortLoginStatus").map do |elem|
647
- VirtualFibreChannelNPortLoginStatus.new(elem)
648
- end
693
+ collection_of("NportLoggedInStatus", "VirtualFibreChannelNPortLoginStatus")
649
694
  end
650
695
 
651
696
  def server
@@ -699,9 +744,7 @@ module IbmPowerHmc
699
744
  }.freeze
700
745
 
701
746
  def pvs
702
- xml.get_elements("PhysicalVolumes/PhysicalVolume").map do |elem|
703
- PhysicalVolume.new(elem)
704
- end
747
+ collection_of("PhysicalVolumes", "PhysicalVolume")
705
748
  end
706
749
  end
707
750
 
@@ -713,15 +756,17 @@ module IbmPowerHmc
713
756
  :tier_capable => "ClusterCapabilities/IsTierCapable"
714
757
  }.freeze
715
758
 
759
+ def repopvs
760
+ collection_of("RepositoryDisk", "PhysicalVolume")
761
+ end
762
+
716
763
  def ssp_uuid
717
764
  href = singleton("ClusterSharedStoragePool", "href")
718
- uuid_from_href(href)
765
+ uuid_from_href(href) unless href.nil?
719
766
  end
720
767
 
721
768
  def nodes
722
- xml.get_elements("Node/Node").map do |elem|
723
- Node.new(elem)
724
- end
769
+ collection_of("Node", "Node")
725
770
  end
726
771
  end
727
772
 
@@ -736,13 +781,14 @@ module IbmPowerHmc
736
781
 
737
782
  def vios_uuid
738
783
  href = singleton("VirtualIOServer", "href")
739
- uuid_from_href(href)
784
+ uuid_from_href(href) unless href.nil?
740
785
  end
741
786
  end
742
787
 
743
788
  # SSP information
744
789
  class SharedStoragePool < AbstractRest
745
790
  ATTRS = {
791
+ :id => "SharedStoragePoolID",
746
792
  :name => "StoragePoolName",
747
793
  :udid => "UniqueDeviceID",
748
794
  :capacity => "Capacity",
@@ -754,13 +800,11 @@ module IbmPowerHmc
754
800
 
755
801
  def cluster_uuid
756
802
  href = singleton("AssociatedCluster", "href")
757
- uuid_from_href(href)
803
+ uuid_from_href(href) unless href.nil?
758
804
  end
759
805
 
760
806
  def pvs
761
- xml.get_elements("PhysicalVolumes/PhysicalVolume").map do |elem|
762
- PhysicalVolume.new(elem)
763
- end
807
+ collection_of("PhysicalVolumes", "PhysicalVolume")
764
808
  end
765
809
 
766
810
  def tiers_uuids
@@ -768,9 +812,7 @@ module IbmPowerHmc
768
812
  end
769
813
 
770
814
  def lus
771
- xml.get_elements("LogicalUnits/LogicalUnit").map do |elem|
772
- LogicalUnit.new(elem)
773
- end
815
+ collection_of("LogicalUnits", "LogicalUnit")
774
816
  end
775
817
  end
776
818
 
@@ -788,7 +830,7 @@ module IbmPowerHmc
788
830
 
789
831
  def ssp_uuid
790
832
  href = singleton("AssociatedSharedStoragePool", "href")
791
- uuid_from_href(href)
833
+ uuid_from_href(href) unless href.nil?
792
834
  end
793
835
 
794
836
  def lus_uuids
@@ -816,16 +858,22 @@ module IbmPowerHmc
816
858
 
817
859
  class PartitionTemplate < AbstractRest
818
860
  ATTRS = {
819
- :name => "partitionTemplateName",
820
- :description => "description",
821
- :os => "logicalPartitionConfig/osVersion",
822
- :memory => "logicalPartitionConfig/memoryConfiguration/currMemory"
861
+ :name => "partitionTemplateName",
862
+ :description => "description",
863
+ :os => "logicalPartitionConfig/osVersion",
864
+ :memory => "logicalPartitionConfig/memoryConfiguration/currMemory",
865
+ :dedicated => "logicalPartitionConfig/processorConfiguration/hasDedicatedProcessors",
866
+ :sharing_mode => "logicalPartitionConfig/processorConfiguration/sharingMode",
867
+ :vprocs => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredVirtualProcessors",
868
+ :proc_units => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredProcessingUnits",
869
+ :procs => "logicalPartitionConfig/processorConfiguration/dedicatedProcessorConfiguration/desiredProcessors"
823
870
  }.freeze
824
871
  end
825
872
 
826
873
  # HMC Event
827
874
  class Event < AbstractRest
828
875
  attr_accessor :usertask
876
+
829
877
  ATTRS = {
830
878
  :id => "EventID",
831
879
  :type => "EventType",
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.5"
5
5
  end
data/lib/ibm_power_hmc.rb CHANGED
File without changes
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.8.0
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM Power
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -24,8 +24,22 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: manageiq-style
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
27
41
  description: A Ruby gem for interacting with the IBM Hardware Management Console (HMC).
28
- email:
42
+ email:
29
43
  executables: []
30
44
  extensions: []
31
45
  extra_rdoc_files: []
@@ -55,7 +69,7 @@ metadata:
55
69
  homepage_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby
56
70
  source_code_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby
57
71
  changelog_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby/blob/master/CHANGELOG.md
58
- post_install_message:
72
+ post_install_message:
59
73
  rdoc_options: []
60
74
  require_paths:
61
75
  - lib
@@ -70,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
84
  - !ruby/object:Gem::Version
71
85
  version: '0'
72
86
  requirements: []
73
- rubygems_version: 3.1.4
74
- signing_key:
87
+ rubygems_version: 3.1.2
88
+ signing_key:
75
89
  specification_version: 4
76
90
  summary: IBM Power HMC Ruby gem.
77
91
  test_files: []