Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1519815 - The `raw_connect` method of the RHV provider doesn't throw `Miq*` exceptions
Summary: The `raw_connect` method of the RHV provider doesn't throw `Miq*` exceptions
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: GA
: 5.9.0
Assignee: Boriso
QA Contact: Ilanit Stein
URL:
Whiteboard:
Depends On: 1510374
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-01 13:46 UTC by Satoe Imaishi
Modified: 2018-03-06 15:27 UTC (History)
8 users (show)

Fixed In Version: 5.9.0.16
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1510374
Environment:
Last Closed: 2018-03-06 15:27:55 UTC
Category: ---
Cloudforms Team: RHEVM
istein: needinfo+


Attachments (Terms of Use)

Comment 2 CFME Bot 2017-12-01 13:54:50 UTC
New commit detected on ManageIQ/manageiq-providers-ovirt/gaprindashvili:
https://github.com/ManageIQ/manageiq-providers-ovirt/commit/c04deaab29df3a3818725a6cbced02b69b0f8fbd

commit c04deaab29df3a3818725a6cbced02b69b0f8fbd
Author:     Moti Asayag <masayag@redhat.com>
AuthorDate: Thu Nov 30 16:21:37 2017 +0200
Commit:     Satoe Imaishi <simaishi@redhat.com>
CommitDate: Fri Dec 1 08:47:12 2017 -0500

    Merge pull request #162 from borod108/bugs/1510374miqerror
    
    Raise Miq exceptions on connect
    (cherry picked from commit 7d33f02c2e3520a2c721a2a218b6f1ec32a4732d)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1519815

 .../providers/redhat/infra_manager/api_integration.rb      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comment 3 Ilanit Stein 2018-01-01 07:16:34 UTC
Juan,

IIUC (and please correct me if I got it wrong),
CFME UI, for version 4 of the API, connection and authentication details validation errors, will be displayed to the user.

Is there a way this fix can be verified by QE please?

Comment 4 Juan Hernández 2018-01-02 09:03:05 UTC
In order to verify this you need to check that the errors displayed to the users are the same when using version 3 and version 4 of the API. I am not sure if there is a way to force use of version 4 of the API for this; in my tests the provider always uses version 3, even if the `se_ovirt_engine_sdk` configuration parameter is set to `true`.

Boris, is there a way to force this to use version 4 of the API?

Comment 6 Ilanit Stein 2018-01-09 09:41:20 UTC
Boris,

Please see bellow the tests that were done.
Is the errors in evm.log\UI are as expected?
Are there any further tests required?

thanks. 


Tested CFME-5.9.0.15:
1. RHV-4.1.8
2. RHV-3.6.12-4

Checked:
a. Add provider with bad password & press "validate"
b. Change password of a provider, that was already added successfully,
to a bad password & press "validate".

* "Verify TLS Certificates" was set to No.

1. RHV-4.1.8
============
a.Add provider with bad password & press "validate"

UI:
Credential validation was not successful: Error during SSO authentication: access_denied: Cannot authenticate user 'admin@internal': The username or password is incorrect..
   
evm.log:
[----] E, [2018-01-09T02:20:13.223156 #41041:4c1134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [9855], Error: [Error during SSO authentication: access_denied: Cannot authenticate user 'admin@internal': The username or password is incorrect..]                                                                       
[----] E, [2018-01-09T02:20:13.223456 #41041:4c1134] ERROR -- : [OvirtSDK4::AuthError]: Error during SSO authentication: access_denied: Cannot authenticate user 'admin@internal': The username or password is incorrect..  Method:[block in method_missing]                                                                
[----] E, [2018-01-09T02:20:13.223616 #41041:4c1134] ERROR -- : /opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:473:in `create_access_token'                                                                                                                                  
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:643:in `internal_send'                                          
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:203:in `block in send'                                          
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:203:in `synchronize'                                            
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:203:in `send'                                                   
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/service.rb:191:in `internal_get'                                              
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/services.rb:23959:in `get'                                                    
/opt/rh/rh-ruby23/root/usr/share/gems/gems/ovirt-engine-sdk-4.2.1/lib/ovirtsdk4/connection.rb:231:in `test'                                                   
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb:314:in `check_connect_api'                                                                                                                                                     
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb:265:in `raw_connect'
/var/www/miq/vmdb/app/models/ext_management_system.rb:221:in `raw_connect?'
/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:253: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:357: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:355:in `start_runner_via_fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:349:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:396: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:329:in `block in monitor'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-d865ee63c000/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-d865ee63c000/lib/gems/pending/util/extensions/miq-benchmark.rb:28:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:329:in `monitor'
/var/www/miq/vmdb/app/models/miq_server.rb:351:in `block (2 levels) in monitor_loop'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-d865ee63c000/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-d865ee63c000/lib/gems/pending/util/extensions/miq-benchmark.rb:35:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:351:in `block in monitor_loop'
/var/www/miq/vmdb/app/models/miq_server.rb:350:in `loop'
/var/www/miq/vmdb/app/models/miq_server.rb:350: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, [2018-01-09T02:20:13.223808 #41041:4c1134]  INFO -- : MIQ(MiqQueue#delivered) Message id: [9855], State: [error], Delivered in [5.061720243] seconds
[----] I, [2018-01-09T02:20:13.226165 #41041:4c1134]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [9855], Invoking Callback with args: ["Finished", "error", "Error during SSO authentication: access_denied: Cannot authenticate user 'admin@internal': The username or password is incorrect..", "nil"]
[----] I, [2018-01-09T02:20:13.226569 #41041:4c1134]  INFO -- : MIQ(MiqTask#update_status) Task: [124] [Finished] [Error] [Error during SSO authentication: access_denied: Cannot authenticate user 'admin@internal': The username or password is incorrect..]

b. Change password of a provider, that was already added successfully,
to a bad password & press "validate".

UI:
Credential validation was not successful: MiqException::MiqInvalidCredentialsError

evm.log:
[----] I, [2018-01-09T02:25:56.485316 #13110:3954f7c]  INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#with_provider_connection) Connecting through ManageIQ::Providers::Redhat::InfraManager: [ge-3]
[----] W, [2018-01-09T02:26:01.546223 #13110:3954f7c]  WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#authentication_check_no_validation) type: ["default"] for [7] [ge-3] Validation failed: invalid, MiqException::MiqInvalidCredentialsError       



2. RHV-3.6.12-4
===============
a.Add provider with bad password & press "validate"

UI:
Credential validation was not successful: Unauthorized

evm.log:
[----] I, [2018-01-09T02:30:12.537425 #13044:4c1134]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [9956], MiqWorker id: [13], Zone: [default], Role: [ems_operations], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [ManageIQ::Providers::Redhat::InfraManager.raw_connect?], Timeout: [600], Priority: [100], State: [dequeue], Deliver On: [], Data: [], Args: [{:username=>"admin@internal", :password=>"********", :server=>"10.35.161.51", :port=>"", :verify_ssl=>0, :ca_certs=>nil, :metrics_username=>"", :metrics_password=>"********", :metrics_server=>"", :metrics_port=>"5432", :metrics_database=>"ovirt_engine_history", :task_id=>130}], Dequeued in: [3.980203672] seconds
[----] I, [2018-01-09T02:30:12.537569 #13044:4c1134]  INFO -- : MIQ(MiqQueue#deliver) Message id: [9956], Delivering...
[----] I, [2018-01-09T02:30:12.540709 #13044:4c1134]  INFO -- : MIQ(ManageIQ::Providers::Redhat::InfraManager.check_connect_api) IP address '10.35.161.51' has been resolved to host name 'istein-rhevm36.scl.lab.tlv.redhat.com'.
[----] E, [2018-01-09T02:30:17.676288 #13044:4c1134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [9956], Error: [Unauthorized]
[----] E, [2018-01-09T02:30:17.676514 #13044:4c1134] ERROR -- : [RestClient::Unauthorized]: Unauthorized  Method:[block in method_missing]
[----] E, [2018-01-09T02:30:17.676609 #13044:4c1134] ERROR -- : /opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb:350:in `parse_error_response'
/opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb:320:in `block in resource_verb'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/request.rb:807:in `process_result'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/request.rb:725:in `block in transmit'
/opt/rh/rh-ruby23/root/usr/share/ruby/net/http.rb:853:in `start'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
/opt/rh/cfme-gemset/gems/rest-client-2.0.2/lib/restclient/resource.rb:51:in `get'
/opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb:315:in `resource_verb'
/opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb:289:in `resource_get'
/opt/rh/cfme-gemset/gems/ovirt-0.18.1/lib/ovirt/service.rb:181:in `standard_collection'
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/lib/manageiq/providers/ovirt/legacy/inventory.rb:118:in `standard_collection'
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/lib/manageiq/providers/ovirt/legacy/inventory.rb:15:in `api'
/opt/rh/rh-ruby23/root/usr/share/ruby/delegate.rb:83:in `method_missing'
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb:323:in `check_connect_api'
/opt/rh/cfme-gemset/bundler/gems/manageiq-providers-ovirt-4e1157af902f/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb:265:in `raw_connect'
/var/www/miq/vmdb/app/models/ext_management_system.rb:221:in `raw_connect?'
/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:253: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:357: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:355:in `start_runner_via_fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:349:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:396: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.rb:141:in `start'
/var/www/miq/vmdb/app/models/miq_server.rb:233: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, [2018-01-09T02:30:17.676779 #13044:4c1134]  INFO -- : MIQ(MiqQueue#delivered) Message id: [9956], State: [error], Delivered in [5.13919436] seconds
[----] I, [2018-01-09T02:30:17.679924 #13044:4c1134]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [9956], Invoking Callback with args: ["Finished", "error", "Unauthorized", "nil"]
[----] I, [2018-01-09T02:30:17.680293 #13044:4c1134]  INFO -- : MIQ(MiqTask#update_status) Task: [130] [Finished] [Error] [Unauthorized]

b. Change password of a provider, that was already added successfully,
to a bad password & press "validate".

UI:
Credential validation was not successful: Incorrect user name or password.

evm.log:
[----] W, [2018-01-09T04:20:47.666340 #13110:3954f7c]  WARN -- : MIQ(ManageIQ::Providers::Redhat::InfraManager#authentication_check_no_validation) type: ["default"] for [8] [rhv-3.6] Validation failed: invalid, Incorrect user name or password.

Comment 7 CFME Bot 2018-01-09 14:18:32 UTC
New commit detected on ManageIQ/manageiq-providers-ovirt/gaprindashvili:
https://github.com/ManageIQ/manageiq-providers-ovirt/commit/361e1ad3723bd9f5b31df0edb90e2a885c4d9e27

commit 361e1ad3723bd9f5b31df0edb90e2a885c4d9e27
Author:     Moti Asayag <masayag@redhat.com>
AuthorDate: Tue Jan 9 12:31:28 2018 +0200
Commit:     Satoe Imaishi <simaishi@redhat.com>
CommitDate: Tue Jan 9 09:11:07 2018 -0500

    Merge pull request #188 from borod108/bugs/verify_cred_exceptions
    
    Credential verification errors for new provider
    (cherry picked from commit 92a547bb9267d3d2a13f4631df70877d756b3f7b)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1519815

 .../redhat/infra_manager/api_integration.rb        | 57 +++++++++++++---------
 1 file changed, 33 insertions(+), 24 deletions(-)

Comment 8 Ilanit Stein 2018-01-11 13:39:32 UTC
Verified on CME-5.9.0.16/RHV-4.1.8, RHV-3.6.12-4:

Here are the error messages, displayed in UI, for edit/add a RHV provider,
with wrong password:

RHV-3.6 edit: 
Credential validation was not successful: Incorrect user name or password.
RHV-3.6 add:  
Credential validation was not successful: Incorrect user name or password.

RHV-4.1 edit: 
Credential validation was not successful: MiqException::MiqInvalidCredentialsError
RHV-4.1 add:  
Credential validation was not successful: MiqException::MiqInvalidCredentialsError

Note that as the error message, for RHV-4.1 provider is not so clear, as for RHV-3.6, added this bug to fix it:
 
Bug 1533486 - Credential validation error message is not user friendly, for RHV providers supporting api version 4


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