Bug 1319910

Summary: [RFE] Automate | Quota - Change consolidated quota schema to add quota source attribute.
Product: Red Hat CloudForms Management Engine Reporter: Tina Fitzgerald <tfitzger>
Component: AutomateAssignee: William Fitzgerald <wfitzger>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: low Docs Contact:
Priority: medium    
Version: 5.6.0CC: cpelland, jhardy, kmorey, mfeifer, mkanoor, nstephan, obarenbo, simaishi, ssainkar, tfitzger, wfitzger
Target Milestone: GAKeywords: FutureFeature
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: automate:quota
Fixed In Version: 5.6.0.1 Doc Type: Enhancement
Doc Text:
In the previous version of CloudForms Management Engine, /System/CommonMethods/QuotaMethods quota_source method had code to enable user or group as the quota source instead of the tenant default quota source. It shouldn't be necessary to modify a method to change the quota source. This release added quota_source_type attribute to QuotaStateMachines class.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:44:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tina Fitzgerald 2016-03-21 19:17:59 UTC
Description of problem:
/System/CommonMethods/QuotaMethods quota_source method has code to enable user or group as the quota source instead of the tenant default quota source. It should'nt be necessary to modify a method to change the quota source. 

1. Add an attribute to the class schema called quota_source and set the value to "tenant". 
2. Modify the quota_source method to determine quota source from the attribute instead of being set in the method. 

Steps to Reproduce:
1. Test quota for both "tenant" and "group" quota_sources.
2. Make code changes described above.
3. Repeat step 1.

Actual results:
The results should be identical.

Comment 3 CFME Bot 2016-04-12 14:11:15 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/bdd8102d1ed76a2162283da3f9eaf07c45836d2e

commit bdd8102d1ed76a2162283da3f9eaf07c45836d2e
Author:     william fitzgerald <wfitzger>
AuthorDate: Tue Mar 29 15:16:08 2016 -0400
Commit:     william fitzgerald <wfitzger>
CommitDate: Fri Apr 1 17:06:59 2016 -0400

    Automate - Change consolidated quota schema to add quota source attribute
    
    Added quota_source_type attribute to QuotaStateMachines class
    
    Modified quota_source.rb to determine quota type
    
    Updated quota_source spec
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1319910

 .../QuotaMethods.class/__methods__/quota_source.rb | 20 ++++-----
 .../QuotaStateMachine.class/__class__.yaml         | 48 +++++++++++++++-------
 .../QuotaStateMachine.class/quota.yaml             |  2 +
 .../unit/method_validation/quota_source_spec.rb    | 17 ++++++--
 4 files changed, 58 insertions(+), 29 deletions(-)

Comment 4 Tina Fitzgerald 2016-04-19 18:15:26 UTC
Hi Milan,

Since this commit only changes the way the quota source is updated, the best way to validate it is to look in the automation.log.
The default quota_source is tenant.

To validate:
1. Add tenant quota values <-- Configure/Configuration/Access Control/Tenants
(There has to be at least one value set to run through quota)
2. Provision a VM or Service.
3. Check automation.log for ""Getting Tenant Quota Values for:" string.
4. Change quota_source value to group. <-- /System/CommonMethods/QuotaStateMachine
5. Repeat Step 2.
6. Check automation.log for "Getting Quota Values for Model:" string.
 
Thanks,
Tina

Comment 5 Milan Falešník 2016-05-09 11:52:04 UTC
Verified in 5.6.0.5-beta2.4

With tenant (1000CPU, 1000G):
[root@host vmdb]# tail -fn0 log/automation.log | egrep "Getting Tenant Quota Values for"
[----] I, [2016-05-09T07:22:00.401532 #3113:5b72154]  INFO -- : Q-task_id([miq_provision_request_2]) <AEMethod limits> Getting Tenant Quota Values for: {:cpu=>1000, :memory=>1073741824000}

When changed to group (copied the instance to new domain and changed):
[root@host vmdb]# tail -fn0 log/automation.log | egrep "Getting Quota Values"
[----] I, [2016-05-09T07:49:52.707815 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: max_storage Tag Name: quota_max_storage
[----] I, [2016-05-09T07:49:52.716141 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: warn_storage Tag Name: quota_warn_storage
[----] I, [2016-05-09T07:49:52.720514 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: max_vms Tag Name: quota_max_vms
[----] I, [2016-05-09T07:49:52.725106 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: warn_vms Tag Name: quota_warn_vms
[----] I, [2016-05-09T07:49:52.729498 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: max_cpu Tag Name: quota_max_cpu
[----] I, [2016-05-09T07:49:52.734239 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: warn_cpu Tag Name: quota_warn_cpu
[----] I, [2016-05-09T07:49:52.740821 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: max_memory Tag Name: quota_max_memory
[----] I, [2016-05-09T07:49:52.745382 #3119:ff472c]  INFO -- : Q-task_id([miq_provision_request_5]) <AEMethod limits> Getting Quota Values for Model: warn_memory Tag Name: quota_warn_memory

Discovered https://bugzilla.redhat.com/show_bug.cgi?id=1334318 in the process.

Comment 7 errata-xmlrpc 2016-06-29 15:44:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348