New commit detected on ManageIQ/manageiq/fine: https://github.com/ManageIQ/manageiq/commit/7de622587cc1a162178b6ccf9d78f2188522d3f9 commit 7de622587cc1a162178b6ccf9d78f2188522d3f9 Author: Greg McCullough <gmccullo> AuthorDate: Tue Jan 9 15:30:37 2018 -0500 Commit: Satoe Imaishi <simaishi> CommitDate: Mon Jan 15 09:14:46 2018 -0500 Merge pull request #16769 from tinaafitz/quota_mixin_service_template_fix Fix check_quota(:active_provisions) for Service MiqRequest invalid service_template. (cherry picked from commit 8aa881f53bfa3ae2517921bbd061d82d01ccd600) https://bugzilla.redhat.com/show_bug.cgi?id=1534589 app/models/mixins/miq_provision_quota_mixin.rb | 1 + spec/models/service_template_provision_request_quota_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+)
Hi Vatsal, The core issue here is that check_quota(:active_provisions) fails when it encounters an active Service request that has an invalid service_template. We recently changed the active_provision code to calculate quota values for Service requests by looking at the request service_template.service_resource information. The customer has multiple multiple zones and had Service requests queued to a zone where work never got dispatched because the automate role was not enabled there. Since these Service requests were active, they were included in the quota active calculations. Several of these Service requests had invalid service_templates(meaning the service_template used when the Service was originally ordered no longer exists). Although this issue impacts any calls to the check_quota(:active_provisions) method, the customer encountered it in the request.check_quota(:active_provisions) call during VM provisioning here: RedHat Automate domain method: /Infrastructure/VM/Provisioning/Placement/vmware_best_fit_with_scope Since the vmware_best_fit_with_scope method is used during VM Provisioning, all provisions would fail if the active_quota calculations encountered a single Service MiqRequest with an invalid service_template, even if Quota is not being used. To reproduce this issue: (You'll need to have the RedHat Automate domain) 1. Setup multiple zones.(You can use a single appliance and just add a "test" zone) 2. Add VMWare provider and configure it to the "test" zone. 3. Create a VMWare Service Item. 4. Order the Service. 5. Delete the Service Template used in the Service creation in step 3. 6. Modify the VMWare provider to use the default zone. (This should leave the existing Service request(s) in the queue for the "test" zone and the service_template will be invalid) 7. Provision a VMWare VM. You should see the following error in the log: "[----] 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]) " *Note - The steps above will reproduce the issue with Quota turned off. With Quota turned on, any type of provisioning should fail in Quota with the same error, so step 7 would be: Provision any VM or Service. Let me know if you have any questions. Thanks, Tina
Hi Vatsal, Additional steps needed to validate this fix.(With quota turned off) 6a. Using the Automate Explorer, Create a writable domain. 6b. Copy the /ManageIQ/Infrastructure/VM/Provisioning/Placement/Default instance to the writable domain. 6c. Modify the newly copied "Default"instance vmware method value from: vmware_best_least_utilized to: vmware_best_fit_with_scope I made these changes locally on your appliance in the "tina" domain and validated the fix. (Requests 6 and 11 would have caused the invalid service template error.) Let me know if you have any questions. Thanks, Tina
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-2018:0374