Hi Dejan,

Thanks for the patch comments - I am completely uncertain as to what format the 
patches need to be in so feel free to let me know (I've used diff -uNr).

1. If empty, CATALINA_BASE needs to be set to CATALINA_HOME (this is what 
catalina.sh does and what is documented by Apache in RUNNING.txt) or not 
exported.
Its easier to simply set it identical to CATALINA_HOME and export them both 
(I'll correct this).

2. I'll document the meta-data properly - this will require improving the 
comments on the existing meta-data but 
I didn't want the patch to be too confusing initially. The patch was only to 
demonstrate I hadn't modified the 
original resource agent to any large degree.

Those two items aside.

There are other environment variables used by Tomcat, they are normally 
specified by a 'setenv.sh' file 
located in CATALINA_BASE/bin/

In order to make it simpler for a person running Tomcat manually (e.g. during 
testing) and a resource agent running 
tomcat to get exactly the same results, my personal preference would be to 
specify a file that contains all the 
environment variables that need to be used (e.g. the setenv.sh file).  Only the 
CATALINA_HOME, CATALINA_BASE and 
CATALINA_PID variables would then need to be exported in any subsequent calls 
(the catalina.sh script would read 
setenv.sh and include all other variables accordingly).

Is this type of mechanism (using an external file for parameters) logically 
correct and permissible 
by the OCF standard?

If so, I'll correct accordingly and repost.

Thanks for your help / guidance,

Best Regards,

Brett


-----Original Message-----
From: Dejan Muhamedagic [mailto:deja...@fastmail.fm]
Sent: Fri 09/07/2010 11:47
To: General Linux-HA mailing list
Subject: Re: [Linux-HA] Tomcat Resource Agent always leaves dead process on 
stop or restart
 
Hi again,

Forgot to comment on your patch.

On Thu, Jul 08, 2010 at 10:35:57AM +0100, Brett Delle Grazie wrote:
> 
> Hi,
> 
> [...]
> 
> I have modified the Tomcat resource agent to be capable of
> controlling multiple Tomcat instances by exporting
> CATALINA_BASE as well as CATALINA_HOME - these are the only
> changes I've made to the resource agent (this is why the agent
> path is 'intact' instead of 'heartbeat' in the process list
> below) - diff attached.
> 
> [...]
> 
> --- tomcat    2010-07-08 09:34:13.000000000 +0100
> +++ tomcat.intact     2010-07-08 10:24:51.000000000 +0100
> @@ -29,7 +29,9 @@
>  #   OCF_RESKEY_tomcat_user  - A user name to start a resource. Default is 
> root
>  #   OCF_RESKEY_statusurl - URL for state confirmation. Default is 
> http://127.0.0.1:8080
>  #   OCF_RESKEY_java_home - Home directory of the Java. Default is None
> +#   OCF_RESKEY_java_opts - Options to parse to Java. Always adds 
> -Dname=OCF_RESKEY_tomcat_name
>  #   OCF_RESKEY_catalina_home - Home directory of Tomcat. Default is None
> +#   OCF_RESKEY_catalina_base - Base directory of Tomcat. Default is None
>  #   OCF_RESKEY_catalina_pid  - A PID file name of Tomcat. Default is 
> OCF_RESKEY_catalina_home/logs/catalina.pid
>  #   OCF_RESKEY_tomcat_start_opts - Start options of the tomcat. Default is 
> None.
>  #   OCF_RESKEY_catalina_opts - CATALINA_OPTS environment variable. Default 
> is None.
> @@ -147,11 +149,12 @@
>                       >> "$TOMCAT_CONSOLE" 2>&1 &
>       else
>               su - -s /bin/sh "$RESOURCE_TOMCAT_USER" \
> -                     -c "export JAVA_HOME=${OCF_RESKEY_java_home};\n
> -                            export JAVA_OPTS=-Dname=${TOMCAT_NAME};\n
> -                            export 
> CATALINA_HOME=${OCF_RESKEY_catalina_home};\n
> -                            export CATALINA_PID=${OCF_RESKEY_catalina_pid};\n
> -                            export 
> CATALINA_OPTS=\"${OCF_RESKEY_catalina_opts}\";\n
> +                     -c "export JAVA_HOME=${OCF_RESKEY_java_home};\
> +                            export JAVA_OPTS=\"-Dname=${TOMCAT_NAME} 
> ${OCF_RESKEY_java_opts}\";\
> +                            export 
> CATALINA_HOME=${OCF_RESKEY_catalina_home};\
> +                            export 
> CATALINA_BASE=${OCF_RESKEY_catalina_base};\

If the new parameter is not set, how would this export affect the
resource? Isn't it that there is otherwise some default set?
Also, do you have any idea why it wasn't used in the resource
agents before?

> +                            export CATALINA_PID=${OCF_RESKEY_catalina_pid};\
> +                            export 
> CATALINA_OPTS=\"${OCF_RESKEY_catalina_opts}\";\
>                              $CATALINA_HOME/bin/catalina.sh start 
> ${OCF_RESKEY_tomcat_start_opts}" \
>                       >> "$TOMCAT_CONSOLE" 2>&1 &
>       fi
> @@ -182,10 +185,11 @@
>               eval $tomcat_stop_cmd >> "$TOMCAT_CONSOLE" 2>&1
>       else
>               su - -s /bin/sh "$RESOURCE_TOMCAT_USER" \
> -                     -c "export JAVA_HOME=${OCF_RESKEY_java_home};\n
> -                            export JAVA_OPTS=-Dname=${TOMCAT_NAME};\n
> -                            export 
> CATALINA_HOME=${OCF_RESKEY_catalina_home};\n
> -                            export CATALINA_PID=${OCF_RESKEY_catalina_pid};\n
> +                     -c "export JAVA_HOME=${OCF_RESKEY_java_home};\
> +                            export JAVA_OPTS=\"-Dname=${TOMCAT_NAME} 
> ${OCF_RESKEY_java_opts}\";\
> +                            export 
> CATALINA_HOME=${OCF_RESKEY_catalina_home};\
> +                            export 
> CATALINA_BASE=${OCF_RESKEY_catalina_base};\
> +                            export CATALINA_PID=${OCF_RESKEY_catalina_pid};\
>                              $CATALINA_HOME/bin/catalina.sh stop" \
>                       >> "$TOMCAT_CONSOLE" 2>&1
>       fi
> @@ -316,6 +320,14 @@
>  <content type="string" default="" />
>  </parameter>
>  
> +<parameter name="java_opts" unique="0">
> +<longdesc lang="en">
> +Java options
> +</longdesc>
> +<shortdesc>Java options</shortdesc>
> +<content type="string" default="" />
> +</parameter>
> +

Relevant comments should go into the meta-data.

Many thanks for sharing the patch!

Cheers,

Dejan

>  <parameter name="catalina_home" unique="1" required="1">
>  <longdesc lang="en">
>  Home directory of Tomcat
> @@ -324,6 +336,14 @@
>  <content type="string" default="" />
>  </parameter>
>  
> +<parameter name="catalina_base" unique="1">
> +<longdesc lang="en">
> +Instance directory of Tomcat
> +</longdesc>
> +<shortdesc>Instance directory of Tomcat</shortdesc>
> +<content type="string" default="" />
> +</parameter>
> +
>  <parameter name="catalina_pid" unique="1">
>  <longdesc lang="en">
>  A PID file name of Tomcat
> @@ -397,9 +417,10 @@
>  RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}";
>  
>  JAVA_HOME="${OCF_RESKEY_java_home}"
> -JAVA_OPTS="-Dname=$TOMCAT_NAME"
> +JAVA_OPTS="-Dname=$TOMCAT_NAME ${OCF_RESKEY_java_opts}"
>  SEARCH_STR="\\""${JAVA_OPTS}"
>  CATALINA_HOME="${OCF_RESKEY_catalina_home}"
> +CATALINA_BASE="${OCF_RESKEY_catalina_base}"
>  CATALINA_PID="${OCF_RESKEY_catalina_pid-$CATALINA_HOME/logs/catalina.pid}"
>  
>  TOMCAT_START_OPTS="${OCF_RESKEY_tomcat_start_opts}"
> @@ -407,7 +428,7 @@
>  CATALINA_ROTATE_LOG="${OCF_RESKEY_catalina_rotate_log-NO}"
>  CATALINA_ROTATETIME="${OCF_RESKEY_catalina_rotatetime-86400}"
>  
> -export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_PID CATALINA_OPTS
> +export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_BASE CATALINA_PID 
> CATALINA_OPTS
>  
>  JAVA=${JAVA_HOME}/bin/java
>  

> _______________________________________________
> Linux-HA mailing list
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems




______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

<<winmail.dat>>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to