Bug 1112733

Summary: Adding EAP 6 server with additional outbound socket binding ref to the inventory will incorrectly add the same binding to the mail configuration of the JBoss ON Server resource (RHQ Server)
Product: [JBoss] JBoss Operations Network Reporter: bkramer <bkramer>
Component: Plugin -- JBoss EAP 6, InventoryAssignee: Michael Burman <miburman>
Status: CLOSED CURRENTRELEASE QA Contact: Armine Hovsepyan <ahovsepy>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: JON 3.2.1CC: ahovsepy, bkramer, jkremser, loleary, mfoley, miburman, myarboro
Target Milestone: ER05Keywords: Triaged
Target Release: JON 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
It was discovered that adding an additional EAP server to the inventory that had an additional outbound socket binding reference added the same binding option to the mail configuration for every EAP server. The Outbound Socket Binding Reference showed radio buttons for all available values in any EAP instance added to the inventory. If the incorrect option from another EAP was selected, the configuration saved successfully and EAP server restarted, it would throw a "missing dependents" Exception and mail could no longer be sent from the server. Query used to select available socket binding options was limited to the instance that is being configured.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-11 14:02:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1112736    
Attachments:
Description Flags
smtp_outbound_socket_binding_ref none

Description bkramer 2014-06-24 15:15:03 UTC
Description of problem:
Adding EAP 6 server with additional outbound socket binding ref to the inventory will incorrectly add the same binding to the mail configuration of the JBoss ON Server resource (RHQ Server). 

Version-Release number of selected component (if applicable):
JBoss ON 3.2 and 3.2.1

How reproducible:
Always

Steps to Reproduce:
1. On the first box (server1) unzip JBoss ON 3.2.1 zip file;
2. Change $JON-SERVER/bin/rhq-server.properties file, set the following properties and save the file:
...
# Email settings used to connect to an SMTP server to send alert emails.
rhq.server.email.smtp-host=my.smtp.server.com
rhq.server.email.smtp-port=25
rhq.server.email.from-address=test
... 
3. Install JBoss ON 3.2.1 and it's components;
4. Install plugins for EAP;
5. Start storage nodes, JBoss ON Server and JBoss ON Agent and import RHQ Server into inventory;
6. Navigate to RHQ Server resource -> mail -> Mail Sessions -> java:jboss/mail/Default -> smtp and confirm that only one Outbound Socket Binding Ref is listed there (mail-smtp).
7. On another box (server2) install and configure JBoss ON Agent 3.2.1 to connect to the first box (server1);
8. On the server2 install EAP 6.x server in standalone mode, add management user and start the server;
9. Using JBoss CLI, execute the following to add new outbound socket binding:

/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=redhat:add(host=my.smtp.server.com,port=25)
{"outcome" => "success"}

so should have something like:

/socket-binding-group=standard-sockets:read-resource(recursive=true)
{
    "outcome" => "success",
    "result" => {
        "default-interface" => "public",
        "name" => "standard-sockets",
        "port-offset" => expression "${jboss.socket.binding.port-offset:0}",
        "local-destination-outbound-socket-binding" => undefined,
        "remote-destination-outbound-socket-binding" => {
            "mail-smtp" => {
                "fixed-source-port" => false,
                "host" => "localhost",
                "port" => 25,
                "source-interface" => undefined,
                "source-port" => undefined
            },
            "redhat" => {
                "fixed-source-port" => false,
                "host" => "my.smtp.server.com",
                "port" => 25,
                "source-interface" => undefined,
                "source-port" => undefined
            }
        },
...

10. Import this EAP instance and platform to the inventory of the JBoss ON Server (installed on server1);
10. In JBoss ON UI navigate to the RHQ Server resource -> mail -> Mail Sessions -> java:jboss/mail/Default -> smtp -> Configuration and check Outbound Socket Binding Ref.


Actual results:
Outbound Socket Binding Ref will show two radio buttons and two values (first one originally configured and the second one that is configured in the EAP instance installed on the server2)

Expected results:
Outbound Socket Binding Ref shows only one value - the one that was originally configured.


Additional info:
If, for some reason, second (incorrect) option is selected, configuration saved and JBoss ON server restarted, during server restart it will throw the following Exception: 

***********************************************************************
15:11:37,704 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.outbound-socket-binding.redhat (missing) dependents: [service jboss.mail-session.java:jboss/mail/Default] 

15:11:37,920 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:6990/management
15:11:37,920 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015954: Admin console is not enabled
15:11:37,921 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) started (with errors) in 39016ms - Started 4934 of 5045 services (1 services failed or missing dependencies, 104 services are passive or on-demand)
***********************************************************************
and JBoss ON Server will not be able to send emails any more. 

However, if we revert back to the original setting, the JBoss ON Server will be correctly started and emails will be properly sent.

Comment 1 Larry O'Leary 2014-06-25 15:57:34 UTC
From the sound of it, the socket bindings are being read from all JBoss EAP 6 servers and displayed on a single one. This seems bad.

Comment 3 Michael Burman 2014-08-19 19:46:50 UTC
Can you still replicate this with 3.3.0? If so, can you leave the instance in a state where I could take a look? I still think this is a stale-UI issue (browser related maybe), instead of real issue.

Comment 7 Simeon Pinder 2014-09-29 08:12:27 UTC
Moving into ER05 as didn't make the ER04 cut.

Comment 8 Michael Burman 2014-10-01 14:57:02 UTC
Fixed in master:

commit d1ffbbd81ef531e8fcc64e1f5e61e7e6e8a17236
Author: Michael Burman <miburman>
Date:   Wed Oct 1 17:55:59 2014 +0300

    [BZ 1112733] Define expressionScope baseResource to the option-source

Comment 9 Jirka Kremser 2014-10-03 12:06:19 UTC
branch:  release/jon3.3.x
link:    https://github.com/rhq-project/rhq/commit/60c94926d
time:    2014-10-03 14:05:40 +0200
commit:  60c94926dca8ea3bb1b81c779526ea57a37fa72b
author:  Michael Burman - miburman
message: [BZ 1112733] Define expressionScope baseResource to the option-source

         (cherry picked from commit
         d1ffbbd81ef531e8fcc64e1f5e61e7e6e8a17236) Signed-off-by: Jirka
         Kremser <jkremser>

Comment 10 Simeon Pinder 2014-10-21 20:24:03 UTC
Moving to ON_QA as available to test with the latest brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=394734

Comment 11 Armine Hovsepyan 2014-10-27 13:52:52 UTC
Created attachment 951012 [details]
smtp_outbound_socket_binding_ref

Comment 12 Armine Hovsepyan 2014-10-27 13:56:26 UTC
verified in JON 3.3 ER05
screen-shot attached