Bug 1531914 - Quota fails when an active Service request contains an Invalid service_template.
Summary: Quota fails when an active Service request contains an Invalid service_template.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: GA
: 5.10.0
Assignee: Tina Fitzgerald
QA Contact: Ganesh Hubale
URL:
Whiteboard:
Depends On:
Blocks: 1533217 1534589
TreeView+ depends on / blocked
 
Reported: 2018-01-06 16:52 UTC by Saif Ali
Modified: 2021-03-11 16:50 UTC (History)
11 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1533217 1534589 (view as bug list)
Environment:
Last Closed: 2018-06-21 20:46:14 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
active_service_request.rb (1.03 KB, text/plain)
2018-01-06 20:04 UTC, Greg McCullough
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3312341 0 None None None 2018-01-08 16:08:31 UTC

Description Saif Ali 2018-01-06 16:52:27 UTC
Description of problem:
Provisioning request fail with quota error

[----] E, [2018-01-06T11:11:20.073924 #13027:e0ffc4] ERROR -- : Q-task_id([miq_provision_787]) MiqAeServiceModelBase.ar_method raised: <NoMethodError>: <undefined method `service_resources' for nil:NilClass>
[----] E, [2018-01-06T11:11:20.074019 #13027:e0ffc4] ERROR -- : Q-task_id([miq_provision_787]) /var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:324:in `service_quota_values'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:351:in `block in quota_provision_stats'
/opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/relation/delegation.rb:40:in `each'
/opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/relation/delegation.rb:40:in `each'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:350:in `quota_provision_stats'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:84:in `quota_active_provisions'
/var/www/miq/vmdb/app/models/mixins/miq_provision_quota_mixin.rb:12:in `check_quota'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:266:in `public_send'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:266:in `block in object_send'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:285:in `ar_method'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:295:in `ar_method'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:264:in `object_send'
/var/www/miq/vmdb/lib/miq_automation_engine/service_models/mixins/miq_ae_service_miq_provision_mixin.rb:42:in `check_quota'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1624:in `perform_without_block'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1584:in `perform'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1657:in `block (2 levels) in main_loop'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `loop'
/opt/rh/rh-ruby23/root/usr/share/ruby/drb/drb.rb:1653:in `block in main_loop'


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

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Greg McCullough 2018-01-06 20:04:55 UTC
Created attachment 1377944 [details]
active_service_request.rb

Please run the attached script from an appliance console using "bin/rails r <script_name>"

The output should display Active Service Template Provision Requests and specifically invalid ones that no longer have a relationship to the service_template.

These invalid requests are the ones causing the issue and should likely be deleted.

Comment 7 Saif Ali 2018-01-08 16:15:44 UTC
Greg, 
I checked and there is no automate role defined for that zone.

Comment 9 CFME Bot 2018-01-09 20:30:53 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/0d6e97436173326912dd8fdd6e121bf8fed9ca53

commit 0d6e97436173326912dd8fdd6e121bf8fed9ca53
Author:     Tina Fitzgerald <tfitzger>
AuthorDate: Mon Jan 8 14:33:58 2018 -0500
Commit:     Tina Fitzgerald <tfitzger>
CommitDate: Mon Jan 8 14:33:58 2018 -0500

    Prevent quota error for invalid service_template.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1531914

 app/models/mixins/miq_provision_quota_mixin.rb               | 1 +
 spec/models/service_template_provision_request_quota_spec.rb | 6 ++++++
 2 files changed, 7 insertions(+)


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