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

Fix Deleting Snapshot on Smartstate Cancel #16885

Merged
merged 5 commits into from
Jan 27, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/models/vm_scan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,14 @@ def delete_snapshot(mor, vm = nil)
delete_snapshot_by_description(mor, vm)
else
user_event = end_user_event_message(vm, false)
vm.ext_management_system.vm_remove_snapshot(vm, :snMor => mor, :user_event => user_event)
if vm.kind_of?(ManageIQ::Providers::Openstack::CloudManager::Vm)
vm.ext_management_system.vm_delete_evm_snapshot(vm, mor)
elsif vm.kind_of?(ManageIQ::Providers::Microsoft::InfraManager::Vm) ||
(vm.kind_of?(ManageIQ::Providers::Azure::CloudManager::Vm) && vm.require_snapshot_for_scan?)
vm.ext_management_system.vm_delete_evm_snapshot(vm, :snMor => mor)
else
vm.ext_management_system.vm_remove_snapshot(vm, :snMor => mor, :user_event => user_event)
end
end
else
raise _("No Providers available to delete snapshot")
Expand Down Expand Up @@ -498,14 +505,7 @@ def process_abort(*args)
mor = context[:snapshot_mor]
context[:snapshot_mor] = nil
set_status("Deleting snapshot before aborting job")
if vm.kind_of?(ManageIQ::Providers::Openstack::CloudManager::Vm)
vm.ext_management_system.vm_delete_evm_snapshot(vm, mor)
elsif vm.kind_of?(ManageIQ::Providers::Microsoft::InfraManager::Vm) ||
(vm.kind_of?(ManageIQ::Providers::Azure::CloudManager::Vm) && vm.require_snapshot_for_scan?)
vm.ext_management_system.vm_delete_evm_snapshot(vm, :snMor => mor)
else
delete_snapshot(mor)
end
delete_snapshot(mor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the vm so delete_snapshot won't have to look it up again:

delete_snapshot(mor, vm)

end
if vm
inputs = {:vm => vm, :host => vm.host}
Expand Down