Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

[Patch]Remove unnecessary loop handling of data_directory for postfix.

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


renayama19661014 at ybb

Nov 14, 2011, 6:09 PM

Post #1 of 8 (661 views)
Permalink
[Patch]Remove unnecessary loop handling of data_directory for postfix.

Hi Raoul,
Hi All,

I removed unnecessary loop handling of data_directory.

This patch is applied to pass after the next patch was applied.
* http://www.gossamer-threads.com/lists/linuxha/dev/76354


Please please confirm my correction.
And please commit a correction.

Best Regards,
Hideo Yamauchi.
Attachments: postfix.patch.1115 (1.18 KB)


r.bhatia at ipax

Nov 15, 2011, 1:43 AM

Post #2 of 8 (635 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Hideo-san!

On 2011-11-15 03:09, renayama19661014 [at] ybb wrote:
> Hi Raoul,
> Hi All,
>
> I removed unnecessary loop handling of data_directory.
>
> This patch is applied to pass after the next patch was applied.
> * http://www.gossamer-threads.com/lists/linuxha/dev/76354
>
>
> Please please confirm my correction.
> And please commit a correction.

the reason i kept this loop is that
if we need to check another directory for write permissions in the
future
we only need to add this directory to the loop.

i used to have two loops in the ra:
- one for checking if important directories exists and
- one for checking if important directories are writable.

see https://github.com/raoulbhatia/resource-agents/commit/136dd79

after your status_support patches in mid 2011,
the first loop got unfolded.
i kept the second loop on purpuse.


what are your thoughts? did you simply remove the loop because it is
unnecessary or did you have anything else in mind?


if it is not too much of a problem, i'd like to keep the write
check loop intact just in case we need it for another directory.

cheers,
raoul
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


renayama19661014 at ybb

Nov 15, 2011, 4:16 PM

Post #3 of 8 (640 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Raoul,

Thank you for comment.

Because I do not know a lot about setting of postfix, I may be a wrong opinion.

The data_directory of main.cf of postfix can set the directories more than two.
However, at the time of this setting, the postfix check command returns an error.


Because the resource agent of postfix executes postfix check command in the same way, the validate processing returns an error.

I judged that I could not set plural data_directory parameters from these results and contributed a patch.
Is my judgment wrong?

(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)

* Step2 : I make a directory and give access permission.

[root [at] rhel6- ~]# mkdir /var/lib/postfix2
[root [at] rhel6- ~]# chown postfix:postfix /var/lib/postfix2


* Step3 : I execute postfix chek command.(ERROR)

[root [at] rhel6- ~]# 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 [at] rhel6- ~]# echo $?
1

Best Regards,
Hideo Yamauchi.


--- On Tue, 2011/11/15, Raoul Bhatia [IPAX] <r.bhatia [at] ipax> wrote:

> Hi Hideo-san!
>
> On 2011-11-15 03:09, renayama19661014 [at] ybb wrote:
> > Hi Raoul,
> > Hi All,
> >
> > I removed unnecessary loop handling of data_directory.
> >
> > This patch is applied to pass after the next patch was applied.
> >   * http://www.gossamer-threads.com/lists/linuxha/dev/76354
> >
> >
> > Please please confirm my correction.
> > And please commit a correction.
>
> the reason i kept this loop is that
> if we need to check another directory for write permissions in the
> future
> we only need to add this directory to the loop.
>
> i used to have two loops in the ra:
> - one for checking if important directories exists and
> - one for checking if important directories are writable.
>
> see https://github.com/raoulbhatia/resource-agents/commit/136dd79
>
> after your status_support patches in mid 2011,
> the first loop got unfolded.
> i kept the second loop on purpuse.
>
>
> what are your thoughts? did you simply remove the loop because it is
> unnecessary or did you have anything else in mind?
>
>
> if it is not too much of a problem, i'd like to keep the write
> check loop intact just in case we need it for another directory.
>
> cheers,
> raoul
> --
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            office [at] ipax
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Nov 16, 2011, 2:08 AM

Post #4 of 8 (630 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

hi hideo-san!

On 2011-11-16 01:16, renayama19661014 [at] ybb 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 [at] rhel6- ~]# mkdir /var/lib/postfix2
> [root [at] rhel6- ~]# chown postfix:postfix /var/lib/postfix2
>
>
> * Step3 : I execute postfix chek command.(ERROR)
>
> [root [at] rhel6- ~]# 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 [at] rhel6- ~]# 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.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


renayama19661014 at ybb

Nov 16, 2011, 2:36 AM

Post #5 of 8 (643 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Raoul,

Thank you for comment.

> On 2011-11-16 01:16, renayama19661014 [at] ybb 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 [at] rhel6- ~]# mkdir /var/lib/postfix2
> > [root [at] rhel6- ~]# chown postfix:postfix /var/lib/postfix2
> >
> >
> >   * Step3 : I execute postfix chek command.(ERROR)
> >
> > [root [at] rhel6- ~]# 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 [at] rhel6- ~]# 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.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            office [at] ipax
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


r.bhatia at ipax

Nov 18, 2011, 9:19 AM

Post #6 of 8 (620 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Hideo-san!

On 2011-11-16 11:36, renayama19661014 [at] ybb wrote:
> 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?

postfix check is called after all other checks have passed and, you're
right, it also checks the required directories.

i think i had some issues though:
> # check spool/queue and data directories (if applicable)
> # this is required because "postfix check" does not catch all errors

but i cannot remember the exact problems anymore.

anyways, postfix check will return a "OCF_ERR_GENERIC"
which is regarded as a soft error (!) [1] and will

a. not hint the user or a gui application to the exact problem and
b. will lead to a restart of the failed resource on the same node


the more in-depth check will fail with OCF_ERR_INSTALLED [2] or
OCF_ERR_PERM [3] and will

c. give more information in this regard and
d. migrates the resource to a different node,
which makes sense if i.e. the "shared" queue directory (nfs, etc.)
isn't available.


i think that this behavior is good and checking the most commonly
modified directories separately has been very helpful in my setups.

but of course, i'm open for comments.

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

no worries. english isn't my first language either and until now we
managed to work things out, right? :)

cheers,
raoul

[1]
http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_generic_literal_1.html
[2]
http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_installed_literal_5.html
[3]
http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_perm_literal_4.html
--
____________________________________________________________________
DI (FH) Raoul Bhatia M.Sc. email. r.bhatia [at] ipax
Technischer Leiter

IPAX - Aloy Bhatia Hava OG web. http://www.ipax.at
Barawitzkagasse 10/2/2/11 email. office [at] ipax
1190 Wien tel. +43 1 3670030
FN 277995t HG Wien fax. +43 1 3670030 15
____________________________________________________________________
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


renayama19661014 at ybb

Nov 20, 2011, 5:36 PM

Post #7 of 8 (614 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Raoul,

Thank you for comment.

Because postfix check did not give back the details to a result as for RA, I recognized that the details of the log were necessary.

I changed a check of data_directory.
And I abolish a suggestion street in front, the loop.
This is because the plural setting is not admitted because it added a check.

Please please confirm my correction.
And please commit a correction.

Best Regards,
Hideo Yamauchi.


--- On Sat, 2011/11/19, Raoul Bhatia [IPAX] <r.bhatia [at] ipax> wrote:

> Hi Hideo-san!
>
> On 2011-11-16 11:36, renayama19661014 [at] ybb wrote:
> > 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?
>
> postfix check is called after all other checks have passed and, you're
> right, it also checks the required directories.
>
> i think i had some issues though:
> >     # check spool/queue and data directories (if applicable)
> >     # this is required because "postfix check" does not catch all errors
>
> but i cannot remember the exact problems anymore.
>
> anyways, postfix check will return a "OCF_ERR_GENERIC"
> which is regarded as a soft error (!) [1] and will
>
> a. not hint the user or a gui application to the exact problem and
> b. will lead to a restart of the failed resource on the same node
>
>
> the more in-depth check will fail with OCF_ERR_INSTALLED [2] or
> OCF_ERR_PERM [3] and will
>
> c. give more information in this regard and
> d. migrates the resource to a different node,
>    which makes sense if i.e. the "shared" queue directory (nfs, etc.)
>    isn't available.
>
>
> i think that this behavior is good and checking the most commonly
> modified directories separately has been very helpful in my setups.
>
> but of course, i'm open for comments.
>
> > #Sorry...Because English is weak, I may understand your opinion by mistake.
>
> no worries. english isn't my first language either and until now we
> managed to work things out, right? :)
>
> cheers,
> raoul
>
> [1] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_generic_literal_1.html
> [2] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_installed_literal_5.html
> [3] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_perm_literal_4.html
> -- ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bhatia [at] ipax
> Technischer Leiter
>
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            office [at] ipax
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________
>
Attachments: postfix.patch.1121 (1.87 KB)


renayama19661014 at ybb

Nov 27, 2011, 4:17 PM

Post #8 of 8 (601 views)
Permalink
Re: [Patch]Remove unnecessary loop handling of data_directory for postfix. [In reply to]

Hi Raoul,

About the second patch which I contributed, how do you think?

Best Regards,
Hideo Yamauchi.

--- On Mon, 2011/11/21, renayama19661014 [at] ybb <renayama19661014 [at] ybb> wrote:

> Hi Raoul,
>
> Thank you for comment.
>
> Because postfix check did not give back the details to a result as for RA, I recognized that the details of the log were necessary.
>
> I changed a check of data_directory.
> And I abolish a suggestion street in front, the loop.
> This is because the plural setting is not admitted because it added a check.
>
> Please please confirm my correction.
> And please commit a correction.
>
> Best Regards,
> Hideo Yamauchi.
>
>
> --- On Sat, 2011/11/19, Raoul Bhatia [IPAX] <r.bhatia [at] ipax> wrote:
>
> > Hi Hideo-san!
> >
> > On 2011-11-16 11:36, renayama19661014 [at] ybb wrote:
> > > 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?
> >
> > postfix check is called after all other checks have passed and, you're
> > right, it also checks the required directories.
> >
> > i think i had some issues though:
> > >     # check spool/queue and data directories (if applicable)
> > >     # this is required because "postfix check" does not catch all errors
> >
> > but i cannot remember the exact problems anymore.
> >
> > anyways, postfix check will return a "OCF_ERR_GENERIC"
> > which is regarded as a soft error (!) [1] and will
> >
> > a. not hint the user or a gui application to the exact problem and
> > b. will lead to a restart of the failed resource on the same node
> >
> >
> > the more in-depth check will fail with OCF_ERR_INSTALLED [2] or
> > OCF_ERR_PERM [3] and will
> >
> > c. give more information in this regard and
> > d. migrates the resource to a different node,
> >    which makes sense if i.e. the "shared" queue directory (nfs, etc.)
> >    isn't available.
> >
> >
> > i think that this behavior is good and checking the most commonly
> > modified directories separately has been very helpful in my setups.
> >
> > but of course, i'm open for comments.
> >
> > > #Sorry...Because English is weak, I may understand your opinion by mistake.
> >
> > no worries. english isn't my first language either and until now we
> > managed to work things out, right? :)
> >
> > cheers,
> > raoul
> >
> > [1] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_generic_literal_1.html
> > [2] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_installed_literal_5.html
> > [3] http://www.linux-ha.org/doc/dev-guides/_literal_ocf_err_perm_literal_4.html
> > -- ____________________________________________________________________
> > DI (FH) Raoul Bhatia M.Sc.          email.          r.bhatia [at] ipax
> > Technischer Leiter
> >
> > IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> > Barawitzkagasse 10/2/2/11           email.            office [at] ipax
> > 1190 Wien                           tel.               +43 1 3670030
> > FN 277995t HG Wien                  fax.            +43 1 3670030 15
> > ____________________________________________________________________
> >
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.