Bug 1332579 - [NoMethodError] undefined method `metrics_collector_queue_name'
Summary: [NoMethodError] undefined method `metrics_collector_queue_name'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: C&U Capacity and Utilization
Version: 5.5.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: GA
: 5.6.0
Assignee: Keenan Brock
QA Contact: Nandini Chandra
URL:
Whiteboard: c&u:report
: 1335150 (view as bug list)
Depends On:
Blocks: 1333095
TreeView+ depends on / blocked
 
Reported: 2016-05-03 14:09 UTC by Colin Arnott
Modified: 2019-12-16 05:44 UTC (History)
9 users (show)

Fixed In Version: 5.6.0.6
Doc Type: Bug Fix
Doc Text:
Previously, some reports run on virtual machines did not generate any data, and reported an error with the metrics_collector_queue_name method. This problem occurred when a virtual machine was disconnected from the EMS but remained connected to a cluster, and metrics collection continued to be scheduled for that virtual machine. The capture_cloud_targets metric has been rewritten to fix this issue, so that metrics collection only occurs on virtual machines which are both powered on and attached to an EMS.
Clone Of:
: 1333095 (view as bug list)
Environment:
Last Closed: 2016-06-29 15:56:53 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1348 0 normal SHIPPED_LIVE CFME 5.6.0 bug fixes and enhancement update 2016-06-29 18:50:04 UTC

Description Colin Arnott 2016-05-03 14:09:01 UTC
Description of problem:
Some reports run but do not generate any data.

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

Steps to Reproduce:
1. enable C&U roles and data collection
2. wait 48h+
3. run either of the following reports:
Cloud Intelligence → Reports → Reports → Performance by Asset Type → Virtual Machines → Top CPU Consumers (weekly)

Cloud Intelligence → Reports → Reports → Performance by Asset Type → Virtual Machines → Top Memory Consumers (weekly)

Actual results:
[----] I, [2016-05-03T09:36:32.049208 #18752:df5994]  INFO -- : MIQ(Metric::Capture.perf_capture_timer) Created task id: [1000000340157] for: [EmsCluster:1000000000023] with targets: ["ManageIQ::Providers::Redhat::InfraManager::Host:1000000000032"] for time range: [2016-05-03T12:33:33Z - 2016-05-03T12:36:31Z]
[----] I, [2016-05-03T09:36:32.060885 #18752:df5994]  INFO -- : MIQ(Metric::Capture.perf_capture_timer) Created task id: [1000000340158] for: [EmsCluster:1000000000031] with targets: ["ManageIQ::Providers::Redhat::InfraManager::Host:1000000000017", "ManageIQ::Providers::Redhat::InfraManager::Host:1000000000009", "ManageIQ::Providers::Redhat::InfraManager::Host:1000000000008"] for time range: [2016-05-03T12:33:33Z - 2016-05-03T12:36:31Z]
[----] I, [2016-05-03T09:36:32.085841 #18752:df5994]  INFO -- : MIQ(Metric::Capture.perf_capture_timer) Created task id: [1000000340159] for: [EmsCluster:1000000000032] with targets: ["ManageIQ::Providers::Redhat::InfraManager::Host:1000000000033"] for time range: [2016-05-03T12:33:33Z - 2016-05-03T12:36:31Z]
[----] E, [2016-05-03T09:36:32.318121 #18752:df5994] ERROR -- : MIQ(MiqQueue#deliver) Message id: [1000005808463], Error: [undefined method `metrics_collector_queue_name' for nil:NilClass]
[----] E, [2016-05-03T09:36:32.318339 #18752:df5994] ERROR -- : [NoMethodError]: undefined method `metrics_collector_queue_name' for nil:NilClass  Method:[rescue in deliver]
[----] E, [2016-05-03T09:36:32.318634 #18752:df5994] ERROR -- : /var/www/miq/vmdb/app/models/metric/ci_mixin/capture.rb:19:in `queue_name_for_metrics_collection'
[----] I, [2016-05-03T09:36:32.319058 #18752:df5994]  INFO -- : MIQ(MiqQueue#delivered) Message id: [1000005808463], State: [error], Delivered in [2.202806638] seconds
[----] I, [2016-05-03T09:36:35.365243 #18752:df5994]  INFO -- : MIQ(MiqPriorityWorker::Runner#message_sync_active_roles) MIQ(MiqPriorityWorker::Runner) Synchronizing active roles...
[----] I, [2016-05-03T09:36:35.365671 #18752:df5994]  INFO -- : MIQ(MiqPriorityWorker::Runner#message_sync_active_roles) MIQ(MiqPriorityWorker::Runner) Synchronizing active roles complete...
[----] I, [2016-05-03T09:36:35.365982 #18752:df5994]  INFO -- : MIQ(MiqPriorityWorker::Runner#message_sync_config) MIQ(MiqPriorityWorker::Runner) Synchronizing configuration...
[----] I, [2016-05-03T09:36:35.408251 #18752:df5994]  INFO -- : MIQ(MiqPriorityWorker::Runner#sync_config) ID [1000000016794], PID [18752], GUID [162cdc3c-0e36-11e6-a85f-001a4a7c4942], Zone [default], Active Roles 

Expected results:
collection of C&U data.

Additional info:
this may be related to this commit: https://github.com/ManageIQ/manageiq/commit/0dbb116a2f0de33a1ac2410635e4fdbe6f95aede

Comment 3 Keenan Brock 2016-05-04 02:34:16 UTC
This overlaps with https://bugzilla.redhat.com/show_bug.cgi?id=1331803

Looks like there is an issue with cloud providers and orphans.

https://github.com/ManageIQ/manageiq/pull/8429

Comment 5 CFME Bot 2016-05-06 03:05:45 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/db0a24629e9442b2ba754bb374c6141b9aba7430

commit db0a24629e9442b2ba754bb374c6141b9aba7430
Author:     Keenan Brock <kbrock>
AuthorDate: Wed May 4 22:43:34 2016 -0400
Commit:     Keenan Brock <kbrock>
CommitDate: Wed May 4 22:53:30 2016 -0400

    Metric::Target capture_cloud_targets rewrite
    
    - only bring back vms that are on (when availability_zone.nil?)
    - only bring back vms that have an ems
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1332579
    https://bugzilla.redhat.com/show_bug.cgi?id=1331803

 app/models/metric/targets.rb | 1 +
 1 file changed, 1 insertion(+)

Comment 7 Keenan Brock 2016-05-17 18:53:05 UTC
*** Bug 1335150 has been marked as a duplicate of this bug. ***

Comment 11 Keenan Brock 2016-06-06 12:20:11 UTC
Nandini

Orphaned: Vm has no ems, but has ems_cluster_id (or availability zone).

1. We've written code to prevent this from happening
2. We've written code to not blow up when this does happen (yes, overkill)

1. Create a VM on ec2
2. Assign the Vm to an availability zone and ems_cluster
3. go into the console write down the vm's availability_zone_id and ems_cluster_id
4. Go into amazon and remove the VM
5. Trigger an ems refresh

before this patch:
1. you should have a Vm.where(:ems_id => nil).count
2. you should have Vm.where(:ems_id => nil).where.not(:ems_cluster_id => nil).count
3. Cap&U should blow up

after this patch:

1. You should have a Vm.where(:ems_id => nil).count
2. You should NOT have Vm.where(:ems_id => nil).where.not(:ems_cluster_id => nil).count
3. Cap&U should work
4. Vm.where(:ems_id => nil).update_all(:ems_cluster_id => EmsCluster.first.id)
5. Cap&U should still work

Comment 14 Keenan Brock 2016-06-14 16:58:38 UTC
1. Vm.where(:ems_id => nil).count
2. you should see a number higher than 0
3. Vm.where(:ems_id => nil).where.not(:ems_cluster_id => nil).count
4. you should see 0
5. Cap&U should work
4. Vm.where(:ems_id => nil).update_all(:availability_zone_id => AvailabilityZone.first.id)
5. Cap&U should still work

Comment 15 Nandini Chandra 2016-06-14 18:10:23 UTC
Thanks Keenan.

Steps to reproduce:

1)Terminate an instance from the ec2 console.
2)Refresh ems.

With the fix,

Run these commands on the rails console
1. Vm.where(:ems_id => nil).count 
Output : VM count is greater than 0.

2. Vm.where(:ems_id => nil).where.not(:availability_zone_id => nil).count
Output : VM count = 0

Verified that C&U continues to work after this step.


3. Vm.where(:ems_id => nil).update_all(:availability_zone_id => AvailabilityZone.first.id)

Verified that C&U continues to work after this step.

Verified in 5.6.0.10

Comment 17 errata-xmlrpc 2016-06-29 15:56:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348

Comment 18 Keenan Brock 2017-07-03 17:59:11 UTC
This is all set. marked attachment so bz doesn't keep emailing me


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