Bug 1307153 - CFME 5.5.2 Provider autodiscovery fails with error "[NoMethodError]: undefined method `<<' for nil:NilClass" for known existing providers
CFME 5.5.2 Provider autodiscovery fails with error "[NoMethodError]: undefine...
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers (Show other bugs)
5.5.0
All Unspecified
medium Severity medium
: GA
: 5.6.0
Assigned To: Adam Grare
Dmitry Misharov
provider:discovery
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-12 15:56 EST by Thomas Hennessy
Modified: 2016-07-15 09:22 EDT (History)
6 users (show)

See Also:
Fixed In Version: 5.6.0.0
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-06-29 11:41:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
appliance collected currnt log set showing both examples above (1.32 MB, application/zip)
2016-02-12 15:56 EST, Thomas Hennessy
no flags Details
evm.log for CFME 5.6 (1.93 MB, application/zip)
2016-04-19 02:55 EDT, Dmitry Misharov
no flags Details

  None (edit)
Description Thomas Hennessy 2016-02-12 15:56:18 EST
Created attachment 1123629 [details]
appliance collected currnt log set showing both examples above

Description of problem: Autodiscover of provisers fails with error and backtrace inf evm.log


Version-Release number of selected component (if applicable):
     Version: 5.5.2.4
     Build:   20160127105142_395c086


How reproducible: 


Steps to Reproduce:
1. instantiate a new CFME instance with vmdb
2. Navigate to Infrastructure->Providers panel and select 'configuration' button
3. Select 'discover Infrastructure Providers' from drop down box
4. Select the checkbox for the type of provider being scanned
4. enter a from-to set of ipaddress which includes an address which is known to be a supported provider (note, if the from-to range values are the same and it is the address of a provider, the 'autodiscovery' will work, but that is not what it is intended to be used for.

Actual results: the error '[NoMethodError]: undefined method `<<' for nil:NilClass' will be generated for each address in the range which ought to be recognized as a provider followed by a call stack trace.


Expected results: recognition of each provider that exists in the specified range.


Additional info:

in the testing environment, ip address 192.168.252.14 is known to be a Virtual Center.  While searching thru a range that includes this value the following error is encountered:
=====
[----] I, [2016-02-12T11:35:35.844213 #12958:b13988]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [444000000007795], MiqWorker id: [444000000000002], Zone: [default], Role: [], Server: [251a7f94-d130-11e5-865b-005056af0064], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [Host.discoverHost], Timeout: [600], Priority: [100], State: [dequeue], Deliver On: [], Data: [116 bytes], Args: [], Dequeued in: [75.242977394] seconds
[----] I, [2016-02-12T11:35:35.844392 #12958:b13988]  INFO -- : MIQ(MiqQueue#deliver) Message id: [444000000007795], Delivering...
[----] I, [2016-02-12T11:35:35.845057 #12958:b13988]  INFO -- : MIQ(Host.discoverHost) Discovering Host: #<OpenStruct ipaddr="192.168.252.14", usePing=nil, timeout=10, discover_types=[:virtualcenter, :scvmm, :rhevm]>
[----] I, [2016-02-12T11:35:35.845475 #12958:b13988]  INFO -- : Skipping IPMI Probe
[----] E, [2016-02-12T11:35:35.918980 #12958:b13988] ERROR -- : [NoMethodError]: undefined method `<<' for nil:NilClass  Method:[rescue in discoverHost]
[----] E, [2016-02-12T11:35:35.919251 #12958:b13988] ERROR -- : /opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/response.rb:59:in `rescue in fix_encoding'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/response.rb:56:in `fix_encoding'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/response.rb:45:in `create'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/request.rb:588:in `process_result'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/request.rb:504:in `block in transmit'
/opt/rh/rh-ruby22/root/usr/share/ruby/net/http.rb:853:in `start'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/request.rb:494:in `transmit'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/request.rb:202:in `execute'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/request.rb:52:in `execute'
/opt/rh/cfme-gemset/gems/rest-client-2.0.0.rc1/lib/restclient/resource.rb:51:in `get'
/opt/rh/cfme-gemset/gems/ovirt-0.7.1/lib/ovirt/service.rb:149:in `engine_ssh_public_key'
/opt/rh/cfme-gemset/gems/ovirt-0.7.1/lib/ovirt/service.rb:142:in `ovirt?'
/var/www/miq/vmdb/gems/pending/discovery/modules/RedHatRhevmProbe.rb:17:in `probe'
/var/www/miq/vmdb/gems/pending/discovery/DiscoverProbe.rb:9:in `block in getProductMod'
/var/www/miq/vmdb/gems/pending/discovery/DiscoverProbe.rb:5:in `foreach'
/var/www/miq/vmdb/gems/pending/discovery/DiscoverProbe.rb:5:in `getProductMod'
/var/www/miq/vmdb/gems/pending/discovery/MiqDiscovery.rb:83:in `scanHost'
/var/www/miq/vmdb/app/models/host.rb:1072:in `discoverHost'
/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:151:in `block in do_work'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:145:in `loop'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:145: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:29:in `start_worker'
/var/www/miq/vmdb/lib/workers/bin/worker.rb:2:in `<top (required)>'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `load'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/runner.rb:60:in `<top (required)>'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:90:in `runner'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
/var/www/miq/vmdb/bin/rails:4:in `require'
/var/www/miq/vmdb/bin/rails:4:in `<main>'
[----] W, [2016-02-12T11:35:35.924922 #12958:b13988]  WARN -- : <AuditFailure> MIQ(Host.rescue in discoverHost) userid: [system] - creating host, undefined method `<<' for nil:NilClass

=====

However, when setting a range where both the from and to values are 192.168.252.14 the provider is 'discovered' without error.  see the following:

=====
[----] I, [2016-02-12T15:38:34.251880 #12958:b13988]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [444000000010268], MiqWorker id: [444000000000002], Zone: [default], Role: [], Server: [251a7f94-d130-11e5-865b-005056af0064], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [Host.discoverHost], Timeout: [600], Priority: [100], State: [dequeue], Deliver On: [], Data: [102 bytes], Args: [], Dequeued in: [5.335506335] seconds
[----] I, [2016-02-12T15:38:34.252085 #12958:b13988]  INFO -- : MIQ(MiqQueue#deliver) Message id: [444000000010268], Delivering...
[----] I, [2016-02-12T15:38:34.253150 #12958:b13988]  INFO -- : MIQ(Host.discoverHost) Discovering Host: #<OpenStruct ipaddr="192.168.252.14", usePing=nil, timeout=10, discover_types=[:virtualcenter]>
[----] I, [2016-02-12T15:38:34.253740 #12958:b13988]  INFO -- : Skipping IPMI Probe
[----] I, [2016-02-12T15:38:34.321967 #12958:b13988]  INFO -- : MIQ(Host.discoverHost) Discovered: #<OpenStruct ipaddr="192.168.252.14", usePing=nil, timeout=10, discover_types=[:virtualcenter], os=[:mswin, :mswin], hypervisor=[:virtualcenter]>
[----] I, [2016-02-12T15:38:34.525975 #12958:b13988]  INFO -- : MIQ(ExtManagementSystem.create_discovered_ems) Cloud/Infrastructure Provider Virtual Center (192.168.252.14) created
[----] I, [2016-02-12T15:38:34.532329 #12958:b13988]  INFO -- : <AuditSuccess> MIQ(ExtManagementSystem.create_discovered_ems) userid: [system] - Cloud/Infrastructure Provider Virtual Center (192.168.252.14) created
[----] I, [2016-02-12T15:38:34.532818 #12958:b13988]  INFO -- : MIQ(MiqQueue#delivered) Message id: [444000000010268], State: [ok], Delivered in [0.280741999] seconds
=======
Comment 2 CFME Bot 2016-02-19 11:21:31 EST
https://github.com/ManageIQ/ovirt/pull/43
Comment 3 CFME Bot 2016-02-23 18:17:29 EST
New commit detected on ManageIQ/ovirt/master:
https://github.com/ManageIQ/ovirt/commit/9a358da6a13ac202b68effc6e38fe677888e3150

commit 9a358da6a13ac202b68effc6e38fe677888e3150
Author:     Adam Grare <agrare@redhat.com>
AuthorDate: Fri Feb 19 11:08:19 2016 -0500
Commit:     Adam Grare <agrare@redhat.com>
CommitDate: Fri Feb 19 11:08:19 2016 -0500

    Catch NoMethodError from RestClient in ovirt?
    
    RestClient throws an exception trying to write to RestClient.log
    when it receives an invalid encoding type from a server.  This
    happens when running ovirt? against a VMware vCenter.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1307153

 lib/ovirt/service.rb | 2 +-
 spec/service_spec.rb | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
Comment 4 Dmitry Misharov 2016-04-19 02:52:53 EDT
The bug still exists in 5.6.0.1-beta2.20160413141124_e25ac0e. Evm.log in the attachment.
Comment 5 Dmitry Misharov 2016-04-19 02:55 EDT
Created attachment 1148336 [details]
evm.log for CFME 5.6
Comment 6 Adam Grare 2016-04-19 10:09:50 EDT
This appears to be a different issue.

The original bug was when doing a RHEV scan of a vCenter we would get "[NoMethodError]: undefined method `<<' for nil:NilClass  Method:[rescue in discoverHost]." before discovering the host.

The issue you are seeing is doing a VMware scan of a vCenter it successfully discovers the host then fails when trying to add the provider with "[NoMethodError]: undefined method `exist?' for #<ActiveRecord::Relation []>"

Can you open a new BZ for this issue?
Comment 7 Dmitry Misharov 2016-04-21 08:36:16 EDT
Verified fixed in 5.6.0.1-beta2.20160413141124_e25ac0e. Doing RHEV scan of vCenter doesn't invoke errors in the log.
Comment 9 errata-xmlrpc 2016-06-29 11:41:46 EDT
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

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