Bug 1393040

Summary: No Chargeback data received from API while generating Service Chargeback reports
Product: Red Hat CloudForms Management Engine Reporter: Nandini Chandra <nachandr>
Component: ReportingAssignee: Yuri Rudman <yrudman>
Status: CLOSED CURRENTRELEASE QA Contact: Nandini Chandra <nachandr>
Severity: high Docs Contact:
Priority: high    
Version: 5.7.0CC: cpelland, dajohnso, jhardy, obarenbo, yrudman
Target Milestone: GAKeywords: TestOnly
Target Release: 5.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: service:chargeback
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1395299 (view as bug list) Environment:
Last Closed: 2017-06-12 17:17:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1395299    

Description Nandini Chandra 2016-11-08 17:44:03 UTC
Description of problem:
------------------------
While testing Service Chargeback,I found that no Chargeback data was coming from the API.I have attached a screen shot.Since there is no Chargeback data, the SSUI dashboard doesn't show Chargeback costs for the service.

When we found that no Chargeback data was coming from the API, we
tried generating the data by running this command on Rails console.Once the
data was generated, the chargeback costs showed up on the SSUI Dashboard for
the service.

cfg = VMDB::Config.new("vmdb")
cfg.config[roduct][:report_sync] = true
cfg.save
Service.all.each { |s| s.generate_chargeback_report }

Here's a snippet from evm.log.It does look like the 
Chargeback-Vm-Monthly-test_catalog_item report was successfully generated.
But, I still don't see the Chargeback cost on the SSUI dashboard.

[root@host-192-168-55-248 log]# zgrep generate_chargeback_report *
evm.log-20161104.gz:[----] I, [2016-11-03T20:00:08.805814 #9800d5158]  INFO -- : MIQ(MiqQueue.put) Message id: [67730],  id: [], Zone: [], Role: [reporting], Server: [], Ident: [generic], Target id: [], Instance id: [1], Task id: [], Command: [Service.generate_chargeback_report], Timeout: [600], Priority: [100], State: [ready], Deliver On: [], Data: [], Args: [{:report_source=>"Daily scheduler"}]
evm.log-20161104.gz:[----] I, [2016-11-03T20:00:08.806036 #9800d5158]  INFO -- : MIQ(Service#queue_chargeback_report_generation) Added to queue: generate_chargeback_report for service test_catalog_item
evm.log-20161104.gz:[----] I, [2016-11-03T20:00:36.578101 #9800d5158]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [67730], MiqWorker id: [35], Zone: [], Role: [reporting], Server: [], Ident: [generic], Target id: [], Instance id: [1], Task id: [], Command: [Service.generate_chargeback_report], Timeout: [600], Priority: [100], State: [dequeue], Deliver On: [], Data: [], Args: [{:report_source=>"Daily scheduler"}], Dequeued in: [27.820310252] seconds
evm.log-20161104.gz:[----] I, [2016-11-03T20:00:36.580583 #9800d5158]  INFO -- : MIQ(Service#generate_chargeback_report) Generation of chargeback report for service test_catalog_item started...
evm.log-20161104.gz:[----] I, [2016-11-03T20:00:36.974980 #9800d5158]  INFO -- : MIQ(Service#generate_chargeback_report) Report Chargeback-Vm-Monthly-test_catalog_item generated


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


How reproducible:
-----------------
Always


Steps to Reproduce:
-------------------
1.Create service in admin UI
2.Provision this service in SSUI


Actual results:
---------------
No Chargeback data received from API while generating Service Chargeback reports
and hence no chargeback costs shown on SSUI Dashboard for the service.


Expected results:
-----------------


Additional info:
----------------

Comment 4 Yuri Rudman 2016-11-09 18:14:38 UTC
PR: https://github.com/ManageIQ/manageiq/pull/12535

Comment 5 CFME Bot 2016-11-15 14:51:18 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/39cdbef1b8cac9f56ad090fe2c387284cb1a92cc

commit 39cdbef1b8cac9f56ad090fe2c387284cb1a92cc
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Mon Nov 14 13:27:10 2016 -0500
Commit:     Oleg Barenboim <chessbyte>
CommitDate: Tue Nov 15 09:48:54 2016 -0500

    Merge pull request #12535 from yrudman/fix-chargeback-generation-fo-service
    
    Fixed  chargeback report generation for services
    (cherry picked from commit b8713809a64bc4eb49d25fe47fa92268033d6dd1)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1393040

 app/models/miq_report/generator.rb | 2 +-
 app/models/service.rb              | 1 +
 spec/models/service_spec.rb        | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

Comment 7 Nandini Chandra 2017-03-15 20:44:46 UTC
Verified in 5.8.0.4