Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement raw_destroy for LPARs #127

Merged
merged 4 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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