Hi Yoshihiko-san,

On Fri, Nov 13, 2009 at 06:05:15PM +0900, Yoshihiko SATO wrote:
> Hi,
> 
> I setup glue + corosync + pacemaker. I have 3 nodes or more.
> I configure STONITH plugin with ibmrsa-telnet and meatware.
> 
> 
> When all plugins fail, action as follows, right?
> 1) ibmrsa-telnet -> fail
> 2) meatware -> fail
> 3) remote fencing (ibmrsa-tenlet and meatware) -> timeout
> 4) return 1)
> 
> in this case, the operator run "meatclient" after intervention(reset node).
> "meatclient" succeeds only when plugin "meatware" is executing.
> So, the operator have to always watch the logfile while STONITH is executing.
> I think this operation is not simple for the operator.

True.

> Then, I want to add the option to "meatcleint" for waits next result of 
> "meatware".
> By way of trial, I made patch in glue (changeset:3297e5e11428).
> 
> I would like to hear any opinion.

Great idea! But I'd like to suggest a bit different execution,
i.e. to have usage like this:

meatclient -c node [-w]

and then to put the wait loop around the existing code. Also,
please don't print ERRORs while waiting, it may confuse the poor
sleepy operator :) The best would be to just print dots without
\n once a second so that they know that something's going on.

Cheers,

Dejan

> Regards,
> Yoshihiko SATO
> 

> diff -r 3297e5e11428 lib/stonith/meatclient.c
> --- a/lib/stonith/meatclient.c        Thu Nov 12 13:50:04 2009 +0100
> +++ b/lib/stonith/meatclient.c        Fri Nov 13 17:24:31 2009 +0900
> @@ -37,14 +37,14 @@
>  #include <stonith/stonith.h>
>  #include <glib.h>
>  
> -#define OPTIONS "c:"
> +#define OPTIONS "c:w:"
>  
>  void usage(const char * cmd);
>  
>  void
>  usage(const char * cmd)
>  {
> -     fprintf(stderr, "usage: %s [-c node]\n", cmd);
> +     fprintf(stderr, "usage: %s [-c node]|[-w node]\n", cmd);
>       exit(S_INVAL);
>  }
>  
> @@ -59,6 +59,7 @@
>                                                        meatware.c as well */
>       char *          opthost = NULL;
>       int             clearhost = 0;
> +     int             waitmode = 0;
>  
>       int             c, argcount;
>       int             errors = 0;
> @@ -74,6 +75,9 @@
>               case 'c':       opthost = optarg;
>                               ++clearhost;
>                               break;
> +             case 'w':       opthost = optarg;
> +                             ++waitmode;
> +                             break;
>               default:        ++errors;
>                               break;
>               }
> @@ -135,6 +139,36 @@
>               }
>      
>               printf("Meatware_client: reset confirmed.\n");
> +     } else
> +     if (waitmode) {
> +             int rc, fd;
> +
> +             char line[256];
> +             char meatpipe[256];
> +
> +             snprintf(meatpipe, 256, "%s.%s", meatpipe_pr, opthost);
> +
> +             while (1) {
> +                     fd = open(meatpipe, O_WRONLY | O_NONBLOCK);
> +                     if (fd < 0) {
> +                             if (errno != ENOENT && errno != ENXIO) {
> +                                     snprintf(line, sizeof(line)
> +                                     ,       "Meatware_IPC failed: %s. 
> [%d]", meatpipe, errno);
> +                                     perror(line);
> +                             }
> +                             sleep(1);
> +                     } else {
> +                             sprintf(line, "meatware reply %s", opthost);
> +                             rc = write(fd, line, 256);
> +                             if (rc < 0) {
> +                                     sprintf(line, "Meatware_IPC failed: 
> %s", meatpipe);
> +                                     perror(line);
> +                                     exit(S_OOPS);
> +                             }
> +                             printf("Meatware_client: reset confirmed.\n");
> +                             break;
> +                     }
> +             }
>       }
>  
>       exit(S_OK);
> 

> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to