Bug 1446166

Summary: accessing RHEV provider fails with "NoMethodError: undefined method `>=' for nil:NilClass"
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Boriso <bodnopoz>
Status: CLOSED CURRENTRELEASE QA Contact: Ilanit Stein <istein>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: cpelland, dajohnso, jhardy, juan.hernandez, mfalesni, obarenbo, pkliczew
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest:provider
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1446613 (view as bug list) Environment:
Last Closed: 2018-03-06 15:20:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: RHEVM Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1446613    
Attachments:
Description Flags
Excerpt of evm.log none

Description Martin Kourim 2017-04-27 11:29:07 UTC
Description of problem:
When a RHEV provider is added and "Relationships and Power States" are not refreshed, it's not possible to access the provider using REST API. It fails with `NoMethodError: undefined method `>=' for nil:NilClass`.

Please see http://pastebin.test.redhat.com/479296 for relevant parts of the evm.log


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


How reproducible:
Very


Steps to Reproduce:
1. add the RHEV provider using "Discover Infrastructure Providers" (this way it's not necessary to specify credentials and the provider is not refreshed automatically)
2. GET /api/providers/:id


Actual results:
NoMethodError: undefined method `>=' for nil:NilClass"

Comment 2 Milan Falešník 2017-04-27 12:01:09 UTC
Created attachment 1274594 [details]
Excerpt of evm.log

Copying the log from the pastebin link as an attachment to ensure preservation of the data.

Comment 3 Juan Hernández 2017-04-27 17:29:48 UTC
This happens when the provider is added without credentials because without credentials there is no way to determine the version of the API, therefore the 'api_version' method returns 'nil'.

This was detected already as a problem that happens when the refresh hasn't been performed yet. The solution already merged to the new 'manageiq-providers-ovirt' repository:

  Renderer fails when calling validate_import_vm
  https://github.com/ManageIQ/manageiq-providers-ovirt/pull/3

But it was marked as fine/no.

The corresponding pull request before the creation of the new repository was never merged either:

  Prevent NoMethodError when api_version is nil in VmImport
  https://github.com/ManageIQ/manageiq/pull/14013

So I think we should consider setting the flag to 'fine/yes', and backport it.

Comment 4 Piotr Kliczewski 2017-04-28 07:37:51 UTC
Here is the backport to fine:

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

Comment 6 Ilanit Stein 2017-05-04 06:02:09 UTC
Moving qe_test_coverage to + as this bug is already included in existing RHV provider crud test.

Comment 7 Ilanit Stein 2017-11-09 13:50:00 UTC
Verified on CFME-5.9.0.4/RHV-4.1.7

Followed description's flow:

1. add the RHEV provider using "Discover Infrastructure Providers" (this way it's not necessary to specify credentials and the provider is not refreshed automatically)
2. GET /api/providers/:id - successful.