Bug 1370422

Summary: Multi-rate chargeback report can not be queued.
Product: Red Hat CloudForms Management Engine Reporter: Chen <cchen>
Component: ReportingAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Nandini Chandra <nachandr>
Severity: high Docs Contact:
Priority: high    
Version: 5.6.0CC: cchen, cpelland, gtanzill, jhardy, lpichler, ltsai, nachandr, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.7.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1370586 (view as bug list) Environment:
Last Closed: 2017-01-11 19:50:28 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1370586    
Attachments:
Description Flags
evm.log which contains the call trace
none
Screenshot when generating the report
none
VM aaaa is using 53TB in the report. none

Description Chen 2016-08-26 09:44:44 UTC
Created attachment 1194270 [details]
evm.log which contains the call trace

Description of problem:

Multi-rate chargeback report can not be queued.

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

CFME-5.6.1

How reproducible:

100% (From customer's environment)

Steps to Reproduce:


1. Create a tag category called 'chargeback';
2. Create two tags 'sample0' and 'sample1' in the category that we just created;
3. Switch to 'Cloud Intel' -> 'Chargeback' -> 'Rates' and create two new ones called 'Low-Rate Sample' and 'High-Rate Sample';
4. Switch to 'Assignments', and assign rate 'Low-Rate Sample' to tag 'sample0' and 'High-Rate Sample' to 'sample1';
5. Switch to 'Compute' -> 'Cloud' -> 'Instances', tag some vms/instances with 'sample0', and the others with 'sample1';
6. Switch to 'Cloud Intel' -> 'Reports' -> 'Reports', Create a new report called 'Custom Chargeback', which is based on 'Chargeback for VMs';
7. Edit the report we just created, and add the following fields to the report:
  * CPU Total
  * CPU Total Cost
  * Memory Total
  * Memory Total Cost
  * Storage Total
  * Storage Total Cost
  * Owner
  * Fixed Total Cost
  * Total Cost
8. Then click the 'Queue' button to generate a new report sheet.

Actual results:

Call trace was found in the evm.log

[----] E, [2016-08-26T10:37:40.435421 #3580:a77998] ERROR -- : [NoMethodError]: undefined method `name' for nil:NilClass  Method:[rescue in _async_generate_table]
[----] E, [2016-08-26T10:37:40.435519 #3580:a77998] ERROR -- : /var/www/miq/vmdb/app/models/chargeback_vm.rb:93:in `get_keys_and_extra_fields'
/var/www/miq/vmdb/app/models/chargeback.rb:45:in `block (2 levels) in build_results_for_report_chargeback'
/opt/rh/cfme-gemset/gems/activerecord-5.0.0/lib/active_record/relation/delegation.rb:38:in `each'
/opt/rh/cfme-gemset/gems/activerecord-5.0.0/lib/active_record/relation/delegation.rb:38:in `each'
/var/www/miq/vmdb/app/models/chargeback.rb:43:in `block in build_results_for_report_chargeback'
/var/www/miq/vmdb/app/models/chargeback.rb:34:in `each'
/var/www/miq/vmdb/app/models/chargeback.rb:34:in `each_cons'
/var/www/miq/vmdb/app/models/chargeback.rb:34:in `build_results_for_report_chargeback'
/var/www/miq/vmdb/app/models/chargeback_vm.rb:85:in `build_results_for_report_ChargebackVm'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:201:in `_generate_table'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:176:in `block in generate_table'
/var/www/miq/vmdb/app/models/user.rb:280:in `with_user'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:176:in `generate_table'
/var/www/miq/vmdb/app/models/miq_report/generator/async.rb:96:in `_async_generate_table'
/var/www/miq/vmdb/app/models/miq_queue.rb:345:in `block in deliver'
/opt/rh/rh-ruby22/root/usr/share/ruby/timeout.rb:89:in `block in timeout'
/opt/rh/rh-ruby22/root/usr/share/ruby/timeout.rb:34:in `block in catch'
/opt/rh/rh-ruby22/root/usr/share/ruby/timeout.rb:34:in `catch'
/opt/rh/rh-ruby22/root/usr/share/ruby/timeout.rb:34:in `catch'
/opt/rh/rh-ruby22/root/usr/share/ruby/timeout.rb:104:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:341:in `deliver'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:106:in `deliver_queue_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:134:in `deliver_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:152:in `block in do_work'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `loop'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `do_work'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:334:in `block in do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:331:in `loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:331:in `do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:153:in `run'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:128:in `start'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:21:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:347:in `block in start'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:345:in `start'
/var/www/miq/vmdb/app/models/miq_worker.rb:274:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:154:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_worker.rb:154:in `times'
/var/www/miq/vmdb/app/models/miq_worker.rb:154:in `sync_workers'


Expected results:

The report should be able to be queued

Additional info:

This is HuaWei PoC case so forgive me for such a high severity.

Comment 2 Chen 2016-08-26 09:45:27 UTC
Created attachment 1194272 [details]
Screenshot when generating the report

Comment 4 Chen 2016-08-28 12:54:51 UTC
Hi Libor,

Thank you very much for your hotfix. I will provide the feedback after HuaWei applied the hotfix.

Best Regards,
Chen

Comment 5 Chen 2016-08-29 08:26:37 UTC
Hi Libor,

The customer has confirmed that the hotfix is working in their environment. Thank you very much for your help !

One more concern is that the "Storage Total" is showing too much for their report. You can see in the screenshot for VM "aaaa" that the "Storage Total" is 53 TB but in fact they don't have any VMs whose disk is larger than 1 TB.

Should I open a new bug for this issue ?

Best Regards,
Chen

Comment 6 Chen 2016-08-29 08:27:53 UTC
Created attachment 1195210 [details]
VM aaaa is using 53TB in the report.

Comment 7 Libor Pichler 2016-08-29 08:33:08 UTC
Hi Chen,

yes new BZ will be better,

can you also provide copy of their DB or appliance ? (I guess that rates and assignments we be included in the copy ) so then we can recreate the issue.

thank you

Comment 8 Chen 2016-08-29 09:00:18 UTC
Hi Libor,

Thank you for your guide !

Sure I I will ask for a copy of DB. I will create the bug if I think the engineering has to be involved.

Best Regards,
Chen

Comment 9 Satoe Imaishi 2016-08-30 12:15:09 UTC
Gregg, please add the PR link.

Comment 10 Gregg Tanzillo 2016-08-30 12:37:58 UTC
https://github.com/ManageIQ/manageiq/pull/10812

Comment 11 Nandini Chandra 2016-10-11 20:15:58 UTC
Verified in 5.7.0.4

Comment 12 Šimon Lukašík 2016-12-13 22:15:14 UTC
*** Bug 1379419 has been marked as a duplicate of this bug. ***