LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: ldirector and heartbeat

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: ldirector and heartbeat
From: Horms <horms@xxxxxxxxxxxx>
Date: Wed, 12 Jul 2006 19:38:52 +0900 (JST)
On Wed, 28 Jun 2006 08:05:05 -0400, John Gray wrote:
> Jason Downing wrote:
>>> No but that does sound like a good idea. If I prepare a patch are
>>> you able to test it to see if it helps your problem?
>>
> I could test it too.


Hi,

below is a patch for ldirectord (current CVS version) which allows
whether or not it cleans up IPVS to be configured.

-- 
Horms                                           
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.141
diff -u -r1.141 ldirectord
--- ldirectord  6 Jul 2006 04:51:45 -0000       1.141
+++ ldirectord  12 Jul 2006 09:32:30 -0000
@@ -153,6 +153,19 @@
 after the configuration file changed on disk. However, if B<autoreload>
 is set to yes, the configuration is reloaded anyway.
 
+B<clean_up_on_exit = >[B<yes>|B<no>]
+
+If I<yes>, then all the real servers and virtual services will be removed
+from the IPVS kernel table when ldirectord exits. Otherwise, the table is
+left in its prevailing state.
+
+This behaviour occurs regardless of ldirectord exits normally, or through a
+malfunction. The only exceptions are if ldirectord is sent a KILL signal,
+or tries to exit repetadly in a short period of time, persubaly because of
+some error in the exit path.
+
+The default is yes, which is strongly recommended.
+
 B<fallback = >I<ip_address|hostname[:portnumber|sercvicename]> 
[B<gate>|B<masq>|B<ipip>]
 
 the server onto which a webservice is redirected if all real
@@ -415,6 +428,7 @@
            $RUNPID
            $CHECKTIMEOUT
            $QUIESCENT
+           $CLEAN_UP_ON_EXIT
 
            $CALLBACK
            $CFGNAME
@@ -455,6 +469,7 @@
 $NEGOTIATETIMEOUT = 0;
 $RUNPID           = "/var/run/ldirectord";
 $QUIESCENT        = "yes";
+$CLEAN_UP_ON_EXIT = "yes";
 
 $CRLF = "\x0d\x0a";
 
@@ -1035,6 +1050,11 @@
                        $AUTOCHECK = $1;
                } elsif ($_ =~ /^callback\s*=\s*\"(.*)\"/) {
                        $CALLBACK = $1;
+               } elsif ($_ =~ /^clean_up_on_exit\s*=\s*(.*)/) {
+                       ($1 eq "yes" || $1 eq "no")
+                           or &config_error($line, "clean_up_on_exit " .
+                                       "must be 'yes' or 'no'");
+                       $CLEAN_UP_ON_EXIT = $1;
                } elsif ($_ =~ /^logfile\s*=\s*\"(.*)\"/) {
                        my $tmpLDIRLOG = $LDIRLOG;
                        $LDIRLOG = $1;
@@ -1688,6 +1708,10 @@
 
 sub ld_stop
 {
+       if ($CLEAN_UP_ON_EXIT ne "yes") {
+               return
+       }
+
        foreach my $v (@VIRTUAL) {
                my $real = $$v{real};
                foreach my $r (@$real) {

<Prev in Thread] Current Thread [Next in Thread>
  • Re: ldirector and heartbeat, Horms <=