ibm_power_hmc 0.24.0 → 0.25.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: fa2829db70216f23c73d2d06e8daebdbc2be4f3bde1f8f17d2659961288caa19
4
- data.tar.gz: cb7a7cabacbf9efffe013715af8b0e4c5cc4fdf6b941cd0ef42cc8d19861fea5
3
+ metadata.gz: b15e5d3ed25c9329a63b1655da54869b5f0a979f7775149209648d86a0fa67ad
4
+ data.tar.gz: c1c78e4c661ef6c90ea743245b3e5c29777e7ab51e276a088ca9206d814b99ce
5
5
  SHA512:
6
- metadata.gz: 390b00cf4dd7f4fd83ef4c8619d25274f3b708fe5bdc075eef77b8bd7f199875b2003cbc203ecdf3adbee4518a8905bd59003bd238a7c81033504e0763971943
7
- data.tar.gz: 7fee8e0a80ce4b266b27469706e00dd8804a5f706a272301751680bc660bf04d6398583c8268a0b8e28176da6e4f96c161b22f4d71813c4b1b101c6c5872fa5a
6
+ metadata.gz: 379f4c199e6c5a818617608060d98fe75413856b588760a6c0a2a946002858d7df52ce2b86ba54a4af9a2de3b61391828d3fbca4457dae93319c37cc2813bec9
7
+ data.tar.gz: 5299f74322afac43f91af2a131b5fb1521fc0f3ca3ed87106405006ef181eaa9d776b80e1501f13dabdbdee9630ba3868a47b0839ba88458f88b2782ed43623b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.25.0
2
+ * Add `vios_uuid` as alias to `lpar_uuid` for VFC schema definition
3
+ * Add `lpar_delete_vios_mappings` util method
4
+ * Add option to `lpar_delete` to delete associated VIOS VSCSI/VFC mappings
1
5
  ## v0.24.0
2
6
  * Add schema methods to modify VSCSI and VFC mappings
3
7
  * Add schema definition for IOSlot
@@ -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
@@ -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.25.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
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.24.0
4
+ version: 0.25.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-25 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -68,6 +68,7 @@ files:
68
68
  - lib/ibm_power_hmc/schema/sem.rb
69
69
  - lib/ibm_power_hmc/schema/templates.rb
70
70
  - lib/ibm_power_hmc/schema/uom.rb
71
+ - lib/ibm_power_hmc/utils.rb
71
72
  - lib/ibm_power_hmc/version.rb
72
73
  homepage: http://github.com/IBM/ibm_power_hmc_sdk_ruby
73
74
  licenses: