Bug 1433984

Summary: CFME collects C&U metrics even before resource creation
Product: Red Hat CloudForms Management Engine Reporter: Nandini Chandra <nachandr>
Component: ReportingAssignee: Šimon Lukašík <slukasik>
Status: CLOSED CURRENTRELEASE QA Contact: Nandini Chandra <nachandr>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7.0CC: cpelland, dajohnso, gblomqui, jhardy, obarenbo, simaishi, slukasik
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: c&u
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1441244 1465077 (view as bug list) Environment:
Last Closed: 2018-03-06 15:37:14 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:
Bug Depends On:    
Bug Blocks: 1441244, 1465077    

Description Nandini Chandra 2017-03-20 13:50:58 UTC
Description of problem:
------------------------
The fix for https://bugzilla.redhat.com/show_bug.cgi?id=1419186 was to get Chargeback reports to skip hourly rollups that are older than the VM itself.

I did some investigation while verifying this BZ and found that CFME collects metrics for resources before resource creation.
 
vm.metric_rollups.order(:timestamp).where(:capture_interval_name =>
'hourly').first.timestamp
=> Mon, 13 Feb 2017 21:00:00 UTC +00:00

vm.created_on
=> Mon, 13 Feb 2017 22:02:53 UTC +00:00

BZ 1419186 affects versions > 5.6 only.So, the fix is relevant to 
CFME version > 5.6. 

In 5.6, Chargeback reports do not skip hourly rollups that are older than VMs.
In 5.7, Chargeback reports skip hourly rollups that are older than VMs.


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


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


Steps to Reproduce:
-------------------
1.Manage a provider.Enable C&U collection for the provider.


Actual results:
---------------
CFME collects C&U metrics even before resource creation.


Expected results:
-----------------
It's not necessary for CFME to collect C&U metrics before resource creation.


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

Comment 2 Nandini Chandra 2017-03-20 13:51:54 UTC
I have been discussing this issue with Simon Lukasik.

Comment 3 Šimon Lukašík 2017-03-20 14:22:08 UTC
Perhaps we can charge for it, since it is collected. This needs deeper look. How far to the history we collect on a first refresh?

Comment 4 Šimon Lukašík 2017-04-06 12:06:59 UTC
*** Bug 1439034 has been marked as a duplicate of this bug. ***

Comment 5 Šimon Lukašík 2017-04-06 12:10:27 UTC
https://github.com/ManageIQ/manageiq/pull/14666

Comment 9 Nandini Chandra 2017-11-16 18:06:47 UTC
Verified in 5.9.0.5.

Verified that Chargeback reports don't skip records older than the VM itself and take into consideration  all the records/C&U data fetched from the first collection. (in case VM was already existing when the provider was added).