Bug 1077412

Summary: Restart operation on EAP 5 resource doesn't return failure message when restart fails
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: Plugin -- JBoss EAP 5Assignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Filip Brychta <fbrychta>
Severity: medium Docs Contact:
Priority: high    
Version: JON 3.1.2, JON 3.2CC: ajuricic, fbrychta, myarboro, tsegismo
Target Milestone: DR01   
Target Release: JON 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The restart operation for the AS5 plug-in did not fail when a failure occurred for the shutdown or start portion of the command. The Restart operation reported success regardless of the fact the existing process was still running and was not restarted (shutdown failed and start failed). A fix to the Server component class takes stop/start subtasks results into account. If there is an error message in the subtask result, the "restart" operation is failed and reports this message.
Story Points: ---
Clone Of:
: 1077418 1119515 (view as bug list) Environment:
Last Closed: 2014-12-11 14:00:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1077418, 1119515    

Description Larry O'Leary 2014-03-17 23:02:54 UTC
Description of problem:
The restart operation for the AS5 plug-in does not fail when a failure occurs for the shutdown or start portion of the command.

Version-Release number of selected component (if applicable):
4.4.0.JON312GA

How reproducible:
Always

Steps to Reproduce:
1.  Install, configure, and start JBoss EAP 5.2 default server.
2.  Install, configure, and start JBoss ON system.
3.  Create custom shutdown script for JBoss EAP server which sleeps for a bit and then does nothing:

        cat >"${JBOSS_HOME}"'/bin/custom-shutdown' <<EOF
#!/bin/sh
# This script will simply block for 5 seconds and then exits.
JBOSS_HOME="${JBOSS_HOME}"

/bin/sleep 5s
exit 1
EOF
        chmod +x "${JBOSS_HOME}"'/bin/custom-shutdown'
        
4.  Import JBoss EAP default server into inventory.
5.  Configure EAP resource connection settings to use custom-shutdown script for shutdown command.
6.  Invoke the restart operation for the JBoss EAP resource.

Actual results:
Restart operation reports success yet the existing process is still running and was not restarted (shutdown failed and start failed).

Expected results:
Restart operations reports failure due to the shutdown operation failing (i.e. JBoss EAP resource still AVAIL)

Additional info:
This appears to be a result of a change that may have been introduced since the EAP 4 plug-in or in how exception handling was being used.

Specifically, the restart operation is expecting the underlying shutdown and start operations to throw an exception if there is a failure. However, those methods no longer do that. Instead, they set the errorMessage of the operation response to indicate that a failure occurred and what the failure was. This means that instead of expecting an exception to be thrown, the restart operation should also expect that a failure message could be set and treat the message appropriately.

Comment 1 Thomas Segismont 2014-03-18 21:37:39 UTC
Reproduced on a master build. Fixed in master branch:

commit 145463496ed1b6dcc7d09193965a77c737bc29b4
Author: Thomas Segismont <tsegismo@redhat.com>
Date:   Tue Mar 18 22:30:03 2014 +0100

Waiting for nightly builds before cherry-picking over release branches.

Comment 7 Thomas Segismont 2014-04-28 15:31:34 UTC
Cherry-picked over to release/jon3.2.x branch

commit 82bffc4070b6cd879c19d7f9cfd053adf0bfb6ee
Author: Thomas Segismont <tsegismo@redhat.com>
Date:   Mon Apr 28 17:29:37 2014 +0200

Comment 10 Simeon Pinder 2014-07-31 15:51:29 UTC
Moving to ON_QA as available to test with brew build of DR01: https://brewweb.devel.redhat.com//buildinfo?buildID=373993

Comment 11 Filip Brychta 2014-08-05 14:23:54 UTC
Verified 
Version :	
3.3.0.DR01
Build Number :	
6468454:dda0a47