Skip to content

Commit

Permalink
Merge pull request #127 from dberg1/destroy
Browse files Browse the repository at this point in the history
implement raw_destroy for LPARs
  • Loading branch information
agrare committed Dec 2, 2022
2 parents 2bd9aa8 + 0d9863d commit e2a8fd2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/models/manageiq/providers/ibm_power_hmc/infra_manager/lpar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ class ManageIQ::Providers::IbmPowerHmc::InfraManager::Lpar < ManageIQ::Providers

supports :reconfigure_network_adapters

supports :terminate do
unsupported_reason_add(:terminate, unsupported_reason(:control)) unless supports_control?
unsupported_reason_add(:terminate, _("Cannot delete a running partition")) unless power_state == "off"
end

def provider_object(connection = nil)
connection ||= ext_management_system.connect
connection.lpar(ems_ref)
Expand Down Expand Up @@ -32,6 +37,16 @@ def poweroff(params = {})
end
end

def raw_destroy
ext_management_system.with_provider_connection do |connection|
# Delete LPAR and associated VIOS VSCSI and VFC server adapters.
connection.lpar_delete(ems_ref, :delete_vios_mappings => true)
rescue IbmPowerHmc::Connection::HttpError => e
$ibm_power_hmc_log.error("error deleting LPAR #{ems_ref}: #{e}")
raise
end
end

def do_request(request_type, options)
case request_type
when 'clone_to_template'
Expand Down
2 changes: 1 addition & 1 deletion manageiq-providers-ibm_power_hmc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "ibm_power_hmc", "~> 0.24.0"
spec.add_dependency "ibm_power_hmc", "~> 0.25.0"

spec.add_development_dependency "manageiq-style"
spec.add_development_dependency "simplecov", ">= 0.21.2"
Expand Down

0 comments on commit e2a8fd2

Please sign in to comment.