Skip to content

Commit

Permalink
Merge pull request #683 from agrare/vm_or_template_destroy_overrides_…
Browse files Browse the repository at this point in the history
…core_active_record_method

VM#destroyed? is overriding a core active_record method

(cherry picked from commit 48b4acb)
  • Loading branch information
jrafanie authored and simaishi committed Jan 5, 2021
1 parent 6337517 commit a166551
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ module ManageIQ::Providers::Vmware::InfraManager::VmOrTemplateShared::Disconnect
def disconnect_storage
# If the VM was unregistered don't clear the storage because the disks
# are still on the underlying datastore
super unless unregistered?
super unless vm_unregistered?
end

def destroyed?
def vm_destroyed?
disconnect_events.last&.event_type == "DestroyVM_Task_Complete"
end

def unregistered?
def vm_unregistered?
disconnect_events.last&.event_type == "UnregisterVM_Complete"
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@

it "deleting a virtual machine" do
vm = ems.vms.find_by(:ems_ref => 'vm-107')
vm.ems_events.create!(:event_type => "DestroyVM_Task_Complete")

expect(vm.archived?).to be_falsy
run_targeted_refresh(targeted_update_set(vm_delete_object_updates))
Expand Down

0 comments on commit a166551

Please sign in to comment.