Bug 1563861 - Report for Storage Capacity Field Generating Error Cannot Convert Hash to Float
Summary: Report for Storage Capacity Field Generating Error Cannot Convert Hash to Float
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Niyaz Akhtar Ansari
URL:
Whiteboard:
Depends On:
Blocks: 1566530
TreeView+ depends on / blocked
 
Reported: 2018-04-04 23:16 UTC by myoder
Modified: 2019-02-11 14:08 UTC (History)
4 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1566530 (view as bug list)
Environment:
Last Closed: 2019-02-11 14:08:21 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:


Attachments (Terms of Use)

Description myoder 2018-04-04 23:16:46 UTC
Description of problem:

Created a report based on Persistent Volumes and added the Capacity field into the report.  When queueing a report this ERROR is thrown:

[----] I, [2018-04-04T19:01:28.767458 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_create_results) Creating report results with hash: [{:name=>"Test Persistent Volumes", :userid=>"admin", :report_source=>"Requested by user", :db=>"PersistentVolume", :last_run_on=>2018-04-04 23:01:28 UTC, :last_accessed_on=>2018-04-04 23:01:28 UTC, :miq_report_id=>1000000000161, :miq_group_id=>nil}]
[----] E, [2018-04-04T19:01:28.865093 #25579:ecf130] ERROR -- : [TypeError]: can't convert Hash into Float  Method:[block in method_missing]
[----] E, [2018-04-04T19:01:28.865613 #25579:ecf130] ERROR -- : /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-6ffc72a14a80/app/helpers/number_helper.rb:75:in `Float'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-6ffc72a14a80/app/helpers/number_helper.rb:75:in `handling_negatives'
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-6ffc72a14a80/app/helpers/number_helper.rb:4:in `number_to_human_size'
/var/www/miq/vmdb/app/models/miq_report/formatting.rb:126:in `format_bytes_to_human_size'
/var/www/miq/vmdb/app/models/miq_report/formatting.rb:94:in `apply_format_function'
/var/www/miq/vmdb/app/models/miq_report/formatting.rb:79:in `format'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:91:in `build_html_col'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:48:in `block (2 levels) in build_html_rows'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:47:in `each'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:47:in `each_with_index'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:47:in `block in build_html_rows'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:24:in `each'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:24:in `each_with_index'
/var/www/miq/vmdb/app/models/miq_report/generator/html.rb:24:in `build_html_rows'
/var/www/miq/vmdb/app/models/miq_report/generator.rb:336:in `build_create_results'
/var/www/miq/vmdb/app/models/miq_report/generator/async.rb:103:in `_async_generate_table'
/var/www/miq/vmdb/app/models/miq_queue.rb:449:in `block in dispatch_method'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:91:in `block in timeout'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `block in catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:106:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:448:in `dispatch_method'
/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `block in deliver'
/var/www/miq/vmdb/app/models/user.rb:261:in `with_user_group'
/var/www/miq/vmdb/app/models/miq_queue.rb:425:in `deliver'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:104: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:329:in `block in do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326:in `loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:326: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:127:in `start'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:22:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:375:in `block in start_runner_via_fork'
/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:373:in `start_runner_via_fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:367:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:414:in `start'
/var/www/miq/vmdb/app/models/miq_worker.rb:266:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `times'
/var/www/miq/vmdb/app/models/miq_worker.rb:153:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:22:in `monitor_workers'
/var/www/miq/vmdb/app/models/miq_server.rb:333:in `block in monitor'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-22145df40925/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-22145df40925/lib/gems/pending/util/extensions/miq-benchmark.rb:28:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:333:in `monitor'
/var/www/miq/vmdb/app/models/miq_server.rb:372:in `block (2 levels) in monitor_loop'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-22145df40925/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-22145df40925/lib/gems/pending/util/extensions/miq-benchmark.rb:35:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:372:in `block in monitor_loop'
/var/www/miq/vmdb/app/models/miq_server.rb:371:in `loop'
/var/www/miq/vmdb/app/models/miq_server.rb:371:in `monitor_loop'
/var/www/miq/vmdb/app/models/miq_server.rb:234:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:27:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:48:in `start'
/var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>'

I added logging to these files to get some more detail about the column data: 

/var/www/miq/vmdb/app/models/miq_report/generator/html.rb
/opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-6ffc72a14a80/app/helpers/number_helper.rb


[----] I, [2018-04-04T19:01:28.767458 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_create_results) Creating report results with hash: [{:name=>"Test Persistent Volumes", :userid=>"admin", :report_source=>"Requested by user", :db=>"PersistentVolume", :last_run_on=>2018-04-04 23:01:28 UTC, :last_accessed_on=>2018-04-04 23:01:28 UTC, :miq_report_id=>1000000000161, :miq_group_id=>nil}]

###CUSTOM LOGGING HERE
~~~
[----] I, [2018-04-04T19:01:28.860212 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data: [{"name"=>"pvc-d99c65ca-05cd-11e8-9514-000d3a37c74f", "claim_name"=>nil, "capacity"=>{:storage=>5368709120}, "id"=>1000000010637}]
[----] I, [2018-04-04T19:01:28.860456 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the col_name: [name]
[----] I, [2018-04-04T19:01:28.860659 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data[col_name]: [pvc-d99c65ca-05cd-11e8-9514-000d3a37c74f]

[----] I, [2018-04-04T19:01:28.862486 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data: [{"name"=>"pvc-d99c65ca-05cd-11e8-9514-000d3a37c74f", "claim_name"=>nil, "capacity"=>{:storage=>5368709120}, "id"=>1000000010637}]
[----] I, [2018-04-04T19:01:28.862663 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the col_name: [claim_name]
[----] I, [2018-04-04T19:01:28.862821 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data[col_name]: []

[----] I, [2018-04-04T19:01:28.863036 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data: [{"name"=>"pvc-d99c65ca-05cd-11e8-9514-000d3a37c74f", "claim_name"=>nil, "capacity"=>{:storage=>5368709120}, "id"=>1000000010637}]
[----] I, [2018-04-04T19:01:28.863174 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the col_name: [capacity]
[----] I, [2018-04-04T19:01:28.863345 #25579:ecf130]  INFO -- : MIQ(MiqReport#build_html_col) This is the row_data[col_name]: [{:storage=>5368709120}]

[----] I, [2018-04-04T19:01:28.864274 #25579:ecf130]  INFO -- : MIQ(NumberHelper.handling_negatives) This is the number: [{:storage=>5368709120}]
~~~
###END CUSTOM LOGGING

[----] E, [2018-04-04T19:01:28.865093 #25579:ecf130] ERROR -- : [TypeError]: can't convert Hash into Float  Method:[block in method_missing]


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

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

I have a reproducer here:
  
10.13.145.235 with default credentials

Comment 5 CFME Bot 2018-04-11 02:01:10 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/bd5d18c78d1cd300f4c43d413af659bd9b406a8f
commit bd5d18c78d1cd300f4c43d413af659bd9b406a8f
Author:     Tim Wade <hello@timjwade.com>
AuthorDate: Tue Apr 10 15:09:02 2018 -0400
Commit:     Tim Wade <hello@timjwade.com>
CommitDate: Tue Apr 10 15:09:02 2018 -0400

    Don't format PersistentVolume-capacity as bytes

    There are other tables that have `capacity` columns that are formatted
    as bytes. This newer column is serialized and will blow when trying to
    apply this formatting to it. Since the existing way of mapping columns
    to formats does not take table name into account, we need a temporary
    way to override this for colliding column names. This can later be
    reworked so all mapped formats will be qualified in some way.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1563861

 app/models/miq_report/formats.rb | 12 +-
 db/fixtures/miq_report_formats.yml | 3 +
 spec/models/miq_report/formats_spec.rb | 5 +
 3 files changed, 16 insertions(+), 4 deletions(-)

Comment 8 Niyaz Akhtar Ansari 2018-07-31 07:51:36 UTC
Verified in Version 5.10.0.6.20180725145922_d299ff5


Note You need to log in before you can comment on or make changes to this bug.