Skip to content

Commit

Permalink
Merge pull request #16885 from jerryk55/fix_delete_snap_on_ssa_cancel
Browse files Browse the repository at this point in the history
Fix Deleting Snapshot on Smartstate Cancel
  • Loading branch information
roliveri authored Jan 27, 2018
2 parents ee6cb2d + 08e8b59 commit 4d26ddb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/models/vm_scan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def call_snapshot_delete
(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)
delete_snapshot(mor, vm)
end
rescue => err
_log.error(err.to_s)
Expand Down 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, vm)
end
if vm
inputs = {:vm => vm, :host => vm.host}
Expand Down

0 comments on commit 4d26ddb

Please sign in to comment.