Bug 1734770 - Failure adding C&U configuration to RHV provider [NEEDINFO]
Summary: Failure adding C&U configuration to RHV provider
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.11.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.11.0
Assignee: Roberto Ciatti
QA Contact: Nandini Chandra
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-31 11:58 UTC by Victor Estival
Modified: 2019-12-13 14:57 UTC (History)
10 users (show)

Fixed In Version: 5.11.0.18
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-13 14:57:13 UTC
Category: Bug
Cloudforms Team: RHEVM
Target Upstream Version:
nachandr: needinfo? (vestival)


Attachments (Terms of Use)
Screenshot with the problem (318.44 KB, image/png)
2019-07-31 11:58 UTC, Victor Estival
no flags Details

Description Victor Estival 2019-07-31 11:58:17 UTC
Created attachment 1595050 [details]
Screenshot with the problem

Description of problem: While adding a RHV provider (or editing it) information for C&U Database it fails with the message "Credential validation was not successful: uninitialized constant ManageIQ::Providers::Redhat::InfraManager::ApiIntegration::PGError


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


How reproducible: 100


Steps to Reproduce:
1. Add the RHV Provider
2. Add the C & Endpoint and credentials
3.

Actual results: Fail


Expected results: Success 


Additional info:

Comment 2 Dave Johnson 2019-07-31 12:03:07 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 3 Roberto Ciatti 2019-08-01 19:34:34 UTC
Actually the problem is shaded by a bug related to the use of PGError that should be updated after we switch to the version of ovirt_metrics ~> 3.0.0.

But the real error message is 
"Credential validation was not successful: The version of PostgreSQL being connected to is incompatible with CFME (10 required)"

and the cause of the bug is related to check that ManageIQ is doing when we use ActiveRecord connection.
In production mode connections are restricted to version of postgres >= 10 and < 11 (thanks to Adam Grare for the hint)

In this case the RHV environment is a 4.2.8 with postgresql version 9.5.

We are working to identify a solution with the help also of Joe Rafaniello.

Comment 5 Nandini Chandra 2019-08-02 01:56:48 UTC
Hi Victor,

I do not see this issue in 5.11.0.17 while adding C&U DB credentials for RHV. I have tested this with RHV 43.

After successfully validating the C&U credentials, I saw the error message reported in the BZ when I an entered incorrect passowrd  while editing the credentials .
"Credential validation was not successful: uninitialized constant ManageIQ::Providers::Redhat::InfraManager::ApiIntegration::PGError

Could you verify if correct credentials were provided while adding the provider ?

Comment 6 Roberto Ciatti 2019-08-02 06:24:18 UTC
Hi Nandini,
  The error you reported as in my "comment 3" is due to a problem in managing the exception.
The problem Victor is reporting happens in production mode on 5.11.0.17 when trying to add and RHV that has postgresql database of version under 10 (like the one Victor is trying to import).

Comment 9 CFME Bot 2019-08-02 20:25:40 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/b3f3f577fc11cccf7d19c8bbe406e74b2a1a6402
commit b3f3f577fc11cccf7d19c8bbe406e74b2a1a6402
Author:     Joe Rafaniello <jrafanie@redhat.com>
AuthorDate: Thu Aug  1 16:16:00 2019 -0400
Commit:     Joe Rafaniello <jrafanie@redhat.com>
CommitDate: Thu Aug  1 16:16:00 2019 -0400

    Allow ovirt to implement their own pg version check

    This doesn't fix the following bug but allows them to implement their
    own adapter that opts-out of the manageiq pg version check and instead
    implement their own via a check_version, something like this:

    ```ruby
    module ActiveRecord
      module ConnectionHandling # :nodoc:
        def ovirt_postgresql_connection(config)
          conn_params = config.symbolize_keys
          ...rest of the existing rails 5.1 pg adapter method until...
          ConnectionAdapters::OvirtPostgreSQLAdapter.new(nil, logger, conn_params, config)
        end
      end
      module ConnectionAdapters
        class OvirtPostgreSQLAdapter < PostgreSQLAdapter
          def check_version
            raise "AAAAA" if postgresql_version > XXX
          end
        end
      end
    end
    ```

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

 config/initializers/postgres_required_versions.rb | 3 +
 1 file changed, 3 insertions(+)

Comment 10 CFME Bot 2019-08-02 21:30:44 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/493cf689e6ab227711e60e52ee1108d5b91fb012
commit 493cf689e6ab227711e60e52ee1108d5b91fb012
Author:     Nick Carboni <ncarboni@redhat.com>
AuthorDate: Fri Aug  2 16:23:53 2019 -0400
Commit:     Nick Carboni <ncarboni@redhat.com>
CommitDate: Fri Aug  2 16:23:53 2019 -0400

    Merge pull request #19090 from jrafanie/allow_ovirt_to_implement_their_own_pg_check_version

    Allow ovirt to implement their own pg version check

    (cherry picked from commit e5307965c15f1cc2eaccb26e9a4364556252eb1c)

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

 config/initializers/postgres_required_versions.rb | 3 +
 1 file changed, 3 insertions(+)

Comment 11 CFME Bot 2019-08-05 13:10:32 UTC
New commit detected on ManageIQ/ovirt_metrics/master:

https://github.com/ManageIQ/ovirt_metrics/commit/66eda042b6eb7fa0afc0e533556f2a26da7320db
commit 66eda042b6eb7fa0afc0e533556f2a26da7320db
Author:     Roberto Ciatti <gekorob@users.noreply.github.com>
AuthorDate: Fri Aug  2 11:11:55 2019 -0400
Commit:     Roberto Ciatti <gekorob@users.noreply.github.com>
CommitDate: Fri Aug  2 11:11:55 2019 -0400

    ConnectionAdapter with check_version overriding

    New OvirtPostgreSQLAdapter that extends the default one adding
    a check_version method to override restrictions imposed by the
    manageiq postgresql_required_versions initializer.
    This modification, with the update of the initializer mentioned
    above should solve:

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

 lib/active_record/connection_adapters/ovirt_postgresql_adapter.rb | 30 +
 lib/ovirt_metrics.rb | 5 +-
 2 files changed, 34 insertions(+), 1 deletion(-)

Comment 12 Joe Rafaniello 2019-08-05 14:17:16 UTC
* We'll need to cut a release of this after 19090 has been merged
* We'll then need to bump the ovirt_metrics gem requirement in the gemspec/Gemfile in manageiq or the provider for backport to ivanchuk

Comment 13 Roberto Ciatti 2019-08-05 14:43:03 UTC
Submitted the PR 
   https://github.com/ManageIQ/manageiq/pull/19100 
with the ovirt_metrics bump to the 3.0.1.

Comment 14 CFME Bot 2019-08-05 23:45:37 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/182b82dc8edae545dea8cb692240afca63a0884c
commit 182b82dc8edae545dea8cb692240afca63a0884c
Author:     Joe Rafaniello <jrafanie@users.noreply.github.com>
AuthorDate: Mon Aug  5 11:41:16 2019 -0400
Commit:     Joe Rafaniello <jrafanie@users.noreply.github.com>
CommitDate: Mon Aug  5 11:41:16 2019 -0400

    Merge pull request #19100 from gekorob/ovirt_metrics_check_version

    Update ovirt_metrics for check_version

    (cherry picked from commit 62c141169452b6d24ef4c6004fe993bcc8e805b9)

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

 Gemfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 15 Joe Rafaniello 2019-08-08 20:10:14 UTC
moving to post since the Gemfile version update was completed

Comment 16 Nandini Chandra 2019-08-22 21:49:13 UTC
Verified in 5.11.0.18


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