Re: [Linux-ha-dev] change of process check in tomcat-ra

2011-11-16 Thread nozawat
Hi Dejan

When I set CATALINA_OPTS from the outside, it is as follows.

1)It is set CATALINA_OPTS by crm-configure.
2)It is set CATALINA_OPTS by external file(setenv.sh)
  ->setenv.sh is called from run.sh
  ->In this case I set -Dname by all means.

In this case it causes a mistake.
Therefore I think that I should not use CATALINA_OPTS by a process
monitoring when I consider outside setting.

Does not it become a reason to change the process monitoring?

Regards,
Tomo

2011/11/11 nozawat :
> Hi Dejan
>
>>What is overwritten?Which environment variable do you refer to?
> It is CATALINA_OPTS.
>
> When CATALINA_OPTS is set from the outside, a right process check is
> not possible.
> It occurs at following time.
> 1.-Dname is not set(Outside setting).
> 2.When -Dname is different.
> 3.When setting of CATALINA_OPTS is different by cib and outside setting
>
> When I set CATALINA_OPTS in the tomcat-ra from the outside, there is
> the same definition to two places(cib and setenv.sh),and When I set
> -Dname definitely.
> It moves. However, is not it confusing?
>
> Regards,
> Tomo
>
> 2011/11/10 Dejan Muhamedagic :
>> On Fri, Nov 04, 2011 at 01:55:57PM +0900, nozawat wrote:
>>> Hi Dejan
>>>
>>> > Are we sure that the pid file is _always_ going to exist and
>>> > contain the PID?
>>> I believe that PID file exists, and I include pid.
>>> BTW, it is the next sentence to be important by this change.
>>>
>>> > What's wrong with setting the tomcat_name parameter when it's really
>>> > needed (i.e. it is different from the default "tomcat")?
>>> For example, it may not move when CATALINA_OPTS is catalina.sh and is
>>> overwritten.
>>> It is to move without a problem even if an environment variable is set
>>> from the outside that I need.
>>
>> I'm sorry, but I don't understand much of this. Could you please
>> rephrase. "may not move", what may (not) move? What is
>> overwritten? Which environment variable do you refer to?
>>
>> Cheers,
>>
>> Dejan
>>
>>> Regards,
>>> Tomo
>>>
>>> 2011/11/4 Dejan Muhamedagic :
>>> > Hi,
>>> >
>>> > On Tue, Nov 01, 2011 at 09:31:10AM +0900, nozawat wrote:
>>> >> Hi Dejan
>>> >>
>>> >>  Sorry,I got a wrong attached file.
>>> >>  I send a right file.
>>> >
>>> > Are we sure that the pid file is _always_ going to exist and
>>> > contain the PID? What's wrong with setting the tomcat_name
>>> > parameter when it's really needed (i.e. it is different from the
>>> > default "tomcat")?
>>> >
>>> > If you don't produce good arguments, this change looks
>>> > superfluous to me.
>>> >
>>> > Cheers,
>>> >
>>> > Dejan
>>> >
>>> >> Regards,
>>> >> Tomo
>>> >>
>>> >> 2011/11/1 Dejan Muhamedagic :
>>> >> > Hi,
>>> >> >
>>> >> > On Thu, Oct 27, 2011 at 11:36:10AM +0900, nozawat wrote:
>>> >> >> Hi
>>> >> >>
>>> >> >>  I changed the method of the process check in tomcat-ra.
>>> >> >>  SEARCH_STR does not function when I set tomcat parameter in 
>>> >> >> catalina.sh.
>>> >> >
>>> >> > This is the same one like the other to remove the pid file.
>>> >> > Wrong patch attached?
>>> >> >
>>> >> > Thanks,
>>> >> >
>>> >> > Dejan
>>> >> >
>>> >> >> Regards,
>>> >> >> Tomo
>>> >> >
>>> >> >
>>> >> >> ___
>>> >> >> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>>> >> >> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> >> >> Home Page: http://linux-ha.org/
>>> >> >
>>> >> > ___
>>> >> > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>>> >> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> >> > Home Page: http://linux-ha.org/
>>> >> >
>>> >
>>> >
>>> >> ___
>>> >> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>>> >> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> >> Home Page: http://linux-ha.org/
>>> >
>>> > ___
>>> > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>>> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> > Home Page: http://linux-ha.org/
>>> >
>>> ___
>>> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>>> Home Page: http://linux-ha.org/
>> ___
>> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
>> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
>> Home Page: http://linux-ha.org/
>>
>
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] ocf_run: sanitize output before logging?

2011-11-16 Thread Lars Ellenberg
On Mon, Nov 14, 2011 at 09:53:12PM +0100, Florian Haas wrote:
> Dejan, Lars, and other shell gurus in attendance,
> 
> maybe I'm totally off my rocker, and one of you guys can set me
> straight. But to me this part of the ocf_run function seems a bit fishy:
> 
> output=`"$@" 2>&1`
> rc=$?
> output=`echo $output`
> 
> Am I gravely mistaken, or would any funny control characters produced by
> the wrapped command line totally mess up the content of "output" here as
> it is mangled by the backticks?
> 
> What I'm noticing is the invocation of "ocf_run sipsak -v -s ",
> which we put into the asterisk RA as per Russell Bryant's suggestion,
> seems to totally garble the output.
> 
> Compare this:
> 
> $ sipsak -v -s sip:somenotexistantextens...@ekiga.net 2>&1
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP
> 127.0.0.1:43665;branch=z9hG4bK.539207ad;rport=53485;alias;received=85.127.155.32
> From: sip:sipsak@127.0.0.1:43665;tag=6dafacb9
> To:
> sip:somenotexistantextens...@ekiga.net;tag=c64e1f832a41ec1c1f4e5673ac5b80f6.3109
> Call-ID: 1840229561@127.0.0.1
> CSeq: 1 OPTIONS
> Server: Kamailio (1.5.3-notls (i386/linux))
> Content-Length: 0
> 
> To this:
> 
> $ output=`sipsak -v -s sip:somenotexistantextens...@ekiga.net 2>&1`
> $ echo $output
>  Content-Length: 0(1.5.3-notls
> (i386/linux))tag=c64e1f832a41ec1c1f4e5673ac5b80f6.8ff585.127.155.32
> 
> In this case it appears to be due to carriage-return (0x0d, ^M)
> characters that sipsak injects into its output, which is annoying but
> relatively benign. But maybe we want to sanitize the ocf_run output
> before we hand it off to be written to the logs?

output=`echo $output` is there to make it one "line", I think.
Any funny control characters should not be a problem.

well, unless you echo them to a terminal.

ASCII NUL may be fun, though,
and will probably differ accross shel flavour and versions.

The terminal is also the "problem" you are seing there.
In a log file, it will all be one line, with some spurious "^M".

But on a terminal, well, CR is carriage return: start again at column 0.
so it just prints one line over the other, and the "trailing garbage"
is simply from the previous, longer lines.


Of course, you could do
output=`echo $output | cat -v`
instead, but it loses information.

If you are only bothered by CR, do
IFS=$' \t\r\n' output=`echo $output`
where $'' is most likely a bashism, but you get the idea.
A tr equivalent is obviously
output=`echo $output | tr -s ' \r' ' '`
(\t and \n have been squeezed already by the leaving off the ""
around $output)


-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] [Patch]Remove unnecessary loop handling of data_directory for postfix.

2011-11-16 Thread renayama19661014
Hi Raoul,

Thank you for comment.

> On 2011-11-16 01:16, renayama19661...@ybb.ne.jp wrote:
> > I judged that I could not set plural data_directory parameters from these 
> > results and contributed a patch.
> > Is my judgment wrong?
> 
> to my knowledge, you're correct.
> multiple data_directories are not possible (and make imho make no sense)

All right!
Thanks!

> 
> >
> > (Exapmle) It is postfix2.6.6 on RHEL6 that I confirmed.
> >
> >   * Step1 : I set two directories in main.cf.
> >
> > (snip)
> > # The data_directory parameter specifies the location of Postfix-writable
> > # data files (caches, random numbers). This directory must be owned
> > # by the mail_owner account (see below).
> > #
> > data_directory = /var/lib/postfix,/var/lib/postfix2
> > (snip)
> 
> so you set the directory to the single value
> "/var/lib/postfix,/var/lib/postfix2"
> 
> which is not tokenized/split into an array.
> 
> >   * Step2 : I make a directory and give access permission.
> >
> > [root@rhel6-1 ~]# mkdir /var/lib/postfix2
> > [root@rhel6-1 ~]# chown postfix:postfix /var/lib/postfix2
> >
> >
> >   * Step3 : I execute postfix chek command.(ERROR)
> >
> > [root@rhel6-1 ~]# postfix check
> > mkdir: cannot create directory `/var/lib/postfix,/var/lib/postfix2': No 
> > such file or directory
> > postfix/postfix-script: fatal: unable to create missing queue directories
> > [root@rhel6-1 ~]# echo $?
> > 1
> 
> that is expected and the resource agent should check the same.

I think that the same check has been already carried out in a resource agent.

(snip)
# run Postfix internal check, if not probing
if ! ocf_is_probe; then
$binary $OPTIONS check >/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
ocf_log err "Postfix 'check' failed." $ret
return $OCF_ERR_GENERIC
fi
fi
(snip)


That means, after all is not the loop check of data_directory unnecessary?

#Sorry...Because English is weak, I may understand your opinion by mistake.

Best Regards,
Hideo Yamauchi.


> -- 
> 
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bha...@ipax.at
> Technischer Leiter
> 
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            off...@ipax.at
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> 
> 
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] [Patch]Remove unnecessary loop handling of data_directory for postfix.

2011-11-16 Thread Raoul Bhatia [IPAX]
hi hideo-san!

On 2011-11-16 01:16, renayama19661...@ybb.ne.jp wrote:
> I judged that I could not set plural data_directory parameters from these 
> results and contributed a patch.
> Is my judgment wrong?

to my knowledge, you're correct.
multiple data_directories are not possible (and make imho make no sense)

>
> (Exapmle) It is postfix2.6.6 on RHEL6 that I confirmed.
>
>   * Step1 : I set two directories in main.cf.
>
> (snip)
> # The data_directory parameter specifies the location of Postfix-writable
> # data files (caches, random numbers). This directory must be owned
> # by the mail_owner account (see below).
> #
> data_directory = /var/lib/postfix,/var/lib/postfix2
> (snip)

so you set the directory to the single value
"/var/lib/postfix,/var/lib/postfix2"

which is not tokenized/split into an array.

>   * Step2 : I make a directory and give access permission.
>
> [root@rhel6-1 ~]# mkdir /var/lib/postfix2
> [root@rhel6-1 ~]# chown postfix:postfix /var/lib/postfix2
>
>
>   * Step3 : I execute postfix chek command.(ERROR)
>
> [root@rhel6-1 ~]# postfix check
> mkdir: cannot create directory `/var/lib/postfix,/var/lib/postfix2': No such 
> file or directory
> postfix/postfix-script: fatal: unable to create missing queue directories
> [root@rhel6-1 ~]# echo $?
> 1

that is expected and the resource agent should check the same.

i think there might be a misunderstanding regarding the loop:

the current loop:
 > for dir in "$data_dir"; do
 >...
 > done
(looping exactly one dir)

could easily be enhanced to check more dirs, e.g.:
 > for dir in "$data_dir" "$data_dir/active" "$data_dir/incoming"; do
 >...
 > done
(looping three dirs)

without having to re-introduce the loop.


thanks,
raoul
-- 

DI (FH) Raoul Bhatia M.Sc.  email.  r.bha...@ipax.at
Technischer Leiter

IPAX - Aloy Bhatia Hava OG  web.  http://www.ipax.at
Barawitzkagasse 10/2/2/11   email.off...@ipax.at
1190 Wien   tel.   +43 1 3670030
FN 277995t HG Wien  fax.+43 1 3670030 15

___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[Linux-ha-dev] [GIT PULL] Moving the OCF RA dev guide to the resource-agents repo

2011-11-16 Thread Florian Haas
Hi everyone,

this is something I've been meaning to do for a long time, and I've
finally had the time to do so. Now that the ClusterLabs repo on Github
has been established as the central source of OCF resource agents, there
is really no reason why the RA dev guide should live in the linux-ha.org
Mercurial repo any longer. I've informally proposed to move it to Github
on IRC and received very positive feedback on that.

I've done some mangling with git and hg to preserve the guide's entire
history, so this pull request is a bit bloated because of that.

So as not to clutter the doc/ directory, I've created two subdirs,
"doc/dev-guide" (for the dev guide sources) and "doc/man" (for the magic
that does man page autogeneration for RAs). I've updated configure.ac
and the Automake files accordingly.

If I don't hear from anyone with a valid objection to moving this over
to Github, I'll proceed with the merge about 48 hours from now.

Cheers,
Florian


The following changes since commit 020c8f7b08e232aef05e277b09632171a7561744:

  Medium: jboss: add the java_opts parameter for java options
(2011-11-15 16:27:26 +0100)

are available in the git repository at:
  git://github.com/fghaas/resource-agents dev-guide

Dejan Muhamedagic (1):
  RA dev guide: edit ocft description

Florian Haas (68):
  doc: move man page generation to doc/man
  Add RA developer's guide
  RA dev guide: explain API
  RA dev guide: add info about expected behavior for actions
  RA dev guide: add information about pseudo resources
  RA dev guide: add information about logging, ocf_run, and locks
  RA dev guide: add info about script interpreters
  RA dev guide: more information about pseudo resources
  RA dev guide: add info about testing for booleans and numbers
  RA dev guide: add separate section on convenience functions
  RA dev guide: explain have_binary and check_binary
  RA dev guide: explain validate-all and meta-data
  RA dev guide: do not use full paths when referring to executables
  RA dev guide: update example metadata
  RA dev guide: add line breaks in example metadata
  RA dev guide: add stubs for remaining actions
  RA dev guide: add section on variables
  RA dev guide: add stubs for initialization and locale considerations
  RA dev guide: add info about promote action
  RA dev guide: explain demote action
  RA dev guide: explain notify actions
  RA dev guide: explain migrate_to operation
  RA dev guide: explain migrate_from actions
  Add information about licensing, initialization, and locale settings
  RA dev guide: add hints for syntax highlighting
  RA dev guide: fix typo
  RA dev guide: fix incorrect debug message in example code
  RA dev guide: fix a misleading comment
  RA dev guide: fix example code for stop action
  RA dev guide: fix incorrect function name
  RA dev guide: fix trivial typo
  RA dev guide: add information about crm_master
  RA dev guide: rewrite monitor example
  RA dev guide: add convenience function names to the corresponding
section headers
  RA dev guide: add legal notice for CC-BY-SA license
  RA dev guide: add note about ocf_is_true
  RA dev guide: add new section on resource agent structure
  RA dev guide: fix typos (migrate-*/migrate_*)
  RA dev guide: fix typo (missing "it")
  RA dev guide: improve stop example
  RA dev guide: fix comments in demote example
  RA dev guide: mention the checkbashisms script for /bin/sh RAs
  RA dev guide: fix misleading comment
  RA dev guide: add section on testing for running processes
  RA dev guide: put return codes in a separate section
  RA dev guide: add warning about implications of failed stop actions
  RA dev guide: clarify information on timeouts
  RA dev guide: add note about HA_RSCTMP being cleaned on startup
  RA dev guide: rename "Resource agent behavior" to "Resource agent
actions"
  RA dev guide: add a section about ocf-tester
  RA dev guide: move testing to a different section
  RA dev guide: add section on installing resource agents
  RA dev guide: add section on RPM packaging
  RA dev guide: expand license information
  RA dev guide: add section on Debian packaging
  RA dev guide: add note about submitting RAs
  RA dev guide: fix names of notify variables
  RA dev guide: add another note about crm_master
  RA dev guide: put author information in docinfo file
  RA dev guide: add revision information to docinfo file
  RA dev guide: remove information about superfluous tests for zombies
  RA dev guide: add revision 1.0.1, update copyright years
  RA dev guide: add "Conventions" section
  RA dev guide: put testing into its own top-level section
  RA dev guide: add section on ocft
  RA dev guide: fix typo
  doc: move RA dev guide to doc/dev-guides
  RA dev guide: update author 

[Linux-ha-dev] [GIT PULL] Re: [Linux-HA] [RfC] Review request for ocf:heartbeat:asterisk (Asterisk OCF RA)

2011-11-16 Thread Florian Haas
Hi everybody,

barring any last-minute vetoes, I intend to pull the following changes
since commit 020c8f7b08e232aef05e277b09632171a7561744:

  Medium: jboss: add the java_opts parameter for java options
(2011-11-15 16:27:26 +0100)

into the ClusterLabs resource-agents repo from the git repository at:
  git://github.com/fghaas/resource-agents asterisk

Thanks a lot to Dejan, Lars and Russell for their extensive and valuable
feedback.

Cheers,
Florian

Andreas Kurz (2):
  Medium: asterisk: remove -x option from pgrep
  Low: asterisk: refine sipsak exit code interpretation

Florian Haas (24):
  Low: asterisk: use ocf_run where appropriate, invoke kill with "-s"
  Low: asterisk: honor $PATH in binary defaults
  Low: asterisk: don't advertise monitor depth
  Low: asterisk: remove LSB boilerplate
  Low: asterisk: don't redirect ocf_run invocations to /dev/null
  Low: asterisk: remove superfluous line-end semicolons
  Low: asterisk: simplify equality tests
  Low: asterisk: remove boilerplate copied from mysql
  Low: asterisk: downgrade logging severity for successful monitor
  Low: asterisk: improve directory creation on start
  Low: asterisk: improve/simplify start
  Low: asterisk: improve stop
  Low: asterisk: declare remaining "pid" variables local
  Low: asterisk: fix typo in log message
  Low: asterisk: remove useless return statement
  Low: asterisk: religiously use $rc, not $?
  Low: asterisk: exit, don't return, in the face of uncaught errors
  Low: asterisk: remove unused variable
  Low: asterisk: initialize convenience variables after validate
  Low: asterisk: add optional SIP monitoring with sipsak
  Low: asterisk: do "core show channels count " during monitor
  Low: asterisk: whitespace cleanup
  High: asterisk: fix typo (missing "$")
  Low: asterisk: remove -v flag from sipsak invocation

Martin Loschwitz (6):
  High: asterisk: new resource agent
  Low: asterisk: set suggested timeouts to 20s
  Low: asterisk: add convenience function for connecting to Asterisk
console
  Low: asterisk: rewrite stop operation
  Low: asterisk: cleanup
  Medium: asterisk: properly handle astcanary

 doc/Makefile.am   |1 +
 heartbeat/Makefile.am |1 +
 heartbeat/asterisk|  485
+
 3 files changed, 487 insertions(+), 0 deletions(-)
 create mode 100755 heartbeat/asterisk
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/