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

Calculate quota using service dialogs overrides. #203

Merged
merged 2 commits into from
Apr 18, 2018

Conversation

billfitzgerald0120
Copy link
Contributor

@billfitzgerald0120 billfitzgerald0120 commented Oct 25, 2017

Changed requested method to use dialog overrides in quota calculations.

Modified requested method to calculate quota based on dialog values for:
number_of_sockets, cores_per_socket, number_of_cpus, vm_memory and storage.

This can be tested by using service dialogs using these values.

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

Testing

Create a service using service dialog overrides values for the above values.
You can use one or more override values.
Order the service, change some values and run.

Note: Latest commit added quota calculations for number_of_vms in a service dialog for Infrastructure.

I am including screenshots of a dialog using some values.
test_dialog 1

test_dialog 2

@billfitzgerald0120
Copy link
Contributor Author

@miq-bot assign @gmcculloug
@miq-bot add_label bug, fine/yes, services

@billfitzgerald0120
Copy link
Contributor Author

@tinaafitz Please review

Changed requested method to use dialog overrides in quota calculations.

Modified requested method to calculate quota based on dialog values for:
number_of_sockets, cores_per_socket, number_of_cpus, vm_memory and storage.

This can be tested by using service dialogs using these values.

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

Testing

Create a service using service dialog overrides values for the above values.
You can use one or more override values.
Order the service, change some values and run.

Note: We are honoring number_of_vms in a service dialog but not using number_of_vms in quota calculations. Doing quota calculations for number_of_vms in a service dialog will be in
a followup PR.

I am including screenshots of a dialog using some values.
@tinaafitz
Copy link
Member

@billfitzgerald0120 Looks good.
@mkanoor Please review.

@billfitzgerald0120
Copy link
Contributor Author

@mkanoor Please review.

@gmcculloug
Copy link
Member

@mkanoor bump


def recalculate_number_of_cpus(resource, override_number_of_sockets, override_cores_per_socket)
$evm.log(:info, "Recalculating the number_of_cpus resource: #{resource} override_number_of_sockets: #{override_number_of_sockets} override_cores_per_socket: #{override_cores_per_socket}")
if override_number_of_sockets.positive? && override_cores_per_socket.positive?
Copy link
Contributor

Choose a reason for hiding this comment

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

@billfitzgerald0120 Is the positive check because a user can enter a negative value or is it to protect from a user not entering any value and it stays nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is to protect from an user not entering a value

@billfitzgerald0120
Copy link
Contributor Author

@tinaafitz Fixed rubocop warning, Please Review

:memory => get_total_requested(options_hash, :vm_memory),
:cpu => get_total_requested(options_hash, :number_of_cpus),
:vms => get_total_requested(options_hash, :number_of_vms)}
@total_vms = get_total_requested(options_hash, :number_of_vms)
Copy link
Contributor

Choose a reason for hiding this comment

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

@billfitzgerald0120
Can we just use a total_vms as a local variable and default it to 1 for reconfigure request if its missing.

…rastructure.

If you specify number_of_vms in a dialog override, the changes will multiple this value by memory, storage and number_of_cpus for quota value.
If you are requesting 1gb of memory, 1gb of storage and 1 cpu and override number_of_vms to 3,
quota will now check for 3gb of memory, 3gb of storage,  3 cpus and 3 vms.

Modified a test and added a new test.
Fixed rubocop warning.
Changed total_vms to a local variable.
@miq-bot
Copy link
Member

miq-bot commented Apr 18, 2018

Checked commits billfitzgerald0120/manageiq-content@53f0acd~...8585d8c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@billfitzgerald0120
Copy link
Contributor Author

@mkanoor Changed total_vms to a local variable, please review.

@mkanoor mkanoor merged commit daf5f50 into ManageIQ:master Apr 18, 2018
@mkanoor mkanoor added this to the Sprint 84 Ending Apr 23, 2018 milestone Apr 18, 2018
@simaishi
Copy link
Contributor

@billfitzgerald0120 https://bugzilla.redhat.com/show_bug.cgi?id=1497912 is already CLOSED/CURRENTRELEASE. Does this PR fix a different BZ?

@tinaafitz
Copy link
Member

@miq-bot add_label gaprindashvili/yes

@simaishi
Copy link
Contributor

simaishi pushed a commit that referenced this pull request May 21, 2018
Calculate quota using service dialogs overrides.
(cherry picked from commit daf5f50)

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

Gaprindashvili backport details:

$ git log -1
commit 3e0fad2df561663e70894ddefffb8ac34fd91c68
Author: Madhu Kanoor <[email protected]>
Date:   Wed Apr 18 15:31:51 2018 -0400

    Merge pull request #203 from billfitzgerald0120/quota_overrides
    
    Calculate quota using service dialogs overrides.
    (cherry picked from commit daf5f5031dbe9b516350ae37a1d5a9f43ad1afa0)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1536677

simaishi pushed a commit that referenced this pull request May 22, 2018
Calculate quota using service dialogs overrides.
(cherry picked from commit daf5f50)

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

Fine backport details:

$ git log -1
commit f9b5e6a4904df2ed5bbe463d3a01c210c63484ea
Author: Madhu Kanoor <[email protected]>
Date:   Wed Apr 18 15:31:51 2018 -0400

    Merge pull request #203 from billfitzgerald0120/quota_overrides
    
    Calculate quota using service dialogs overrides.
    (cherry picked from commit daf5f5031dbe9b516350ae37a1d5a9f43ad1afa0)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1489507

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