diff --git a/app/models/vm_scan.rb b/app/models/vm_scan.rb index 217e8124833..a2315bf6728 100644 --- a/app/models/vm_scan.rb +++ b/app/models/vm_scan.rb @@ -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) @@ -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") @@ -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}