Bug 1427141

Summary: Middleware - Add new Datasource Fails
Product: Red Hat CloudForms Management Engine Reporter: Hayk Hovsepyan <hhovsepy>
Component: ProvidersAssignee: Mike Thompson <mithomps>
Status: CLOSED EOL QA Contact: Hayk Hovsepyan <hhovsepy>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: abonas, hhovsepy, jfrey, jhardy, mazz, mfoley, mithomps, mmahoney, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, Triaged
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1446251 (view as bug list) Environment:
Last Closed: 2018-03-06 15:40:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Middleware Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1446251    

Description Hayk Hovsepyan 2017-02-27 12:56:39 UTC
Description of problem:
Adding new Datasource with selecting Existing Driver fails with message:
"The operation Add Datasource SybaseDS4 on Local (acef1e91-77b1-4419-8f52-dd5d830d410c) has failed to complete. Please check the logs for further details. "

EAP7 server log in this case is: "12:46:12,581 INFO  [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://docker-haw-services.bc.jonqe.lab.eng.bos.redhat.com:8080/...) HAWKMONITOR010065: Received request to perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;acef1e91-77b1-4419-8f52-dd5d830d410c/r;Local~~]"


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

How reproducible:
always

Steps to Reproduce:
For EAP7 server:
1. Add JDBC Driver, for any of supported database types.
2. Add Datasource and on "Step 2/3: JDBC Driver" choose just added JDBC Driver.
3. Check that Add Datasource operation was failed.

Actual results:
Add Datasource operation fails when choosing JDBC Driver from uploaded drivers.

Expected results:
Operation should be successful.

Additional info:
In the case, when adding new Datasource, and in "Step 2/3: JDBC Driver" step typing newly added JDBC driver Name and Module, then operations completes successfully.

Comment 2 Heiko W. Rupp 2017-02-27 13:26:51 UTC
Mike, can you have a look and/or distribute to someone else, who may know more

Comment 5 John Mazzitelli 2017-03-24 12:49:56 UTC
Turn on agent debug logging and attach the agent logs. Need to see the debug log messages and all error msgs logged by the agent.

Comment 6 Mike Thompson 2017-03-24 17:39:59 UTC
Here are the logs: 

10:20:01,361 DEBUG [org.hawkular.agent.monitor.cmd.FeedCommProcessor] (OkHttp http://localhost:8080/...) Received message from server
10:20:01,362 INFO  [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://localhost:8080/...) HAWKMONITOR010065: Received request to perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;7e100b1d-da47-44f8-b60f-666f87580d57/r;Local~~]
10:20:01,371 DEBUG [org.jboss.as.controller.management-operation] (OkHttp http://localhost:8080/...) Entered VERIFY stage; waiting for service container to settle
10:20:01,372 ERROR [org.jboss.as.controller.management-operation] (OkHttp http://localhost:8080/...) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "PostgresDS6")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.driver-demander.java:jboss/datasources/PostgresDS6 is missing [jboss.jdbc-driver.postresql]",
    "org.wildfly.data-source.PostgresDS6 is missing [jboss.jdbc-driver.postresql]"
]}
10:20:01,373 DEBUG [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) Removed JDBC Data-source [java:jboss/datasources/PostgresDS6]
10:20:01,374 INFO  [org.jboss.as.controller] (OkHttp http://localhost:8080/...) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.data-source.reference-factory.PostgresDS6 (missing) dependents: [service jboss.naming.context.java.jboss.datasources.PostgresDS6]
      service jboss.data-source-config.PostgresDS6 (missing) dependents: [service org.wildfly.data-source.PostgresDS6]
WFLYCTL0185:    Newly corrected services:
      service jboss.data-source.reference-factory.PostgresDS (no longer required)
      service jboss.data-source-config.PostgresDS (no longer required)
 
10:20:01,375 DEBUG [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://localhost:8080/...) Could not perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;7e100b1d-da47-44f8-b60f-666f87580d57/r;Local~~] requested on [2017-03-24T17:20Z]: org.hawkular.dmr.api.OperationFailureException: Could not perform operation [composite]: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:jboss/datasources/PostgresDS6 is missing [jboss.jdbc-driver.postresql]","org.wildfly.data-source.PostgresDS6 is missing [jboss.jdbc-driver.postresql]"]}}}: org.hawkular.dmr.api.OperationFailureException: Could not perform operation [composite]: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:jboss/datasources/PostgresDS6 is missing [jboss.jdbc-driver.postresql]","org.wildfly.data-source.PostgresDS6 is missing [jboss.jdbc-driver.postresql]"]}}}
        at org.hawkular.dmr.api.OperationBuilder$OperationResult.assertSuccess(OperationBuilder.java:433)
        at org.hawkular.agent.monitor.cmd.AddDatasourceCommand.execute(AddDatasourceCommand.java:120)
        at org.hawkular.agent.monitor.cmd.AddDatasourceCommand.execute(AddDatasourceCommand.java:45)
        at org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand.execute(AbstractResourcePathCommand.java:133)
        at org.hawkular.agent.monitor.cmd.FeedCommProcessor.onMessage(FeedCommProcessor.java:396)
        at okhttp3.internal.ws.RealWebSocket$1.onMessage(RealWebSocket.java:62)
        at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:242)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:108)
        at okhttp3.internal.ws.RealWebSocket.readMessage(RealWebSocket.java:97)
        at okhttp3.ws.WebSocketCall.createWebSocket(WebSocketCall.java:152)
        at okhttp3.ws.WebSocketCall.access$000(WebSocketCall.java:41)
        at okhttp3.ws.WebSocketCall$1.onResponse(WebSocketCall.java:97)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:61

Comment 7 John Mazzitelli 2017-03-24 17:49:05 UTC
I think the "add datasource" JSON command the UI is sending is wrong. It has a typo in the driverName option in the AddDatasourceRequest command:


https://github.com/hawkular/hawkular-commons/blob/master/hawkular-command-gateway/hawkular-command-gateway-api/src/main/resources/schema/AddDatasourceRequest.schema.json#L24

in the JSON command when adding a datasource,one of the things you say is "driverName" (as you see in the link there).

I suspect the command the MiQ UI is sending the wrong driver name (it is missing the "G" in "postresql"

Comment 8 John Mazzitelli 2017-03-24 17:54:44 UTC
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/assets/javascripts/controllers/middleware_datasource/middleware_datasource_service.js#L14

{id: 'POSTGRES', label: 'Postgres', name: 'PostgresDS', jndiName: 'java:jboss/datasources/PostgresDS',
       driverName: 'postresql', driverModuleName: 'org.postgresql', driverClass: 'org.postgresql.Driver',

Look at "driverName" - it is missing a "g"

Comment 9 John Mazzitelli 2017-03-24 17:56:42 UTC
(In reply to John Mazzitelli from comment #8)
> https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/assets/
> javascripts/controllers/middleware_datasource/middleware_datasource_service.
> js#L14
> 
> {id: 'POSTGRES', label: 'Postgres', name: 'PostgresDS', jndiName:
> 'java:jboss/datasources/PostgresDS',
>        driverName: 'postresql', driverModuleName: 'org.postgresql',
> driverClass: 'org.postgresql.Driver',
> 
> Look at "driverName" - it is missing a "g"

The typo is in there twice. Search for "postresql" and you'll see it on line 14 and 46. Just search for it and fix all the places where that typo is.

Comment 10 Mike Thompson 2017-03-24 22:08:38 UTC
That was a typo, but that only applies to the Postgres Datasource.

Here is the latest with that typo fixed:

14:40:01,517 INFO  [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://localhost:8080/...) HAWKMONITOR010065: Received request to perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;7e100b1d-da47-44f8-b60f-666f87580d57/r;Local~~]
14:40:01,521 DEBUG [org.jboss.as.controller.management-operation] (OkHttp http://localhost:8080/...) Entered VERIFY stage; waiting for service container to settle
14:40:01,521 ERROR [org.jboss.as.controller.management-operation] (OkHttp http://localhost:8080/...) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "PostgresDS")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.driver-demander.java:jboss/datasources/PostgresDS is missing [jboss.jdbc-driver.postgresql]",
    "org.wildfly.data-source.PostgresDS is missing [jboss.jdbc-driver.postgresql]"
]}
14:40:01,523 DEBUG [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) Removed JDBC Data-source [java:jboss/datasources/PostgresDS]
14:40:01,524 INFO  [org.jboss.as.controller] (OkHttp http://localhost:8080/...) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.data-source.reference-factory.PostgresDS (missing) dependents: [service jboss.naming.context.java.jboss.datasources.PostgresDS]
      service jboss.data-source-config.PostgresDS (missing) dependents: [service org.wildfly.data-source.PostgresDS]
WFLYCTL0185:    Newly corrected services:
      service jboss.data-source.reference-factory.ABC_Driver (no longer required)
      service jboss.data-source-config.ABC_Driver (no longer required)

14:40:01,525 DEBUG [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://localhost:8080/...) Could not perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;7e100b1d-da47-44f8-b60f-666f87580d57/r;Local~~] requested on [2017-03-24T21:40Z]: org.hawkular.dmr.api.OperationFailureException: Could not perform operation [composite]: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:jboss/datasources/PostgresDS is missing [jboss.jdbc-driver.postgresql]","org.wildfly.data-source.PostgresDS is missing [jboss.jdbc-driver.postgresql]"]}}}: org.hawkular.dmr.api.OperationFailureException: Could not perform operation [composite]: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:jboss/datasources/PostgresDS is missing [jboss.jdbc-driver.postgresql]","org.wildfly.data-source.PostgresDS is missing [jboss.jdbc-driver.postgresql]"]}}}
	at org.hawkular.dmr.api.OperationBuilder$OperationResult.assertSuccess(OperationBuilder.java:433)
	at org.hawkular.agent.monitor.cmd.AddDatasourceCommand.execute(AddDatasourceCommand.java:120)
	at org.hawkular.agent.monitor.cmd.AddDatasourceCommand.execute(AddDatasourceCommand.java:45)
	at org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand.execute(AbstractResourcePathCommand.java:133)
	at org.hawkular.agent.monitor.cmd.FeedCommProcessor.onMessage(FeedCommProcessor.java:396)
	at okhttp3.internal.ws.RealWebSocket$1.onMessage(RealWebSocket.java:62)
	at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:242)
	at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:108)
	at okhttp3.internal.ws.RealWebSocket.readMessage(RealWebSocket.java:97)
	at okhttp3.ws.WebSocketCall.createWebSocket(WebSocketCall.java:152)
	at okhttp3.ws.WebSocketCall.access$000(WebSocketCall.java:41)
	at okhttp3.ws.WebSocketCall$1.onResponse(WebSocketCall.java:97)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)

Comment 11 Mike Thompson 2017-03-24 22:30:30 UTC
MySql is successful:

15:24:52,623 INFO  [org.hawkular.agent.monitor.cmd.AbstractResourcePathCommand] (OkHttp http://localhost:8080/...) HAWKMONITOR010065: Received request to perform [Add] on a [Datasource] given by inventory path [/t;hawkular/f;7e100b1d-da47-44f8-b60f-666f87580d57/r;Local~~]
15:24:52,629 DEBUG [org.jboss.as.controller.management-operation] (OkHttp http://localhost:8080/...) Entered VERIFY stage; waiting for service container to settle
15:24:52,636 DEBUG [org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-8) Adding management datasource: DataSource@6375202c xa=false jndiName=java:jboss/datasources/MySqlDS pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@574a6006 poolconfiguration=PoolConfiguration@473048c8[minSize=0 initialSize=null maxSize=20 blockingTimeout=30000 idleTimeoutMinutes=30 validateOnMatch=false backgroundValidation=false backgroundValidationMillis=0 prefill=false strictMin=false useFastFail=false fair=true] statistics=org.jboss.jca.adapters.jdbc.statistics.JdbcStatisticsPlugin@25402555]
15:24:52,639 DEBUG [org.jboss.as.connector.deployer.dsdeployer] (MSC service thread 1-8) Adding datasource: java:jboss/datasources/MySqlDS
15:24:52,641 DEBUG [org.jboss.as.connector] (MSC service thread 1-7) Started CommonDeployment %s
15:24:52,641 DEBUG [org.jboss.as.connector] (MSC service thread 1-1) Starting DataSourceStatisticsService
15:24:52,642 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/MySqlDS]

Comment 12 Alissa 2017-04-09 10:53:51 UTC
Mike, is the fix in this PR?
https://github.com/ManageIQ/manageiq-ui-classic/pull/941

Comment 13 Mike Thompson 2017-04-10 15:14:39 UTC
Alissa, yes that is the correct PR.

Comment 14 Alissa 2017-04-23 14:03:40 UTC
(In reply to Mike Thompson from comment #13)
> Alissa, yes that is the correct PR.

shouldn't the BZ status change now that it's merged?

Comment 16 Hayk Hovsepyan 2017-10-10 10:48:31 UTC
Verified on 5.9.0.1.20171004215954_13427ce