fence-agents: master - fence_scsi: create /var/run/cluster if necessary
by rohara
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 078934a262d5516c234b65c1b3912789f035ebaf
Parent: a16b8148834dde5925bbc20465ddb8de567a9928
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 11:46:56 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 15:00:44 2011 -0600
fence_scsi: create /var/run/cluster if necessary
Before writing to fence_scsi.key or fence_scsi.dev, check to see if
/var/run/cluster directory exists. If not, create it.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index e6f82e7..9df5c0c 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -2,6 +2,7 @@
use Cwd 'realpath';
use File::Basename;
+use File::Path;
use Getopt::Std;
use POSIX;
@@ -359,6 +360,10 @@ sub dev_write ($)
my $file = "/var/run/cluster/fence_scsi.dev";
my $dev = shift;
+ if (! -d "/var/run/cluster") {
+ mkpath ("/var/run/cluster");
+ }
+
open (\*FILE, ">>$file") or die "$!\n";
print FILE "$dev\n";
close (FILE);
@@ -385,6 +390,10 @@ sub key_write ($)
my $file = "/var/run/cluster/fence_scsi.key";
my $key = shift;
+ if (! -d "/var/run/cluster") {
+ mkpath ("/var/run/cluster");
+ }
+
open (\*FILE, ">$file") or die "$!\n";
print FILE "$key\n";
close (FILE);
13 years, 2 months
fence-agents: master - fence_scsi: write devices to tmp file on unfence
by rohara
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: a16b8148834dde5925bbc20465ddb8de567a9928
Parent: 4069885281354264fc27997c699291cb3245c6b0
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 09:50:01 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 15:00:30 2011 -0600
fence_scsi: write devices to tmp file on unfence
When unfencing occurs (action=on), write list of devices that were
successfully registered to /var/run/cluster/fence_scsi.dev file. This
file will be used by the optional watchdog script. Note that the devices
are not added to the tmp file until the verification step.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 004b4ba..e6f82e7 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -40,6 +40,7 @@ sub do_action_on ($@)
my $self = (caller(0))[3];
my ($node_key, @devices) = @_;
+ dev_unlink ();
key_write ($node_key);
foreach $dev (@devices) {
@@ -126,6 +127,9 @@ sub do_verify_on ($@)
next;
}
+ ## write dev to device file once registration is verified
+ dev_write ($dev);
+
## check that a reservation exists
if (!get_reservation_key ($dev)) {
log_debug ("no reservation exists on device $dev");
@@ -337,12 +341,38 @@ sub do_reset (S)
return;
}
+sub dev_unlink ()
+{
+ my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.dev";
+
+ if (-e $file) {
+ unlink ($file) or die "$!\n";
+ }
+
+ return;
+}
+
+sub dev_write ($)
+{
+ my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.dev";
+ my $dev = shift;
+
+ open (\*FILE, ">>$file") or die "$!\n";
+ print FILE "$dev\n";
+ close (FILE);
+
+ return;
+}
+
sub key_read ()
{
my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.key";
my $key;
- open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, "<$file") or die "$!\n";
chomp ($key = <FILE>);
close (FILE);
@@ -352,9 +382,11 @@ sub key_read ()
sub key_write ($)
{
my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.key";
+ my $key = shift;
- open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n";
- print FILE "$_[0]\n";
+ open (\*FILE, ">$file") or die "$!\n";
+ print FILE "$key\n";
close (FILE);
return;
13 years, 2 months
fence-agents: master - fence_scsi: move key file to /var/run/cluster
by rohara
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 4069885281354264fc27997c699291cb3245c6b0
Parent: e6c003fa751eeb958642fcf4c14d088c820a57e4
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 09:35:02 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 15:00:21 2011 -0600
fence_scsi: move key file to /var/run/cluster
Since the contents of /var/run/cluster/ directory are cleared on each
reboot, move the fence_scsi.key file to that directory. This is useful
for watchdog checks as a means to avoid watchdog reboots when a node has
not yet unfenced or unfencing fails.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 6f68203..004b4ba 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -342,7 +342,7 @@ sub key_read ()
my $self = (caller(0))[3];
my $key;
- open (\*FILE, "</var/lib/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n";
chomp ($key = <FILE>);
close (FILE);
@@ -353,7 +353,7 @@ sub key_write ($)
{
my $self = (caller(0))[3];
- open (\*FILE, ">/var/lib/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n";
print FILE "$_[0]\n";
close (FILE);
13 years, 2 months
cluster: RHEL6 - fence_scsi_check: watchdog script for fence_scsi
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 539acade6590f0d1046ec67f51303473dccb5f08
Parent: 5ffb95ad7a8013fc37145146ee3b815f6fbe311a
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 14:08:48 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 14:08:48 2011 -0600
fence_scsi_check: watchdog script for fence_scsi
This fence_scsi_check watchdog script will check to see is the local
node's key is registered with any devices. If the key is registered with
at least one device, the script will return 0. If none of the devices
have the node's key registered (ie. it has been fenced), the script will
return 2 and node will reboot via watchdog.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
fence/agents/scsi/fence_scsi_check.pl | 170 +++++++++++++++++++++++++++++++++
1 files changed, 170 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi_check.pl b/fence/agents/scsi/fence_scsi_check.pl
new file mode 100644
index 0000000..9ecd7a5
--- /dev/null
+++ b/fence/agents/scsi/fence_scsi_check.pl
@@ -0,0 +1,170 @@
+#!/usr/bin/perl
+
+use POSIX;
+
+################################################################################
+
+my $dev_file = "/var/run/cluster/fence_scsi.dev";
+my $key_file = "/var/run/cluster/fence_scsi.key";
+
+################################################################################
+
+sub log_debug ($)
+{
+ my $time = strftime ("%b %e %T", localtime);
+ my $msg = shift;
+
+ print STDOUT "$time [$0] debug: $msg\n" if ($verbose);
+
+ return;
+}
+
+sub log_error ($)
+{
+ my $time = strftime ("%b %e %T", localtime);
+ my $msg = shift;
+
+ print STDERR "$time [$0] error: $msg\n";
+
+ return;
+}
+
+sub do_reset ($)
+{
+ my $dev = shift;
+
+ my $cmd = "sg_turs $dev";
+ my @out = qx { $cmd 2> /dev/null };
+
+ return;
+}
+
+sub get_registration_keys ($)
+{
+ my $dev = shift;
+ my @keys = ();
+
+ do_reset ($dev);
+
+ my $cmd = "sg_persist -n -i -k -d $dev";
+ my @out = qx { $cmd 2> /dev/null };
+
+ if ($?>>8 != 0) {
+ log_error ("$cmd");
+ exit (0);
+ }
+
+ foreach (@out) {
+ chomp;
+ if (s/^\s+0x//i) {
+ push (@keys, $_);
+ }
+ }
+
+ return (@keys);
+}
+
+sub get_reservation_keys ($)
+{
+ my $dev = shift;
+ my @keys = ();
+
+ do_reset ($dev);
+
+ my $cmd = "sg_persist -n -i -r -d $dev";
+ my @out = qx { $cmd 2> /dev/null };
+
+ if ($?>>8 != 0) {
+ log_error ("$cmd");
+ exit (0);
+ }
+
+ foreach (@out) {
+ chomp;
+ if (s/^\s+key=0x//i) {
+ push (@keys, $_);
+ }
+ }
+
+ return (@keys);
+}
+
+sub get_verbose ()
+{
+ open (\*FILE, "</etc/sysconfig/watchdog") or return;
+ chomp (my @opt = <FILE>);
+ close (FILE);
+
+ foreach (@opt) {
+ next if (/^#/);
+ next unless ($_);
+
+ if (/^verbose=yes$/i) {
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+sub key_read ()
+{
+ open (\*FILE, "<$key_file") or exit (0);
+ chomp (my $key = <FILE>);
+ close (FILE);
+
+ return ($key);
+}
+
+sub dev_read ()
+{
+ open (\*FILE, "<$dev_file") or exit (0);
+ chomp (my @dev = <FILE>);
+ close (FILE);
+
+ return (@dev);
+}
+
+################################################################################
+
+if ($ARGV[0] =~ /^repair$/i) {
+ exit ($ARGV[1]);
+}
+
+if (-e "/etc/sysconfig/watchdog") {
+ $verbose = get_verbose ();
+}
+
+if (! -e $dev_file) {
+ log_debug ("$dev_file does not exit");
+ exit (0);
+} elsif (-z $dev_file) {
+ log_debug ("$dev_file is empty");
+ exit (0);
+}
+
+if (! -e $key_file) {
+ log_debug ("$key_file does not exist");
+ exit (0);
+} elsif (-z $key_file) {
+ log_debug ("$key_file is empty");
+ exit (0);
+}
+
+my $key = key_read ();
+my @dev = dev_read ();
+
+foreach (@dev) {
+ my @keys = grep { /^$key$/i } get_registration_keys ($_);
+
+ if (scalar (@keys) != 0) {
+ log_debug ("key $key registered with device $_");
+ exit (0);
+ } else {
+ log_debug ("key $key not registered with device $_");
+ }
+}
+
+log_debug ("key $key not registered with any devices");
+
+exit (2);
13 years, 2 months
cluster: RHEL6 - fence_scsi: create /var/run/cluster if necessary
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5ffb95ad7a8013fc37145146ee3b815f6fbe311a
Parent: c449755291a536bafa27006a66301c13adcafdf3
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 11:46:56 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 11:46:56 2011 -0600
fence_scsi: create /var/run/cluster if necessary
Before writing to fence_scsi.key or fence_scsi.dev, check to see if
/var/run/cluster directory exists. If not, create it.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 56653fc..ba9770f 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -2,6 +2,7 @@
use Cwd 'realpath';
use File::Basename;
+use File::Path;
use Getopt::Std;
use POSIX;
@@ -359,6 +360,10 @@ sub dev_write ($)
my $file = "/var/run/cluster/fence_scsi.dev";
my $dev = shift;
+ if (! -d "/var/run/cluster") {
+ mkpath ("/var/run/cluster");
+ }
+
open (\*FILE, ">>$file") or die "$!\n";
print FILE "$dev\n";
close (FILE);
@@ -385,6 +390,10 @@ sub key_write ($)
my $file = "/var/run/cluster/fence_scsi.key";
my $key = shift;
+ if (! -d "/var/run/cluster") {
+ mkpath ("/var/run/cluster");
+ }
+
open (\*FILE, ">$file") or die "$!\n";
print FILE "$key\n";
close (FILE);
13 years, 2 months
cluster: RHEL6 - fence_scsi: write devices to tmp file on unfence
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c449755291a536bafa27006a66301c13adcafdf3
Parent: b62e49d1c476a6875e689e7d0a7b3fa44135ecb6
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 09:50:01 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 09:50:01 2011 -0600
fence_scsi: write devices to tmp file on unfence
When unfencing occurs (action=on), write list of devices that were
successfully registered to /var/run/cluster/fence_scsi.dev file. This
file will be used by the optional watchdog script. Note that the devices
are not added to the tmp file until the verification step.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index e162dfe..56653fc 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -40,6 +40,7 @@ sub do_action_on ($@)
my $self = (caller(0))[3];
my ($node_key, @devices) = @_;
+ dev_unlink ();
key_write ($node_key);
foreach $dev (@devices) {
@@ -126,6 +127,9 @@ sub do_verify_on ($@)
next;
}
+ ## write dev to device file once registration is verified
+ dev_write ($dev);
+
## check that a reservation exists
if (!get_reservation_key ($dev)) {
log_debug ("no reservation exists on device $dev");
@@ -337,12 +341,38 @@ sub do_reset (S)
return;
}
+sub dev_unlink ()
+{
+ my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.dev";
+
+ if (-e $file) {
+ unlink ($file) or die "$!\n";
+ }
+
+ return;
+}
+
+sub dev_write ($)
+{
+ my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.dev";
+ my $dev = shift;
+
+ open (\*FILE, ">>$file") or die "$!\n";
+ print FILE "$dev\n";
+ close (FILE);
+
+ return;
+}
+
sub key_read ()
{
my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.key";
my $key;
- open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, "<$file") or die "$!\n";
chomp ($key = <FILE>);
close (FILE);
@@ -352,9 +382,11 @@ sub key_read ()
sub key_write ($)
{
my $self = (caller(0))[3];
+ my $file = "/var/run/cluster/fence_scsi.key";
+ my $key = shift;
- open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n";
- print FILE "$_[0]\n";
+ open (\*FILE, ">$file") or die "$!\n";
+ print FILE "$key\n";
close (FILE);
return;
13 years, 2 months
cluster: RHEL6 - fence_scsi: move key file to /var/run/cluster
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: b62e49d1c476a6875e689e7d0a7b3fa44135ecb6
Parent: 678661a05b1c5bb1ab81515ea97e3102d9e3f18c
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Mar 1 09:35:02 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Mar 1 09:35:02 2011 -0600
fence_scsi: move key file to /var/run/cluster
Since the contents of /var/run/cluster/ directory are cleared on each
reboot, move the fence_scsi.key file to that directory. This is useful
for watchdog checks as a means to avoid watchdog reboots when a node has
not yet unfenced or unfencing fails.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index ae658ab..e162dfe 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -342,7 +342,7 @@ sub key_read ()
my $self = (caller(0))[3];
my $key;
- open (\*FILE, "</var/lib/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n";
chomp ($key = <FILE>);
close (FILE);
@@ -353,7 +353,7 @@ sub key_write ($)
{
my $self = (caller(0))[3];
- open (\*FILE, ">/var/lib/cluster/fence_scsi.key") or die "$!\n";
+ open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n";
print FILE "$_[0]\n";
close (FILE);
13 years, 2 months
resource-agents: the annotated tag v3.1.1 has been created
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git...
Commit: 11298c25c6c81cd73d2d1f0e63e9acb90b44cafa
Parent: 0000000000000000000000000000000000000000
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: 2011-03-01 14:37 +0000
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: 2011-03-01 14:37 +0000
annotated tag: v3.1.1 has been created
at 11298c25c6c81cd73d2d1f0e63e9acb90b44cafa (tag)
tagging 49ef8ffe48a2fc6a7e4c132bab87b11a76dd8f9e (commit)
replaces v3.1.0
v3.1.1 release
Fabio M. Di Nitto (1):
fs-lib: fix do_monitor device mapping
Lon Hohberger (3):
resource-agents: Fix migrateuriopt setting
resource-agents: Improve LD_LIBRARY_PATH handling by SAP*
resource-agents: Use literal quotes for tr calls
Marek 'marx' Grac (3):
resource-agents: Add option disable_rdisc to ip.sh
resource-agents: Apache resource with spaces in name fails to start
resource-agents: Remove netmask from IP address when creating list of them
13 years, 2 months