Bug 1392655

Summary: tenant quota can be exceeded by a single VM (if it fits partially in the remaining quota)
Product: Red Hat CloudForms Management Engine Reporter: Reartes Guillermo <greartes>
Component: ProvisioningAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED NOTABUG QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7.0CC: dajohnso, greartes, jhardy, obarenbo, pakotvan
Target Milestone: GA   
Target Release: cfme-future   
Hardware: x86_64   
OS: Linux   
Whiteboard: tenant:quota:provision
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-04 13:50:11 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:
Attachments:
Description Flags
exceeded quota screenshot (the quota will be enforced from now on)
none
screenshot #1, first VM (OK)
none
second VM (ok)
none
VM #3, it surpassed CPU quota
none
support data (DC-MAIN)
none
support data (DC-RHV-Worker-1)
none
VM #4. denied due to quota (OK) none

Description Reartes Guillermo 2016-11-08 01:19:30 UTC
Created attachment 1218331 [details]
exceeded quota screenshot (the quota will be enforced from now on)

CFME: 5.6.2.2

Description of problem:

I have a tenant: DemoCorp.
It has 2 child tenants: DC_Desarrollo, DC_Produccion

Allocated Virtual CPUs               : 3 Count 
Allocated Memory in GB               : 2.0 GB 
Allocated Storage in GB              : 50.0 GB 
Allocated Number of Virtual Machines : 3 

The quotas are enforced, mostly. 
There is an issue with the last approved VM.

If one has 1 cpu, one can use more than one cpu for the last approved VM.
If one has 1 gb, one can consume more than that for the last approved VM.
I did not test this  with the other quota elements.

Actual results:

One has 1gb or 1cpu remaining in the child tenant quota and the service catalog's dialog has:
 * 1,2,4,8 cpus,etc   -> the vm will be provisioned with all those values.
 * 1024,2048,8192,etc -> the vm will be provisioned with all those values.

Expected results:
the vm should ony be provisioned if 1 cpu was selected and 1024mb was selected.

The column for tenant quota "available" will be negative.
No further VMs will be provisioned, since the quota will be enforced.
I did not try manual provisioning from life-cycle button.


How reproducible:
always

Comment 2 Tina Fitzgerald 2017-04-12 19:05:06 UTC
Hi Guillermo,

I'm having trouble reproducing this issue.
Could you setup an environment where I can see the issue?

Thanks,
Tina

Comment 3 Reartes Guillermo 2017-04-12 19:39:21 UTC
Hi,

I updated my test environment to CF 4.2 some time ago. (CF + RHV + aTWR + Sat6).

I will re-test with 4.2. (I do not remember having re-tested with 4.2).

I might be able to setup a 4.1 environment again, but it will take time.

I originally found this on customer environment (on 4.1), but the customer refused to open a support case, so i later reproduced in my test environment and then opened this bz.

> I'm having trouble reproducing this issue.
> Could you setup an environment where I can see the issue?

Are you using 5.6.x or 5.7.x (or other version)?

After i re-test with 4.2 (5.7.x) i will clear the needinfo flag.

Cheers.

Comment 4 Tina Fitzgerald 2017-04-12 20:20:19 UTC
I've been testing on 5.8, but the quota code hasn't changed in a while. 
Testing on 4.2 would be great, thanks.

Comment 5 Reartes Guillermo 2017-04-13 18:09:53 UTC
Hi,

I re-tested with CF 4.2 and reproduced it.
I did change the version to 5.7.x.

I will upload some files in a momment.

Comment 6 Reartes Guillermo 2017-04-13 18:11:41 UTC
Created attachment 1271477 [details]
screenshot #1, first VM (OK)

Comment 7 Reartes Guillermo 2017-04-13 18:12:13 UTC
Created attachment 1271478 [details]
second VM (ok)

Comment 8 Reartes Guillermo 2017-04-13 18:13:25 UTC
Created attachment 1271479 [details]
VM #3, it surpassed CPU quota

Comment 9 Reartes Guillermo 2017-04-13 18:18:41 UTC
Created attachment 1271480 [details]
support data (DC-MAIN)

Comment 10 Reartes Guillermo 2017-04-13 18:19:20 UTC
Created attachment 1271481 [details]
support data (DC-RHV-Worker-1)

Comment 11 Reartes Guillermo 2017-04-13 18:20:19 UTC
Created attachment 1271482 [details]
VM #4. denied due to quota (OK)

Comment 12 Reartes Guillermo 2017-04-13 18:22:17 UTC
Hi,

I finished uploading files.

CFME: 5.7.1.3

I provisioned the first 2 VMs under the quota limit.

Then i provisioned the third one, while i should have been allowed to provision only a single-core vm, i provisioned a quad-core vm.

After that, i tried a fourth and it was denied correctly.

Cheers.

Comment 13 Tina Fitzgerald 2017-04-13 19:30:14 UTC
Thanks for the new information.

Can I access your appliance?

Comment 14 Reartes Guillermo 2017-04-16 12:26:21 UTC
Unfortunately i do not have vpn access. 
The test environment is in my home.

The only thing that i can think off would be a bomgar session and a bj session.
I am not sure if that would require a support case (that would not be a problem).

Cheers.

Comment 15 Tina Fitzgerald 2017-05-11 19:21:28 UTC
Hi Pavol,

I've tested this issue on master and it's working properly.
Could you try to reproduce the issue on 5.7?

Thanks,
Tina

I tried provisioning a single VM with 4 cpu's with only 1 left in sub-tenant quota:
[----] I, [2017-05-11T13:34:01.793339 #8435:3ffe84e413a4]  INFO -- : Q-task_id([miq_provision_request_479]) <AutomationEngine> <AEMethod validate_quota> Quota maximum exceeded for key: cpu_quota_exceeded reason: cpu - Used: 5 plus requested: 4 exceeds quota: 6

Comment 18 Tina Fitzgerald 2017-07-05 13:25:26 UTC
Hi Pavol,

I'm glad to hear that it's working properly on 5.7.

Can we close this ticket?

Thanks,
Tina

Comment 19 Tina Fitzgerald 2017-07-31 17:42:29 UTC
Hi Pavol,

Can we close this ticket?

Thanks,
Tina