Bug 1254211 - when quota exceeds Group Allocated Memory always shows "0.00GB" in last message of request details page
Summary: when quota exceeds Group Allocated Memory always shows "0.00GB" in last messa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.4.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.5.0
Assignee: Tina Fitzgerald
QA Contact: Aziza Karol
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-17 12:44 UTC by Aziza Karol
Modified: 2015-12-08 13:27 UTC (History)
5 users (show)

Fixed In Version: 5.5.0.11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-08 13:27:30 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
request page (78.55 KB, image/png)
2015-08-17 12:44 UTC, Aziza Karol
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2551 0 normal SHIPPED_LIVE Moderate: CFME 5.5.0 bug fixes and enhancement update 2015-12-08 17:58:09 UTC

Description Aziza Karol 2015-08-17 12:44:57 UTC
Created attachment 1063809 [details]
request page

Description of problem:


Version-Release number of selected component (if applicable):
100%

How reproducible:
5.4.1

Steps to Reproduce:
1.create a new domain and copy instances and methods of ProvisionRequestQuotaVerification(ManageIQ/Infrastructure/VM/Provisioning/ StateMachines / ProvisionRequestQuotaVerification) to new domain
2.Edit the instance and add value "1024" for Group - Max Memory Allowed (MB)
3.Provision a VM  with memory "4 GB" so that the quota exceeds and  navigate to services->requests page

Actual results:
Last message displays "Request denied due to the following quota limits:(Group Allocated Memory 0.00GB + Requested 4.00GB > Quota 1.00GB) "

Expected results:
Group allocated memory should be displayed.

Additional info:

Comment 1 Aziza Karol 2015-08-17 12:53:14 UTC
similarly the same issue is observed while provisioning with Max Memory CPU too.
"Request denied due to the following quota limits:(Group Allocated vCPUs 0 + Requested 8 > Quota 2)"

Comment 8 CFME Bot 2015-10-27 03:05:28 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/1250288dd7bc98b8975a4fa264f2fb12addadf66

commit 1250288dd7bc98b8975a4fa264f2fb12addadf66
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Sep 14 11:35:52 2015 -0400
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Fri Oct 23 15:48:27 2015 -0400

    Consolidating quota code to help facilitate resolution for the
    following issues:
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1254211
     when quota exceeds Group Allocated Memory always shows "0.00GB"
     in last message of request details page (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1248747
     service :quota : Provisioning quota for CPU , Memory and Storage
    doesn't work (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1254882
    Provisioning quota for CPU/Mem/Storage doesn't work
    for cloud providers (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1126934
    [RFE] Quota enforcement based on used space (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1249772
    [RFE] Service :quota : Should be able to apply VM quota to service (edit)

 .../default.yaml                                   |   5 +-
 .../default.yaml                                   |   5 +-
 .../CommonMethods/Quota.class/__class__.yaml       | 173 ++++++++
 .../Quota.class/__methods__/validate_quota.rb      | 481 +++++++++++++++++++++
 .../Quota.class/__methods__/validate_quota.yaml    |  12 +
 .../CommonMethods/Quota.class/service_quota.yaml   |  26 ++
 .../System/CommonMethods/Quota.class/test.yaml     |  24 +
 .../System/CommonMethods/Quota.class/vm_quota.yaml |  26 ++
 8 files changed, 750 insertions(+), 2 deletions(-)
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__class__.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__methods__/validate_quota.rb
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__methods__/validate_quota.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/service_quota.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/test.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/vm_quota.yaml

Comment 9 CFME Bot 2015-10-27 03:47:36 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/1250288dd7bc98b8975a4fa264f2fb12addadf66

commit 1250288dd7bc98b8975a4fa264f2fb12addadf66
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Sep 14 11:35:52 2015 -0400
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Fri Oct 23 15:48:27 2015 -0400

    Consolidating quota code to help facilitate resolution for the
    following issues:
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1254211
     when quota exceeds Group Allocated Memory always shows "0.00GB"
     in last message of request details page (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1248747
     service :quota : Provisioning quota for CPU , Memory and Storage
    doesn't work (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1254882
    Provisioning quota for CPU/Mem/Storage doesn't work
    for cloud providers (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1126934
    [RFE] Quota enforcement based on used space (edit)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1249772
    [RFE] Service :quota : Should be able to apply VM quota to service (edit)

 .../default.yaml                                   |   5 +-
 .../default.yaml                                   |   5 +-
 .../CommonMethods/Quota.class/__class__.yaml       | 173 ++++++++
 .../Quota.class/__methods__/validate_quota.rb      | 481 +++++++++++++++++++++
 .../Quota.class/__methods__/validate_quota.yaml    |  12 +
 .../CommonMethods/Quota.class/service_quota.yaml   |  26 ++
 .../System/CommonMethods/Quota.class/test.yaml     |  24 +
 .../System/CommonMethods/Quota.class/vm_quota.yaml |  26 ++
 8 files changed, 750 insertions(+), 2 deletions(-)
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__class__.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__methods__/validate_quota.rb
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/__methods__/validate_quota.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/service_quota.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/test.yaml
 create mode 100644 db/fixtures/ae_datastore/ManageIQ/System/CommonMethods/Quota.class/vm_quota.yaml

Comment 10 CFME Bot 2015-11-17 03:03:37 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=ddee05133f2bc193b3a05e735cddb9a25271b8b9

commit ddee05133f2bc193b3a05e735cddb9a25271b8b9
Merge: ca2014f 1923ca5
Author:     Greg McCullough <gmccullo>
AuthorDate: Mon Nov 16 21:57:28 2015 -0500
Commit:     Greg McCullough <gmccullo>
CommitDate: Mon Nov 16 21:57:28 2015 -0500

    Merge branch 'quota_fixes_cherry_pick' into '5.5.z'
    
    Fix cloud requested values and fixed spec test to reflect changes.
    
    https://github.com/ManageIQ/manageiq/pull/5267
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1254882
    
    Clean cherry-pick.
    
    Also resolves:
    https://bugzilla.redhat.com/show_bug.cgi?id=1248747
    https://bugzilla.redhat.com/show_bug.cgi?id=1254211
    https://bugzilla.redhat.com/show_bug.cgi?id=1126934
    https://bugzilla.redhat.com/show_bug.cgi?id=1273919
    https://bugzilla.redhat.com/show_bug.cgi?id=1263592
    
    See merge request !481

 .../QuotaMethods.class/__methods__/requested.rb    | 155 ++++++++++++++-------
 .../method_validation/calculate_requested_spec.rb  |   2 +-
 2 files changed, 109 insertions(+), 48 deletions(-)

Comment 11 Tina Fitzgerald 2015-11-24 16:46:08 UTC
Hi Aziza,

Since there's several quota issues to be validated, I've made some general quota notes that I'll include in the tickets. 

Can you setup the tenant quota and try your test again? We can add to the notes as we see what is left out or not clear.

Let me know if you have any questions.

Thanks,
Tina 

Quota Changes:

Old Quota:
Groups/users as the quota source.
Quota instance values specify max values for quota items.
Tags can be used to override instance max values.
Vm/Services had separate quota statemachines. 

New Quota:
Tenant is default source for quota. 
Has the ability to use groups/users with an automate method change.
Tenant quota values are not overridden by tag values.
Vm/Services use single common quota statemachine.

For testing purposes:
Setup tenant quota values: (configure/configuration/access control/tenants/tenant quota)
* Clearing all tenant values will cause quotas to pass.
** Can select one, or more quota values. (Allocated number of templates has values in tenant quota, but is not currently used in quota validation)
*** Once the tenant values are set, the tenant quota page will show values for total, in_use, allocated, available. This should help with setting test values for specific use cases.
Create Service items and bundles, if applicable. (both cloud and infrastructure service items/bundles)

Comment 12 Tina Fitzgerald 2015-11-24 17:04:29 UTC
Once the reported issue has been validated, we should revert to the old behavior of using group as the quota source to validate backward compatibility.

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.

Comment 14 Tina Fitzgerald 2015-11-30 17:07:34 UTC
Hi Aziza,

I checked out your appliance and it seems like the reason you're not getting the exceeded message is that you'll need more test data to have the values exceeded.

Here are the values from the log.

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> quota_warning: {:cpu=>0, :memory=>0, :storage=>0, :vms=>0}

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> quota_limits: {:cpu=>2, :memory=>1073741824, :storage=>3221225472}

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> Item: storage Used: (14056244) Requested: (192) Max: (3221225472) Warn: (0)

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> Item: vms Used: (295) Requested: (1) Max: (0) Warn: (0)

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> Item: cpu Used: (515) Requested: (8) Max: (2) Warn: (0)

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> cpu Quota exceeded: Used(515) + Requested(8) > Quota(2)

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> Quota maximum allowed exceeded for key: cpu_quota_exceeded reason: cpu - Used: 515 plus requested: 8 exceeds quota: 2

Q-task_id([miq_provision_request_9]) <AEMethod validate_quota> Item: memory Used: (1014168) Requested: (1024) Max: (1073741824) Warn: (0)

Could you open a separate ticket for issues you encounter using the old group quota source?

Thanks,
Tina

Comment 15 Aziza Karol 2015-12-01 10:37:44 UTC
verified quota validation by setting tenant quota values for cpu, memory,storage and VM's.
Also verified quota validation for Service items and bundles.

All the values are displayed in the last message of request detail page.
For ex cpu:
"Request exceeds maximum allowed for the following: (cpu - Used: 5 plus requested: 8 exceeds quota: 2)"

Verified version:5.5.0.12-rc2.20151124135609_653c0d4 

Group quota enforcement fails.I have open separate ticket and can be tracked in
BZ https://bugzilla.redhat.com/show_bug.cgi?id=1286999

Comment 17 errata-xmlrpc 2015-12-08 13:27:30 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/RHSA-2015:2551


Note You need to log in before you can comment on or make changes to this bug.