-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from VojkoR/destroy_vm_for_vmware_provider
Added support for VM delete (cherry picked from commit 1dfa303) https://bugzilla.redhat.com/show_bug.cgi?id=1552683
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/models/manageiq/providers/vmware/cloud_manager/vm/operations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
module ManageIQ::Providers::Vmware::CloudManager::Vm::Operations | ||
extend ActiveSupport::Concern | ||
|
||
include_concern 'Power' | ||
|
||
included do | ||
supports :terminate do | ||
unsupported_reason_add(:terminate, "The VM is powered on") unless current_state == "off" | ||
end | ||
end | ||
|
||
def raw_destroy | ||
raise "VM has no #{ui_lookup(:table => "ext_management_systems")}, unable to destroy VM" unless ext_management_system | ||
ext_management_system.with_provider_connection do |service| | ||
response = service.delete_vapp(ems_ref) | ||
service.process_task(response.body) | ||
end | ||
update_attributes!(:raw_power_state => "off") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters