ibm_power_hmc 0.24.0 → 0.26.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: fa2829db70216f23c73d2d06e8daebdbc2be4f3bde1f8f17d2659961288caa19
4
- data.tar.gz: cb7a7cabacbf9efffe013715af8b0e4c5cc4fdf6b941cd0ef42cc8d19861fea5
3
+ metadata.gz: e75f7e7bf5e426587dfa371387022269f3c85cbb1171834ca3f3e03615b72304
4
+ data.tar.gz: 95b42724c9a74b22b15d373dfe3612579e3051e93d14942de008f49c739af7be
5
5
  SHA512:
6
- metadata.gz: 390b00cf4dd7f4fd83ef4c8619d25274f3b708fe5bdc075eef77b8bd7f199875b2003cbc203ecdf3adbee4518a8905bd59003bd238a7c81033504e0763971943
7
- data.tar.gz: 7fee8e0a80ce4b266b27469706e00dd8804a5f706a272301751680bc660bf04d6398583c8268a0b8e28176da6e4f96c161b22f4d71813c4b1b101c6c5872fa5a
6
+ metadata.gz: 393e7ad9f7cdd73acfc7c5d6fbe1b9ae5370653cba840c8e402382a6dd365561f45241b8ef73a29087518367844e2ce7c602678129c8539020050bd8beebf908
7
+ data.tar.gz: 6fa263b9ba33562ff2d489c240d1fa1965ccc34f9d756a2e65b06611a35a247185e641067e11f6349e2df659998ef63663ee66a0251df4eacef99ea25ea0f4d0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.26.0
2
+ * Fix REXML::Document.new("") raising an exception
3
+ ## v0.25.0
4
+ * Add `vios_uuid` as alias to `lpar_uuid` for VFC schema definition
5
+ * Add `lpar_delete_vios_mappings` util method
6
+ * Add option to `lpar_delete` to delete associated VIOS VSCSI/VFC mappings
1
7
  ## v0.24.0
2
8
  * Add schema methods to modify VSCSI and VFC mappings
3
9
  * Add schema definition for IOSlot
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in ibm_power_hmc.gemspec
4
4
  gemspec
5
-
6
- gem "rake", "~> 12.0"
data/README.md CHANGED
@@ -53,8 +53,8 @@ Listing the logical partitions and virtual I/O servers of each managed system:
53
53
  ```ruby
54
54
  hc.managed_systems.each do |sys|
55
55
  puts sys.name
56
- hc.lpars(sys.uuid).each { |lpar| puts lpar.name }
57
- hc.vioses(sys.uuid).each { |vios| puts vios.name }
56
+ hc.lpars(sys.uuid).collect(&:name)
57
+ hc.vioses(sys.uuid).collect(&:name)
58
58
  end
59
59
  ```
60
60
 
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "rest-client", "~> 2.1"
30
30
 
31
31
  spec.add_development_dependency "manageiq-style", "~> 1.3"
32
+ spec.add_development_dependency "rake", "~> 13.0"
32
33
  end
@@ -38,7 +38,7 @@ module IbmPowerHmc
38
38
  headers = {
39
39
  :content_type => "application/vnd.ibm.powervm.web+xml; type=LogonRequest"
40
40
  }
41
- doc = REXML::Document.new("")
41
+ doc = REXML::Document.new(nil)
42
42
  doc.add_element("LogonRequest", "schemaVersion" => "V1_1_0")
43
43
  doc.root.add_namespace(WEB_XMLNS)
44
44
  doc.root.add_element("UserID").text = @username
@@ -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
- def lpar_delete(lpar_uuid)
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,7 +94,7 @@ module IbmPowerHmc
94
94
  # @param namespace [String] The XML namespace to use.
95
95
  # @param version [String] The XML schema version to use.
96
96
  def self.marshal(attrs = {}, namespace = UOM_XMLNS, version = "V1_1_0")
97
- doc = REXML::Document.new("")
97
+ doc = REXML::Document.new(nil)
98
98
  doc.add_element(name.split("::").last, "schemaVersion" => version)
99
99
  doc.root.add_namespace(namespace)
100
100
  obj = new(doc.root)
@@ -843,6 +843,8 @@ module IbmPowerHmc
843
843
 
844
844
  # VFC client information
845
845
  class VirtualFibreChannelClientAdapter < VirtualFibreChannelAdapter
846
+ alias vios_uuid lpar_uuid
847
+
846
848
  def nport_loggedin
847
849
  collection_of("NportLoggedInStatus", "VirtualFibreChannelNPortLoginStatus")
848
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbmPowerHmc
4
- VERSION = "0.24.0"
4
+ VERSION = "0.26.0"
5
5
  end
data/lib/ibm_power_hmc.rb CHANGED
@@ -19,4 +19,5 @@ module IbmPowerHmc
19
19
  require_relative "./ibm_power_hmc/schema/sem"
20
20
  require_relative "./ibm_power_hmc/schema/templates"
21
21
  require_relative "./ibm_power_hmc/schema/uom"
22
+ require_relative "./ibm_power_hmc/utils"
22
23
  end
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ]
6
+ }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_power_hmc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM Power
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-11-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rest-client
@@ -38,8 +37,21 @@ dependencies:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
39
  version: '1.3'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rake
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '13.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
41
54
  description: A Ruby gem for interacting with the IBM Hardware Management Console (HMC).
42
- email:
43
55
  executables: []
44
56
  extensions: []
45
57
  extra_rdoc_files: []
@@ -68,7 +80,9 @@ files:
68
80
  - lib/ibm_power_hmc/schema/sem.rb
69
81
  - lib/ibm_power_hmc/schema/templates.rb
70
82
  - lib/ibm_power_hmc/schema/uom.rb
83
+ - lib/ibm_power_hmc/utils.rb
71
84
  - lib/ibm_power_hmc/version.rb
85
+ - renovate.json
72
86
  homepage: http://github.com/IBM/ibm_power_hmc_sdk_ruby
73
87
  licenses:
74
88
  - Apache-2.0
@@ -77,7 +91,6 @@ metadata:
77
91
  homepage_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby
78
92
  source_code_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby
79
93
  changelog_uri: http://github.com/IBM/ibm_power_hmc_sdk_ruby/blob/master/CHANGELOG.md
80
- post_install_message:
81
94
  rdoc_options: []
82
95
  require_paths:
83
96
  - lib
@@ -92,8 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
105
  - !ruby/object:Gem::Version
93
106
  version: '0'
94
107
  requirements: []
95
- rubygems_version: 3.1.4
96
- signing_key:
108
+ rubygems_version: 3.6.7
97
109
  specification_version: 4
98
110
  summary: IBM Power HMC Ruby gem.
99
111
  test_files: []