Bug 593721

Summary: implement tomcat6 resource agent since RHEL6 does not have tomcat5
Product: Red Hat Enterprise Linux 6 Reporter: Marek Grac <mgrac>
Component: resource-agentsAssignee: Marek Grac <mgrac>
Status: CLOSED CURRENTRELEASE QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: cluster-maint, djansa, edamato, lhh, rmicmirregs, syeghiay
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: resource-agents-3.0.12-14.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 591003
: 614127 614130 (view as bug list) Environment:
Last Closed: 2010-11-10 22:15:54 UTC Type: ---
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: 591003, 637802    
Bug Blocks: 614127, 614130    

Description Marek Grac 2010-05-19 15:09:22 UTC
+++ This bug was initially created as a clone of Bug #591003 +++

Description of problem:

Errors in the file /usr/share/cluster/tomcat-5.sh resource script, part of rgmanager, that leaves the script unusable.


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

rgmanager-2.0.52-6.el5

How reproducible:

Always


Steps to Reproduce:
1. Use the attached /etc/cluster/cluster.conf


2. Use the attached /etc/tomcat5/tomcat5.conf


3. Use the attached /etc/tomcat5/server.xml



4.- start cluster services cman and rgmanager

service cman start
service rgmanager start

5.- Use "rg_test" to enable the Artifactory01 service

rg_test test /etc/cluster/cluster.conf start service Artifactory01

  
Actual results:

1.- "rg_test" says the Service is started, when it doesn't. There are no java processess running on the system

2.- Checking /etc/cluster/tomcat-5/tomcat-5:Artifactory01/logs/catalina.out the problem is due to a problem with the "su" invocation line at /usr/share/cluster/tomcat-5.sh resource script:

su "$TOMCAT_USER" -c "$JAVA_HOME/bin/java" $JAVA_OPTS $OCF_RESKEY_catalina_options \
                -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
                -Dcatalina.base="$TOMCAT_gen_catalina_base" \
                -Dcatalina.home="$CATALINA_HOME" \
                -Djava.io.tmpdir="$CATALINA_TMPDIR" \
                org.apache.catalina.startup.Bootstrap "$@" start \
                >> "$TOMCAT_gen_catalina_base"/logs/catalina.out 2>&1 &


Changing it to the following it is fixed:

 su "$TOMCAT_USER"  -c " \"$JAVA_HOME/bin/java\" $JAVA_OPTS $OCF_RESKEY_catalina_options \
                -Djava.endorsed.dirs=\"$JAVA_ENDORSED_DIRS\" -classpath \"$CLASSPATH\" \
                -Dcatalina.base=\"$TOMCAT_gen_catalina_base\" \
                -Dcatalina.home=\"$CATALINA_HOME\" \
                -Djava.io.tmpdir=\"$CATALINA_TMPDIR\" \
                org.apache.catalina.startup.Bootstrap \"$@\" start " \
                >> "$TOMCAT_gen_catalina_base"/logs/catalina.out 2>&1 &


3.- There are errors in the parsing of the generated server.xml file in catalina.out  ue to its usage of commented lines in the "sha1_addToFile" function defined in the /usr/share/cluster/utils/config-utils.sh file:

sha1_addToFile()
{
        declare sha1line="# rgmanager-sha1 $(sha1sum "$1")"
        echo $sha1line >> "$1"
}

Adding the following function to /usr/share/cluster/utils/config-utils.sh will fix it:

sha1_addToFileXML()
{
        declare sha1line="<!--\n# rgmanager-sha1 $(sha1sum "$1") \n-->"
        echo -e $sha1line >> "$1"
}

Also it is necessary to change the line of /usr/share/cluster/tomcat-5.sh

        sha1_addToFile "$generated_file"

to the following:

        sha1_addToFileXML "$generated_file"

4.- Changing the the file /etc/tomcat5/server.xml causes the tomcat-5.sh resource script re-generate its own server.xml file located at /etc/cluster/tomcat-5/tomcat-5:Artifactory01/conf/server.xml, but the regeneration concatenates the contents with the previous file causing more parsing errors in catalina.out . This is due to the "generate_config_file" function located in /usr/share/cluster/tomcat-5.sh

generate_config_file()
{
	declare original_file="$1"
	declare generated_file="$2"
	declare ip_addresses="$3"

	if [ -f "$generated_file" ]; then
		sha1_verify "$generated_file"
		if [ $? -ne 0 ]; then
			clog_check_sha1 $CLOG_FAILED
			return 0
		fi
	fi	

	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"

#	generate_configTemplate "$generated_file" "$original_file"
	$(dirname $0)/utils/tomcat-parse-config.pl $ip_addresses < "$original_file" >> "$generated_file"

        sha1_addToFile "$generated_file"
	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
               
	return 0;
}


Changing it to the following will fix it:

generate_config_file()
{
	declare original_file="$1"
	declare generated_file="$2"
	declare ip_addresses="$3"

	if [ -f "$generated_file" ]; then
		sha1_verify "$generated_file"
		if [ $? -ne 0 ]; then
			clog_check_sha1 $CLOG_FAILED
		else
			return 0
		fi
		
	fi	

	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"

#	generate_configTemplate "$generated_file" "$original_file"
	$(dirname $0)/utils/tomcat-parse-config.pl $ip_addresses < "$original_file" > "$generated_file"

        sha1_addToFileXML "$generated_file"
	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
               
	return 0;
}


Expected results:

1.- Detection of Tomcat not starting. In this case we used "rg_test", so it's a minot bug

2.- No errors, Tomcat started

3.- No parsing errors in catalina.out

4.- No parsing errors in catalina.out

Additional info:

--- Additional comment from rmicmirregs on 2010-05-11 03:39:15 EDT ---

Created an attachment (id=413058)
Cluster.conf, tomcat5.conf, server.xml

Comment 2 RHEL Program Management 2010-06-07 16:03:41 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 8 Marek Grac 2010-07-13 18:01:24 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
We do not support multiple instance of tomcat6 on cluster.

Comment 9 Marek Grac 2010-07-14 07:42:03 UTC
Deleted Technical Notes Contents.

Old Contents:
We do not support multiple instance of tomcat6 on cluster.

Comment 15 Dean Jansa 2010-08-24 14:41:06 UTC
[root@marathon-01 doc]# cd /usr/share/cluster/
[root@marathon-01 cluster]# ls tomcat-6*
tomcat-6.metadata  tomcat-6.sh


Tomcat-6 agent installed in latest tree

Comment 16 releng-rhel@redhat.com 2010-11-10 22:15:54 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.