Bug 1317698

Summary: Automate | Quota runs twice for service provisioning.
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: high Docs Contact:
Priority: high    
Version: 5.6.0CC: jhardy, mkanoor, obarenbo, tfitzger
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: automate:service:provision
Fixed In Version: 5.6.0.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:42:40 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:

Description Tina Fitzgerald 2016-03-14 22:17:25 UTC
Description of problem: Quota check done twice during service provisioning.  

Both /System/Policy/ServiceTemplateProvisionRequest_starting and
/Service/Provisioning/StateMachines/ServiceProvisionRequestApproval/Default instances call quota. 
Quota should be removed from the ServiceProvisionRequestApproval instance.  

/System/Policy:
ServiceTemplateProvisionRequest_created - Calls the auto-approval state machine.
ServiceTemplateProvisionRequest_approved - Sends the approval emails.
ServiceTemplateProvisionRequest_starting - Does quota check.


Steps to Reproduce:
1. Provision a service.
2. Check the automation.log to see both quota checks, one for ServiceTemplateProvisionRequest_created, and ServiceTemplateProvisionRequest_starting.


Actual results:
Quota executed twice. 

Expected results:
Quota executed once. 


Additional info:

Comment 3 CFME Bot 2016-03-28 20:50:42 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/86855b499a503a43a0506a0f633a9b5c5052f69b

commit 86855b499a503a43a0506a0f633a9b5c5052f69b
Author:     william fitzgerald <wfitzger>
AuthorDate: Thu Mar 17 14:15:06 2016 -0400
Commit:     william fitzgerald <wfitzger>
CommitDate: Thu Mar 17 14:16:19 2016 -0400

    Automate - Fixed quota running twice in service provisioning
    
    Removed quota from the ServiceProvisionRequestApproval instance
    
    Modified ServiceProvisionRequestApproval.class/default.yaml
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1317698

 .../StateMachines/ServiceProvisionRequestApproval.class/default.yaml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comment 6 Tina Fitzgerald 2016-04-19 18:22:53 UTC
Hi Milan,

I can't tell from the log snippet because there's no reference to quota.

You should see this string only once per service provision and it should be during the ServiceTemplateProvisionRequest_starting processing:
 
"Getting Tenant Quota Values for:"

Thanks,
Tina

Comment 7 Milan Falešník 2016-04-22 14:00:38 UTC
It seems that that is correct:

[----] I, [2016-04-22T09:54:03.293420 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Following Relationship [miqaedb:/System/Policy/ServiceTemplateProvisionRequest_starting#create]
[----] I, [2016-04-22T09:54:03.299149 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [miqaedb:/System/Policy/ServiceTemplateProvisionRequest_starting#create  ManageIQ/System]
[----] I, [2016-04-22T09:54:03.311689 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Following Relationship [miqaedb:/System/CommonMethods/QuotaStatemachine/quota#create]
[----] I, [2016-04-22T09:54:03.332753 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [miqaedb:/System/CommonMethods/QuotaStatemachine/quota#create  ManageIQ/System/CommonMethods]
[----] I, [2016-04-22T09:54:03.379301 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Processing State=[quota_source]
[----] I, [2016-04-22T09:54:03.379654 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Following Relationship [miqaedb:/System/CommonMethods/QuotaMethods/quota_source#create]
[----] I, [2016-04-22T09:54:03.393474 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [miqaedb:/System/CommonMethods/QuotaMethods/quota_source#create  ManageIQ/System/CommonMethods]
[----] I, [2016-04-22T09:54:03.411676 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [System/CommonMethods/QuotaMethods/quota_source  ManageIQ/System/CommonMethods]
[----] I, [2016-04-22T09:54:03.421318 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Invoking [inline] method [/ManageIQ/System/CommonMethods/QuotaMethods/quota_source] with inputs [{}]
[----] I, [2016-04-22T09:54:03.422462 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/quota_source]> Starting 
[----] I, [2016-04-22T09:54:04.493016 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/quota_source]> Ending
[----] I, [2016-04-22T09:54:04.493172 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Method exited with rc=MIQ_OK
[----] I, [2016-04-22T09:54:04.493660 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Followed  Relationship [miqaedb:/System/CommonMethods/QuotaMethods/quota_source#create]
[----] I, [2016-04-22T09:54:04.493872 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Processed  State=[quota_source] with Result=[ok]
[----] I, [2016-04-22T09:54:04.494016 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Processed State =[quota_source]
[----] I, [2016-04-22T09:54:04.494413 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Next State=[limits]
[----] I, [2016-04-22T09:54:04.494862 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Processing State=[limits]
[----] I, [2016-04-22T09:54:04.495183 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Following Relationship [miqaedb:/System/CommonMethods/QuotaMethods/limits#create]
[----] I, [2016-04-22T09:54:04.505405 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [miqaedb:/System/CommonMethods/QuotaMethods/limits#create  ManageIQ/System/CommonMethods]
[----] I, [2016-04-22T09:54:04.521812 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Updated namespace [System/CommonMethods/QuotaMethods/limits  ManageIQ/System/CommonMethods]
[----] I, [2016-04-22T09:54:04.533858 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Invoking [inline] method [/ManageIQ/System/CommonMethods/QuotaMethods/limits] with inputs [{}]
[----] I, [2016-04-22T09:54:04.535290 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/limits]> Starting 
[----] I, [2016-04-22T09:54:05.315108 #12462:104ff64]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod limits> Getting Tenant Quota Values for: {}
[----] I, [2016-04-22T09:54:05.318952 #12462:104ff64]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod limits> No Quota limits set. No quota check being done.
[----] I, [2016-04-22T09:54:05.360690 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) <AEMethod [/ManageIQ/System/CommonMethods/QuotaMethods/limits]> Ending
[----] I, [2016-04-22T09:54:05.360808 #12462:b47990]  INFO -- : Q-task_id([service_template_provision_request_1]) Method exited with rc=MIQ_OK

That was the only occurence of this string in 5.6.0.4-beta2.3, so verified then.

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