Bug 1286999

Summary: Quota enforcement for group as quota source does not work
Product: Red Hat CloudForms Management Engine Reporter: Aziza Karol <akarol>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED ERRATA QA Contact: Aziza Karol <akarol>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5.0CC: jhardy, mkanoor, obarenbo, tfitzger
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: quota
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1342644 (view as bug list) Environment:
Last Closed: 2016-06-29 15:14:22 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:
Bug Depends On:    
Bug Blocks: 1342644    
Attachments:
Description Flags
snapshot none

Description Aziza Karol 2015-12-01 10:17:22 UTC
Created attachment 1100827 [details]
snapshot

Description of problem:
Testing quota validation when quota source is group fails.

Version-Release number of selected component (if applicable):
5.5.0.12-rc2.20151124135609_653c0d4 

How reproducible:
100%

Steps to Reproduce:
using the automate explorer:
1) Copy the /System/CommonMethods/QuotaMethods/quota_source method to a writable enabled domain.

quota_source method.
1.  #
2.  # Description: Set Tenant as the default quota source.
3.  #
4.  
5.  # Sample code to enable group as the default quota source.
6.  # $evm.root['quota_source'] = @miq_request.requester.current_group
7.  # $evm.root['quota_source_type'] = 'group'
8.
9.  @miq_request = $evm.root['miq_request']
10. $evm.log(:info, "Request: #{@miq_request.description} id: #{@miq_request.id} ")
11.
12. $evm.root['quota_source'] = @miq_request.tenant
13. $evm.root['quota_source_type'] = 'tenant'
14.
15. $evm.log(:info, "Setting Quota Source #{$evm.root['quota_source'].inspect}")

2) Edit the copied quota_source method:
   a. Comment out lines 12 and 13 by placing a "#" at the beginning of the line.
   b. Copy lines 6 and 7 to line 11 and uncomment out lines.(remove the "#") 
3) Validate and save method.
4) Copy the /System/CommonMethods/QuotaStateMachine/Quota instance to a writable enabled domain.
5) Modify the copied Quota instance to set desired quota test values. 
6) Run test(Provision service and/or VMs).
7) Once the test has passed, add tag value(s) to override quota instance value(giving it a different value than the instance).
8) Run test(Provision service and/or VMs). Ensure the tag values have been used in the quota decision.


Actual results:
NameError: undefined local variable or method `quota_max' for main:Object displayed in automation.log
Above error is observed for both while provisioning vm by overriding quota instance value and by tagging also.

The last message in request detail page is always "VM Provisioning - Request Created". see attached screenshot.


Expected results:
Quota enforcement for group as quota source should work

Additional info:
automation.log
[----] E, [2015-12-01T04:43:12.766679 #2968:76213ec] ERROR -- : Q-task_id([miq_provision_request_19]) <AEMethod limits>   NameError: undefined local variable or method `quota_max' for main:Object
[----] E, [2015-12-01T04:43:12.767844 #2968:76213ec] ERROR -- : Q-task_id([miq_provision_request_19]) <AEMethod limits>   <code: quota_max[name.to_sym] = quota_values("max_#{name}", "quota_max_#{name}".to_sym)>:81:in `block in model_and_tag_quota_values'

Have attached the detail logs.

Comment 4 CFME Bot 2015-12-04 21:20:28 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/556ed36b666376521e6a9a2ec86cc9d8de6cae21

commit 556ed36b666376521e6a9a2ec86cc9d8de6cae21
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Wed Dec 2 11:18:06 2015 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Fri Dec 4 13:40:54 2015 -0500

    Fixed issue with group as quota source.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1286999

 .../QuotaMethods.class/__methods__/limits.rb       |  2 ++
 .../method_validation/calculate_limits_spec.rb     | 26 +++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

Comment 5 Aziza Karol 2016-05-06 07:45:06 UTC
Quota enforcement for group as quota source works.

Verified:5.6.0.5-beta2.4.20160503153816_1fb554f

Comment 6 CFME Bot 2016-06-03 21:21:49 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=9252b6d37e3f242c53292c13d48ff65dac00ba61

commit 9252b6d37e3f242c53292c13d48ff65dac00ba61
Merge: a1cd891 9b96d6c
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Jun 3 17:21:35 2016 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Fri Jun 3 17:21:35 2016 -0400

    Merge branch 'cherry_pick_5685' into '5.5.z'
    
    Fixed issue with group as quota source.
    
    Clean cherry-pick.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1342644
    
    Original:
    https://bugzilla.redhat.com/show_bug.cgi?id=1286999
    https://github.com/ManageIQ/manageiq/pull/5685
    
    See merge request !959

 .../QuotaMethods.class/__methods__/limits.rb       |  2 ++
 .../method_validation/calculate_limits_spec.rb     | 26 +++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

Comment 7 CFME Bot 2016-06-03 21:21:53 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=9b96d6cc917e5d1e948c33109427db13101bca77

commit 9b96d6cc917e5d1e948c33109427db13101bca77
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Wed Dec 2 11:18:06 2015 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Fri Jun 3 14:40:21 2016 -0400

    Fixed issue with group as quota source.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1286999

 .../QuotaMethods.class/__methods__/limits.rb       |  2 ++
 .../method_validation/calculate_limits_spec.rb     | 26 +++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

Comment 9 errata-xmlrpc 2016-06-29 15:14:22 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