-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix chargeback report when VM is destroyed #16598
Fix chargeback report when VM is destroyed #16598
Conversation
spec/models/chargeback_vm_spec.rb
Outdated
end | ||
|
||
it "calculates allocated cpu cost and metric values" do | ||
skip('this case is needs to be fixed in new chargeback') if Settings.new_chargeback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: is needs
, remove the is
spec/models/chargeback_vm_spec.rb
Outdated
@@ -190,6 +190,22 @@ | |||
|
|||
subject { ChargebackVm.build_results_for_report_ChargebackVm(options).first.first } | |||
|
|||
context 'when Vm(resource) is destroyed' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vm(resource) is hard to follow if you're not familiar with chargeback. Would when the Vm resource of a consumption is destroyed
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it sounds better to me 👍
Minor nitpicks but LGTM when fixed. |
hours_in_day changed because hours_in_day is calculated as: hours_in_day = end_of_day - [start_date(first_metric_rollup.timestamp), @vm1.created_on].compact.min and when @VM1 doesn't exist so we have to take into account that there is used start_date(first_metric_rollup.timestamp) which is set about few hours later then @vm1.created_on as was used before
2197e31
to
a9415f4
Compare
@jrafanie thanks, updated 👍 |
Checked commits lpichler/manageiq@a0e33b4~...a9415f4 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…_destroyed Fix chargeback report when VM is destroyed (cherry picked from commit 01cc0ea)
Gaprindashvili backport details:
|
Fix some cases when Vm is destroyed => then relation Vm - MetricRollup(thru MetricRollup#resource) is destroyed but chargeback report was counting with some attributes of the VM - which doesn't exist so I am adding here
try
s.Error message
cc @gtanzillo
@miq-bot assign @jrafanie
@miq-bot add_label bug, chargeback, gaprindashvili/yes