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

Do not get stuck on destroy #19077

Merged
merged 1 commit into from
Jul 30, 2019
Merged

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Jul 30, 2019

Can not destroy a none-valid EMS.

destroy! calls disable! before destroying the object, disable check for object validity, and do not let us destroy the object.

When destroying the object, we do not care for object validity, we want to remove it from the DB even if it is not valid.

Example

ems = ManageIQ::Providers::Openshift::ContainerManager.first

ems.hostname = nil
ems.default_endpoint.save!

ems:send(disable!)
=> NoMethodError: undefined method `ipaddress?' for nil:NilClass
=> from /home/yzamir/go/src/github.com/ManageIQ/manageiq/app/models/ext_management_system.rb:130:in `hostname_format_valid?'

ems.send(:disable!, :validate => false)
=> true

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1733587

@yaacov
Copy link
Member Author

yaacov commented Jul 30, 2019

@cben @agrare please review

@miq-bot
Copy link
Member

miq-bot commented Jul 30, 2019

Checked commit yaacov@6db56dd with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@agrare agrare self-assigned this Jul 30, 2019
@agrare agrare added the bug label Jul 30, 2019
Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

👍 makes sense thanks @yaacov

@agrare agrare merged commit 6db56dd into ManageIQ:master Jul 30, 2019
agrare added a commit that referenced this pull request Jul 30, 2019
@agrare agrare added this to the Sprint 117 Ending Aug 5, 2019 milestone Jul 30, 2019
@cben
Copy link
Contributor

cben commented Jul 30, 2019

LGTM (we paired on this).

I guess the disable! if enabled? involving a save and thus validation was a regression (of this rare aspect) introduced by orchestrated destroy effort (#14848, #16755 and more).

We tried to also test this with evm:start and actual workers, to see whether other issues from invalid EMS might block the deletion.
But since it had bad auth status, no EMS-specific workers were running, MiqWorker.find_alive... returned zero workers, so "kill workers" stage passed vacuously. This will also probably be the case for users who somehow have an invalid EMS 🤷‍♂️...
Anyway, issues could happen inside workers, but that shouldn't matter as MiqWorker#kill just does kill -9 🔫.

The rest of the associated destroy chains worked fine.
[P.S. unrelated: deleting associated event_streams seems to do inefficient 1+N 🐌]

@simaishi
Copy link
Contributor

simaishi commented Aug 6, 2019

@yaacov ivanchuk/yes?

@yaacov
Copy link
Member Author

yaacov commented Aug 6, 2019

https://bugzilla.redhat.com/show_bug.cgi?id=1733587

BZ target is 5.10.z

@simaishi
Copy link
Contributor

simaishi commented Aug 6, 2019

Which means it should be ivanchuk/yes and hammer/yes if this PR can be backported as is.

@yaacov
Copy link
Member Author

yaacov commented Aug 6, 2019

IMHO It can be safely backported

@agrare
Copy link
Member

agrare commented Aug 6, 2019

ACK safe to backport

@simaishi
Copy link
Contributor

simaishi commented Aug 6, 2019

Thank you both 😄

simaishi pushed a commit that referenced this pull request Aug 6, 2019
@simaishi
Copy link
Contributor

simaishi commented Aug 6, 2019

Ivanchuk backport details:

$ git log -1
commit 1dd63780d70590671376547848420d53999e80d6
Author: Adam Grare <agrare@redhat.com>
Date:   Tue Jul 30 09:20:52 2019 -0400

    Merge pull request #19077 from yaacov/do-not-get-stuck-on-destroy
    
    Do not get stuck on destroy
    
    (cherry picked from commit 23750927bd53c88c249dd0c7f0abc0bc2155afaf)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1733587

simaishi pushed a commit that referenced this pull request Oct 21, 2019
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit 1b32f43f4b464772d4abfb4b089f4c36466bc41b
Author: Adam Grare <agrare@redhat.com>
Date:   Tue Jul 30 09:20:52 2019 -0400

    Merge pull request #19077 from yaacov/do-not-get-stuck-on-destroy
    
    Do not get stuck on destroy
    
    (cherry picked from commit 23750927bd53c88c249dd0c7f0abc0bc2155afaf)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1763857

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.

5 participants