In fact this one has a little problem too. Spaces around = aren't
required in xen config files, so one can have "name=node_name" and in
this case this patch fails. So the better version would be something
like this:

--- xen0.old    2008-03-06 08:37:20.000000000 -0500
+++ xen0        2008-03-07 10:41:50.000000000 -0500
@@ -81,7 +81,13 @@

         case $2 in
             stop)
-                $SSH_COMMAND $dom0 "(sleep 2; $STOP_COMMAND $node)
>/dev/null 2>&1 &"
+                 kill_node=`$SSH_COMMAND $dom0 "grep
^[[:space:]]*name $cfg" | cut -f 2 -d '=' |  sed -e 's,",,g'`
+                 if [ "x" = "x$kill_node" ]
+                 then
+                     echo "Couldn't find a node name to stop"
+                     exit 1
+                 fi
+                 $SSH_COMMAND $dom0 "(sleep 2; $STOP_COMMAND
$kill_node) >/dev/null 2>&1 &"
                 break;;
             start)
                 $SSH_COMMAND $dom0 "(sleep 2; $START_COMMAND $cfg)
>/dev/null 2>&1 &"


On Thu, Mar 6, 2008 at 10:47 PM, DAIKI MATSUDA <[EMAIL PROTECTED]> wrote:
> Sorry, previous patch is a little dangerous. Could you use attached one?
>
>  Regards
>  MATSUDA, Daiki
>
>  2008/3/6, Serge Dubrouski <[EMAIL PROTECTED]>:
>
>
> > As it sometimes happens after a second thought I'm absolutely agree
>  >  with a proposed patch.
>  >
>  >  Dejan, could you please apply a following patch to xen0 script?
>  >
>  >  --- xen0.old    2008-03-06 08:37:20.000000000 -0500
>  >  +++ xen0        2008-03-06 08:34:03.000000000 -0500
>  >  @@ -81,7 +81,13 @@
>  >
>  >          case $2 in
>  >              stop)
>  >  -                $SSH_COMMAND $dom0 "(sleep 2; $STOP_COMMAND $node)
>  >  >/dev/null 2>&1 &"
>  >  +                 kill_node=`$SSH_COMMAND $dom0 "grep
>  >  ^[[:space:]]*name $cfg" | awk '{print $3}'`
>  >  +                 if [ "x" = "x$kill_node" ]
>  >  +                 then
>  >  +                     echo "Couldn't find a node name to stop"
>  >  +                     exit 1
>  >  +                 fi
>  >  +                 $SSH_COMMAND $dom0 "(sleep 2; $STOP_COMMAND
>  >  $kill_node) >/dev/null 2>&1 &"
>  >                  break;;
>  >              start)
>  >                  $SSH_COMMAND $dom0 "(sleep 2; $START_COMMAND $cfg)
>  >  >/dev/null 2>&1 &"
>  >
>  >
>  >
>  >  On Wed, Mar 5, 2008 at 9:26 PM, Serge Dubrouski <[EMAIL PROTECTED]> wrote:
>  >  > You are right, they can be different but the main idea was thet a user
>  >  >  must provide a correct node name. So I'm not sure in this patch
>  >  >  because it creates some kind of a loop in logic: config file depends
>  >  >  on a node name  from hostlist, and now you are making node name to
>  >  >  depend on that config file.
>  >  >
>  >  >  What I mean is: User must provide a correct node name in "hostlist"
>  >  >  variable. Config file is an optional parameter in case if it's name
>  >  >  doesn't match the node name. So I think that it's kind of overdo to
>  >  >  look for a right node name in the config file again.
>  >  >
>  >  >
>  >  >
>  >  >  On Wed, Mar 5, 2008 at 7:03 PM, DAIKI MATSUDA <[EMAIL PROTECTED]> 
> wrote:
>  >  >  > Hi,
>  >  >  >
>  >  >  >  I have already made similar one. And I tested your 'xen0'. It has a
>  >  >  >  little problem. The domU's hostname is not always same as config 
> file
>  >  >  >  name. So, I fixed it to pick up the target node from config file.
>  >  >  >
>  >  >  >  Regards
>  >  >  >  MATSUDA, Daiki
>  >  >  >
>  >  >  >  2008/2/28, Serge Dubrouski <[EMAIL PROTECTED]>:
>  >  >  >  > Attached.
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  On Thu, Feb 28, 2008 at 3:35 AM, Dejan Muhamedagic <[EMAIL 
> PROTECTED]> wrote:
>  >  >  >  >  > Hi Serge,
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  On Tue, Feb 26, 2008 at 09:46:14AM -0700, Serge Dubrouski 
> wrote:
>  >  >  >  >  >  > Dejan -
>  >  >  >  >  >  >
>  >  >  >  >  >  > I found a compromise :-) Attached is a version of that 
> plugin that
>  >  >  >  >  >  > supports following parameters:
>  >  >  >  >  >  >
>  >  >  >  >  >  > 1. hostlist. A string that has a list of controlled nodes 
> separated by
>  >  >  >  >  >  > space or commas. A required parameter. In a simple form its 
> just a
>  >  >  >  >  >  > list of nodes. If one needs to use non-standard Xen 
> configuration he
>  >  >  >  >  >  > can use extended form of this parameter: 
> "node1_name:config1_file
>  >  >  >  >  >  > node2_name:config2_file". If config file isn't given it 
> defaults to
>  >  >  >  >  >  > /etc/xen/node_name.cfg
>  >  >  >  >  >  >
>  >  >  >  >  >  > 2. Dom0. Name of Dom0 Xen node. A required parameter.
>  >  >  >  >  >  >
>  >  >  >  >  >  > 3. ssh_command. SSH command that is used to ssh from DomU 
> to Dom0.
>  >  >  >  >  >  > Defaults to "/usr/bin/ssh -q -x -n -l root". If one wants 
> to use SSH
>  >  >  >  >  >  > keys for higher security he needs to use this parameter.
>  >  >  >  >  >
>  >  >  >  >  >  This is not necessary. One can setup everything needed in
>  >  >  >  >  >  ~/.ssh/config on a per host basis, i.e. key or user to connect
>  >  >  >  >  >  with. Since the plugin always runs as root, you might leave 
> out
>  >  >  >  >  >  '-l root' as well.
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  > So in this form this plugin can be configured as a clone or 
> as a set
>  >  >  >  >  >  > of resources and location constraints.
>  >  >  >  >  >  >
>  >  >  >  >  >  >
>  >  >  >  >  >  > I'd be very pleased if this plugin gets its way into 
> Linux-HA distribution.
>  >  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  Sure. Could you please just drop the ssh_command parameter.
>  >  >  >  >  >
>  >  >  >  >  >  Many thanks for the contribution.
>  >  >  >  >  >
>  >  >  >  >  >  Cheers,
>  >  >  >  >  >
>  >  >  >  >  >  Dejan
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  >
>  >  >  >  >  >  > On Tue, Feb 26, 2008 at 8:45 AM, Serge Dubrouski <[EMAIL 
> PROTECTED]> wrote:
>  >  >  >  >  >  > >
>  >  >  >  >  >  > > On Mon, Feb 25, 2008 at 4:02 PM, Dejan Muhamedagic 
> <[EMAIL PROTECTED]> wrote:
>  >  >  >  >  >  > >  > Hi,
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >  On Mon, Feb 25, 2008 at 12:17:40PM -0700, Serge 
> Dubrouski wrote:
>  >  >  >  >  >  > >  >  > On Mon, Feb 25, 2008 at 12:10 PM, Dejan Muhamedagic 
> <[EMAIL PROTECTED]> wrote:
>  >  >  >  >  >  > >  >  > > Hi,
>  >  >  >  >  >  > >  >  > >
>  >  >  >  >  >  > >  >  > >
>  >  >  >  >  >  > >  >  > >  On Mon, Feb 25, 2008 at 11:27:38AM -0700, Serge 
> Dubrouski wrote:
>  >  >  >  >  >  > >  >  > >  > I would love to do that and already tried it. 
> Though we didn't come to
>  >  >  >  >  >  > >  >  > >  > agreement on how configuration parameters 
> should look like.
>  >  >  >  >  >  > >  >  > >
>  >  >  >  >  >  > >  >  > >  Why? Was there a discussion on the list about 
> it? The
>  >  >  >  >  >  > >  >  > >  configuration is a bit unusual. Other stonith 
> agents take named
>  >  >  >  >  >  > >  >  > >  parameters. Though this kind of configuration 
> also works, I'd
>  >  >  >  >  >  > >  >  > >  prefer something similar to the others, e.g.
>  >  >  >  >  >  > >  >  >
>  >  >  >  >  >  > >  >  > Yes there was a discussion
>  >  >  >  >  >  > >  >  > 
> http://lists.community.tummy.com/pipermail/linux-ha-dev/2007-February/
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >  It's a long one and peters out inconclusively.
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >  > See "new stonith external plugin". The config 
> parameter hostslist is
>  >  >  >  >  >  > >  >  > actually derived from original ssh plugin. I needed 
> to have a full
>  >  >  >  >  >  > >  >  > list of all controlled nodes and preferred to have 
> it as one
>  >  >  >  >  >  > >  >  > parameter.
>  >  >  >  >  >  > >  >  >
>  >  >  >  >  >  > >  >  > >
>  >  >  >  >  >  > >  >  > >  hostname dom0 (or xenhost) config
>  >  >  >  >  >  > >  >  > >
>  >  >  >  >  >  > >  >  >
>  >  >  >  >  >  > >  >  > That would work if I needed just a dom0 host, but I 
> also need a list
>  >  >  >  >  >  > >  >  > of controlled nodes and probably configuration 
> files.
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >  That's why you can have several instances of a 
> stonith resource
>  >  >  >  >  >  > >  >  (see e.g. external/ipmi). Each of them would run with 
> different
>  >  >  >  >  >  > >  >  parameters. What I meant was:
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >  >  hostname: xen vm
>  >  >  >  >  >  > >  >  dom0: xen dom0
>  >  >  >  >  >  > >  >  config: vm configuration file
>  >  >  >  >  >  > >  >
>  >  >  >  >  >  > >
>  >  >  >  >  >  > >  That's possible and easy to do but I'm not sure that 
> it'll be better.
>  >  >  >  >  >  > >  Current version allows to configure a clone. New version 
> would require
>  >  >  >  >  >  > >  configuring a separate resource for each node and 
> creating location
>  >  >  >  >  >  > >  constraints for each of them. Per my opinion that would 
> be more
>  >  >  >  >  >  > >  complex configuration. May be I'm missing something.
>  >  >  >  >  >  > >
>  >  >  >  >  >  >
>  >  >  >  >  >  >
>  >  >  >  >  >  >
>  >  >  >  >  >  > --
>  >  >  >  >  >  > Serge Dubrouski.
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  > > _______________________________________________
>  >  >  >  >  >  > Linux-HA mailing list
>  >  >  >  >  >  > [email protected]
>  >  >  >  >  >  > http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  >  >  >  >  >  > See also: http://linux-ha.org/ReportingProblems
>  >  >  >  >  >
>  >  >  >  >  >  --
>  >  >  >  >  >  Dejan
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  > _______________________________________________
>  >  >  >  >  >  Linux-HA mailing list
>  >  >  >  >  >  [email protected]
>  >  >  >  >  >  http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  >  >  >  >  >  See also: http://linux-ha.org/ReportingProblems
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  > --
>  >  >  >  >
>  >  >  >  > Serge Dubrouski.
>  >  >  >  >
>  >  >  >  > _______________________________________________
>  >  >  >  >  Linux-HA mailing list
>  >  >  >  >  [email protected]
>  >  >  >  >  http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  >  >  >  >  See also: http://linux-ha.org/ReportingProblems
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >  > _______________________________________________
>  >  >  >  Linux-HA mailing list
>  >  >  >  [email protected]
>  >  >  >  http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  >  >  >  See also: http://linux-ha.org/ReportingProblems
>  >  >  >
>  >  >
>  >  >
>  >  >
>  >  >  --
>  >  >  Serge Dubrouski.
>  >  >
>  >
>  >
>  >
>  >
>  > --
>  >
>  > Serge Dubrouski.
>  >  _______________________________________________
>  >  Linux-HA mailing list
>  >  [email protected]
>  >  http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  >  See also: http://linux-ha.org/ReportingProblems
>  >
>
> _______________________________________________
>  Linux-HA mailing list
>  [email protected]
>  http://lists.linux-ha.org/mailman/listinfo/linux-ha
>  See also: http://linux-ha.org/ReportingProblems
>



-- 
Serge Dubrouski.
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to