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 Vm#supports_terminate? checking EMS#vm_destroy #20222

Merged
merged 1 commit into from
May 29, 2020

Conversation

agrare
Copy link
Member

@agrare agrare commented May 28, 2020

@chessbyte
Copy link
Member

I think this PR needs a cross-repo test with all the providers.

@agrare
Copy link
Member Author

agrare commented May 28, 2020

This is going to take some rework because since the #vm_destroy and #raw_destroy methods are defined at the base class we can no longer use #respond_to? to indicate if the object supports terminate or not.

We need to move this closer to the rest of the supports feature calls where the supports :terminate block is defined on the provider model class not in core.

@agrare agrare changed the title Fix Vm#supports_terminate? checking EMS#vm_destroy [WIP] Fix Vm#supports_terminate? checking EMS#vm_destroy May 28, 2020
@miq-bot miq-bot added the wip label May 28, 2020
@agrare agrare force-pushed the fix_vm_supports_terminate branch from 44abd09 to d33b685 Compare May 28, 2020 20:10
context "#supports_terminate?" do
let(:ems_does_vm_destroy) { FactoryBot.create(:ems_vmware) }
let(:ems_doesnot_vm_destroy) { FactoryBot.create(:ems_storage) }
context "#supports_control?" do
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of these were actually testing supports_control?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@agrare agrare May 29, 2020

Choose a reason for hiding this comment

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

It is still an internal helper method used all over the place, e.g.: https://github.com/ManageIQ/manageiq-providers-vmware/blob/master/app/models/manageiq/providers/vmware/infra_manager/vm/operations/guest.rb#L6

The purpose of this PR isn't to refactor supports_control

@agrare agrare changed the title [WIP] Fix Vm#supports_terminate? checking EMS#vm_destroy Fix Vm#supports_terminate? checking EMS#vm_destroy May 29, 2020
@agrare agrare removed the wip label May 29, 2020
@agrare agrare force-pushed the fix_vm_supports_terminate branch from d33b685 to 3b7dd5d Compare May 29, 2020 13:16
@agrare
Copy link
Member Author

agrare commented May 29, 2020

Cross repo tests are green except for an unrelated error: https://travis-ci.com/github/ManageIQ/manageiq-cross_repo-tests/jobs/341417657#L2392-L2423

This occurs if all plugins that bring extra content/miq_dialogs are overridden causing their path to be different from what that spec is expecting.

@Fryguy
Copy link
Member

Fryguy commented May 29, 2020

unrelated error is fixed in #20225

We removed the redundant EMS#vm_destroy methods which just called
VM#raw_destroy for all providers except VMware.  The supports_feature
block however was still checking if the EMS respond_to?(:vm_destroy)
rather than checking if the vm object responds to it.
@agrare agrare force-pushed the fix_vm_supports_terminate branch from 3b7dd5d to 6a2602e Compare May 29, 2020 15:11
@miq-bot
Copy link
Member

miq-bot commented May 29, 2020

Checked commit agrare@6a2602e with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@chessbyte chessbyte merged commit 74d620c into ManageIQ:master May 29, 2020
@agrare agrare deleted the fix_vm_supports_terminate branch May 29, 2020 16:30
simaishi pushed a commit that referenced this pull request May 29, 2020
Fix Vm#supports_terminate? checking EMS#vm_destroy

(cherry picked from commit 74d620c)
@simaishi
Copy link
Contributor

Jansa backport details:

$ git log -1
commit b6788f9cd21ec370797263035af0e9b06fecadb6
Author: Oleg Barenboim <chessbyte@gmail.com>
Date:   Fri May 29 12:29:23 2020 -0400

    Merge pull request #20222 from agrare/fix_vm_supports_terminate

    Fix Vm#supports_terminate? checking EMS#vm_destroy

    (cherry picked from commit 74d620c2016d2264f4463841c07d9b4a21426f0c)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants