Deleted real server string patch

Dung Nguyen dtnguyen2 at gmail.com
Fri Jan 12 20:04:15 GMT 2007


Per request, I've made the following modification to the patch.

On configuration file reload event:
  delete :  "Purged real server: ..."
  restore:  "Re-added real server: ..."

On status check:
  delete :  "Deleted real server: ..."
  restore:  "Added real server: ..."

So for monitoring service, one would want to monitor these strings:
"Deleted real server" and "Added real server".


[root at linux ldirectord]# diff -u ldirectord.v.1.120
ldirectord.v.1.120.patched
--- ldirectord.v.1.120  2005-10-06 14:17:38.000000000 -0700
+++ ldirectord.v.1.120.patched  2007-01-12 11:49:23.000000000 -0800
@@ -397,6 +397,7 @@
            @REAL
            @VIRTUAL
            $HOSTNAME
+        $REREAD_CFG

            $CRLF
 );
@@ -412,6 +413,7 @@
 $NEGOTIATETIMEOUT = 0;
 $RUNPID           = "/var/run/ldirectord";
 $QUIESCENT        = "yes";
+$REREAD_CFG       = 0;

 $CRLF = "\x0d\x0a";

@@ -665,6 +667,7 @@
 {
        @OLDVIRTUAL = @VIRTUAL;
        my %OLD_INSTANCE = %LD_INSTANCE;
+    $REREAD_CFG = 1;
        eval {
                &read_config();
                my %NEW_INSTANCE = %LD_INSTANCE;
@@ -1689,6 +1692,7 @@
                        }
                        # $ua->wait($$v{checktimeout});
                }
+        if ($REREAD_CFG)  {  $REREAD_CFG = 0;  }
                if (!check_cfgfile()) {
                        sleep $CHECKINTERVAL;
                }
@@ -2401,7 +2405,12 @@
         }
        else {
                 &system_wrapper("$IPVSADM -d $ipvsadm_args");
-               &ld_log("Deleted $log_args");
+            if ($REREAD_CFG)  {
+                &ld_log("Purged $log_args");
+            }
+            else  {
+                   &ld_log("Deleted $log_args");
+            }
        }
 }

@@ -2458,7 +2467,12 @@
         }
         else {
                 &system_wrapper("$IPVSADM -a $ipvsadm_args");
-               &ld_log("Added $log_args (Weight set to $rwght)");
+            if ($REREAD_CFG)  {
+                   &ld_log("Re-added $log_args (Weight set to $rwght)");
+            }
+            else  {
+                   &ld_log("Added $log_args (Weight set to $rwght)");
+            }
         }
 }

[root at linux ldirectord]#




On 1/12/07, jarol1 at seznam.cz <J.Libak at sh.cvut.cz> wrote:
>
> Dung Nguyen wrote:
> > Real servers are "Deleted" due to two reasons:  1) due reload of the
> > configuration file after an update and 2) due to fail status check.
> >
> > For organization that monitors the log files for actual node/resource
> > failure the second deletion reason is the only one they want to see.
> >
> > Thus to distinguish between the two I am submitting the following
> > patch.  It
> > retains the string "Deleted real server" for the first reason.
> >
> > And for the second reason, the string is modidifed to "Purged real
> > server".
> >
> > For organization that monitors the ldirectord log files, they can
> > watch for
> > the string "Purged real server" and take appropriate action.
> >
> > Note:  The patch I am submitting is for version 1.120, the official
> > version
> > that my organization is using.  It can easily be extracted and applied
> to
> > the latest version.
> >
> > -Dung
> >
> >
> > [root at linux ldirectord]# diff -u ldirectord.v.1.120
> > ldirectord.v.1.120.patched --- ldirectord.v.1.120  2005-10-06 14:17:
> > 38.000000000 -0700
> > +++ ldirectord.v.1.120.patched  2007-01-11 09:22:53.000000000 -0800
> > @@ -397,6 +397,7 @@
> >            @REAL
> >            @VIRTUAL
> >            $HOSTNAME
> > +        $REREAD_CFG
> >
> >            $CRLF
> > );
> > @@ -412,6 +413,7 @@
> > $NEGOTIATETIMEOUT = 0;
> > $RUNPID           = "/var/run/ldirectord";
> > $QUIESCENT        = "yes";
> > +$REREAD_CFG       = 0;
> >
> > $CRLF = "\x0d\x0a";
> >
> > @@ -665,6 +667,7 @@
> > {
> >        @OLDVIRTUAL = @VIRTUAL;
> >        my %OLD_INSTANCE = %LD_INSTANCE;
> > +    $REREAD_CFG = 1;
> >        eval {
> >                &read_config();
> >                my %NEW_INSTANCE = %LD_INSTANCE;
> > @@ -688,6 +691,7 @@
> >                %LD_INSTANCE = %OLD_INSTANCE;
> >        }
> >        undef @OLDVIRTUAL;
> > +    $REREAD_CFG = 0;
> > }
> >
> >
> > @@ -2401,7 +2405,12 @@
> >         }
> >        else {
> >                 &system_wrapper("$IPVSADM -d $ipvsadm_args");
> > -               &ld_log("Deleted $log_args");
> > +            if ($REREAD_CFG)  {
> > +                &ld_log("Purged $log_args");
> > +            }
> > +            else  {
> > +                   &ld_log("Deleted $log_args");
> > +            }
> >        }
> > }
> >
> > [root at linux ldirectord]#
> > _______________________________________________
> > LinuxVirtualServer.org mailing list - lvs-users at LinuxVirtualServer.org
> > Send requests to lvs-users-request at LinuxVirtualServer.org
> > or go to http://www.in-addr.de/mailman/listinfo/lvs-users
> >
> Perhaps you could also write a patch for distinguishing between adding a
> new server because it became online or because reload was triggered and
> new real server was defined.
>
> Jaro
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users at LinuxVirtualServer.org
> Send requests to lvs-users-request at LinuxVirtualServer.org
> or go to http://www.in-addr.de/mailman/listinfo/lvs-users
>


More information about the lvs-users mailing list