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

Change the way active_provisions are calculated. #16831

Merged

Conversation

tinaafitz
Copy link
Member

@tinaafitz tinaafitz commented Jan 16, 2018

The current quota implementation has some limitations regarding the active provision calculations.
Changed the quota_find_active_prov_requests method to use MiqRequests instead of MiqQueue entries for for a more accurate count of active provisions.

We now calculate active provisions based on the following MiqRequests:
approval_state: = approved
request_state = active/queued/pending
type = MiqProvisionRequest/ServiceTemplateProvisionRequest
status = 'Ok'
process = true

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

@gmcculloug
Copy link
Member

@simaishi Note, this is currently a blocker on the Fine release not the initial Gaprindashvili.

@gmcculloug gmcculloug self-assigned this Jan 18, 2018
@tinaafitz tinaafitz force-pushed the active_provisions_using_requests branch from 220978e to 34a83cf Compare January 18, 2018 16:54
@miq-bot
Copy link
Member

miq-bot commented Jan 18, 2018

Checked commit tinaafitz@34a83cf with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 0 offenses detected
Everything looks fine. 🍰

@tinaafitz tinaafitz changed the title [WIP] Change the way active_provisions are calculated. Change the way active_provisions are calculated. Jan 18, 2018
@tinaafitz
Copy link
Member Author

@miq_bot add_labels bug, fine/yes

@miq-bot miq-bot removed the wip label Jan 18, 2018
:request_state => %w(active queued pending),
:status => 'Ok',
:process => true
).where.not(:id => id)
Copy link
Member

Choose a reason for hiding this comment

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

@tinaafitz This is a much clearer solution and almost completely gets the quota logic away from doing lookups in MiqQueue. (One call left in this file)

My one concern is the possibility for false-positive MiqRequest instances being returned. We had that issue before, but it is slightly higher now because in the past clearing a queue would have removed the request from being returned from this method. Now clearing the queue or some other error could leave the request in what looks like a valid state.

Wondering if it makes sense to log a count and list of IDs that are being returned here. Or maybe we create a small script in the tools directory to help users identify what MiqRequest objects are in play for quota.

Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that this is a much clearer solution than the previous MiqQueue lookup logic. Your false-positive concern is valid. While I was testing this changes, I did exactly that and added logging for the count and request ID's being included in the active counts. I'm in favor of the tools/script approach to help users identify the MiqRequest objects in play for quota.

Copy link
Member Author

Choose a reason for hiding this comment

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

A major difference in this approach is that requests will be more likely to be denied based on the active requests, whereas before, the requests would be much more likely to be approved and cause quota to go negative.

Copy link
Member

Choose a reason for hiding this comment

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

Sound good. Please open a git issue for creating that tools script with a reference back to this PR. I think that is a task we can assign to @billfitzgerald0120.

@gmcculloug gmcculloug merged commit ca66301 into ManageIQ:master Jan 19, 2018
@gmcculloug gmcculloug added this to the Sprint 78 Ending Jan 29, 2018 milestone Jan 19, 2018
@simaishi
Copy link
Contributor

@tinaafitz Can you please create a PR for Fine branch? 3 out of 4 files are conflicting and the diff is not small, and not easy to see which line(s) are actually causing the conflicts... Or if I should just take the change from master without worrying about conflicts, let me know!

simaishi pushed a commit that referenced this pull request Jan 19, 2018
…ests

Change the way active_provisions are calculated.
(cherry picked from commit ca66301)

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

Gaprindashvili backport details:

$ git log -1
commit e3afbf863f6d1b63fd8768b35963f8c5c8a8f0de
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Fri Jan 19 16:06:18 2018 -0500

    Merge pull request #16831 from tinaafitz/active_provisions_using_requests
    
    Change the way active_provisions are calculated.
    (cherry picked from commit ca66301eac096b322395629d89ea24e74ca64e0a)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1536677

@simaishi
Copy link
Contributor

Backported to Fine via #16859

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