summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2010-05-28 16:29:44 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2010-05-28 16:29:44 -0700
commit2a15f2562595b692f7a6fb547db78be6d26e78ce (patch)
tree2e624a3b9384fc16b5f9e8ec376207d2e9d4b990 /scripts
parentb4ee47b5e9ef779a7d59bb642fbd01da410f4ee5 (diff)
downloadvyatta-cluster-2a15f2562595b692f7a6fb547db78be6d26e78ce.tar.gz
vyatta-cluster-2a15f2562595b692f7a6fb547db78be6d26e78ce.zip
make clustering work with conntrack-sync
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-update-cluster.pl26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/vyatta-update-cluster.pl b/scripts/vyatta-update-cluster.pl
index ddce2f2..b8c22bf 100755
--- a/scripts/vyatta-update-cluster.pl
+++ b/scripts/vyatta-update-cluster.pl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+use Getopt::Long;
use strict;
use lib "/opt/vyatta/share/perl5";
use Vyatta::Cluster::Config;
@@ -8,13 +9,28 @@ my $HA_DIR = "/etc/ha.d";
my $HA_INIT = "/etc/init.d/heartbeat";
my $SERVICE_DIR = "/etc/init.d";
+my $conntrackd_service = undef;
+GetOptions("conntrackd_service=s" => \$conntrackd_service,
+);
+
my $config = new Vyatta::Cluster::Config;
$config->setup("cluster");
if ($config->isEmpty()) {
+
+ # check if conntrack-sync is using clustering as failover-mechanism
+ my $vconfig = new Vyatta::Config;
+ $vconfig->setLevel('service conntrack-sync failover-mechanism');
+ my @nodes = $vconfig->listNodes();
+ if (grep(/^cluster$/, @nodes)) {
+ print STDERR "cluster is being used as failover-mechanism in conntrack-sync\n";
+ exit 1;
+ }
+
# config is empty => deleted.
# shutdown clustering.
- system("$HA_INIT stop");
-
+ print "Stopping clustering...";
+ system("$HA_INIT stop >&/dev/null");
+ print " Done\n";
exit 0;
}
@@ -22,7 +38,11 @@ my ($authkeys, $haresources, $ha_cf, $err, @init_services);
while (1) {
($authkeys, $err) = $config->authkeys();
last if (!defined($authkeys));
- ($haresources, $err, @init_services) = $config->haresources();
+ if (defined $conntrackd_service) {
+ ($haresources, $err, @init_services) = $config->haresources("$conntrackd_service") if defined $conntrackd_service;
+ } else {
+ ($haresources, $err, @init_services) = $config->haresources();
+ }
last if (!defined($haresources));
($ha_cf, $err) = $config->ha_cf();
last;