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

Create a task when destroying an ems #16669

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Dec 14, 2017

When queueing a destroy on an EMS create a task and return the ID to be
used by the caller to track when the destroy is complete.

Task page while destroy is running:

screenshot from 2017-12-15 09-35-05

Task after destroy completes:
screenshot from 2017-12-15 09-35-51

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

@agrare
Copy link
Member Author

agrare commented Dec 14, 2017

cc @blomquisg

)
end

# Wait until all associated workers are dead to destroy this ems
def orchestrate_destroy
def orchestrate_destroy(task_id)
disable! if enabled?

if self.destroy == false
_log.info("Cannot destroy #{self.class.name} with id: #{id}, workers still in progress. Requeuing destroy...")
self.class.schedule_destroy_queue(id, 15.seconds.from_now)
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this have to change since you changed the signature of schedule_destroy_queue ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, done

expect(described_class).to receive(:schedule_destroy_queue).with(ems.id)
expect(described_class).to receive(:schedule_destroy_queue).with(child_manager.id)
expect(described_class).to receive(:schedule_destroy_queue).with(ems.id, Integer)
expect(described_class).to receive(:schedule_destroy_queue).with(child_manager.id, Integer)
Copy link
Member

Choose a reason for hiding this comment

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

I think you also need a test for rescheduling a destroy.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 will 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.

Done

@agrare agrare force-pushed the bz_1525498_create_task_when_deleting_provider branch 6 times, most recently from a3b6ed2 to 1e0a9e2 Compare December 14, 2017 19:49
@agrare agrare force-pushed the bz_1525498_create_task_when_deleting_provider branch from 1e0a9e2 to da3d5f4 Compare December 18, 2017 14:20
When queueing a destroy on an EMS create a task and return the ID to be
used by the caller to track when the destroy is complete.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1525498
@agrare agrare force-pushed the bz_1525498_create_task_when_deleting_provider branch from da3d5f4 to d74ee55 Compare December 19, 2017 13:22
@agrare
Copy link
Member Author

agrare commented Dec 19, 2017

@blomquisg @Fryguy PTAL

Copy link
Member

@blomquisg blomquisg left a comment

Choose a reason for hiding this comment

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

I'm gonna let @Fryguy merge since he already had other comments. Wanna give him the chance to double-verify.

@chessbyte chessbyte assigned Fryguy and unassigned blomquisg Dec 20, 2017
expect(described_class).to receive(:schedule_destroy_queue).with(ems.id)
expect(described_class).to receive(:schedule_destroy_queue).with(child_manager.id)
described_class.destroy_queue(ems.id)
def deliver_queue_message(queue_message = MiqQueue.first)
Copy link
Member

@Fryguy Fryguy Dec 20, 2017

Choose a reason for hiding this comment

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

This can lead to sproadic test failures if there are multiple queue items, because .first is not guranteed to return in a particular order...prefer MiqQueue.order(:id).first

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 done

@miq-bot
Copy link
Member

miq-bot commented Dec 20, 2017

Checked commits agrare/manageiq@b9309e7~...fbd94fe with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@Fryguy Fryguy merged commit 2b27e62 into ManageIQ:master Dec 20, 2017
@Fryguy Fryguy added this to the Sprint 76 Ending Jan 1, 2018 milestone Dec 20, 2017
@agrare agrare deleted the bz_1525498_create_task_when_deleting_provider branch December 20, 2017 20:29
simaishi pushed a commit that referenced this pull request Jan 3, 2018
…eting_provider

Create a task when destroying an ems
(cherry picked from commit 2b27e62)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1530646
@simaishi
Copy link
Contributor

simaishi commented Jan 3, 2018

Gaprindashvili backport details:

$ git log -1
commit c9e917306c3522397d9acc2390ec9c219cb9c7bf
Author: Jason Frey <[email protected]>
Date:   Wed Dec 20 15:28:44 2017 -0500

    Merge pull request #16669 from agrare/bz_1525498_create_task_when_deleting_provider
    
    Create a task when destroying an ems
    (cherry picked from commit 2b27e62949a27b4620c69197b29a6b17c7cede72)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1530646

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