Skip to content

Commit e2a8fd2

Browse files
authored
Merge pull request #127 from dberg1/destroy
implement raw_destroy for LPARs
2 parents 2bd9aa8 + 0d9863d commit e2a8fd2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app/models/manageiq/providers/ibm_power_hmc/infra_manager/lpar.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ class ManageIQ::Providers::IbmPowerHmc::InfraManager::Lpar < ManageIQ::Providers
55

66
supports :reconfigure_network_adapters
77

8+
supports :terminate do
9+
unsupported_reason_add(:terminate, unsupported_reason(:control)) unless supports_control?
10+
unsupported_reason_add(:terminate, _("Cannot delete a running partition")) unless power_state == "off"
11+
end
12+
813
def provider_object(connection = nil)
914
connection ||= ext_management_system.connect
1015
connection.lpar(ems_ref)
@@ -32,6 +37,16 @@ def poweroff(params = {})
3237
end
3338
end
3439

40+
def raw_destroy
41+
ext_management_system.with_provider_connection do |connection|
42+
# Delete LPAR and associated VIOS VSCSI and VFC server adapters.
43+
connection.lpar_delete(ems_ref, :delete_vios_mappings => true)
44+
rescue IbmPowerHmc::Connection::HttpError => e
45+
$ibm_power_hmc_log.error("error deleting LPAR #{ems_ref}: #{e}")
46+
raise
47+
end
48+
end
49+
3550
def do_request(request_type, options)
3651
case request_type
3752
when 'clone_to_template'

manageiq-providers-ibm_power_hmc.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
1919
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2020
spec.require_paths = ["lib"]
2121

22-
spec.add_dependency "ibm_power_hmc", "~> 0.24.0"
22+
spec.add_dependency "ibm_power_hmc", "~> 0.25.0"
2323

2424
spec.add_development_dependency "manageiq-style"
2525
spec.add_development_dependency "simplecov", ">= 0.21.2"

0 commit comments

Comments
 (0)