Skip to contentSkip to conversation

Cluster Project branch, master, updated. gfs-kernel_0_1_22-149-gabb6c8d

Cluster-devel [email protected] 1 participant 1 message Apr 9, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f

The branch, master has been updated

       via  abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f (commit)
       via  8df38eef89cef15c8fa5a206ae0678933a544e45 (commit)
       via  5aabcde2f5d491ba458995baf67fee640712cefb (commit)
       via  25db297266c0cbb9bab88de0cb0744a4f14b8b52 (commit)
       via  fbe58e96cc24efd86a7414a30f6bffc2df97ed26 (commit)
       via  c9a335dc94da64e72bd7dff54681d33a6631df8f (commit)
       via  3d977223d89aaffceb0164a520beeec323a325a7 (commit)
       via  00b4e7e8b7ef4fee16ef27b161dc14bae639df76 (commit)
       via  6f2dcc865aa13927baad8cdd2bbbd6d1e85c0347 (commit)
       via  9c762815ed9a2ec7747d60692ceb8042699a5f05 (commit)
       via  7094b509386a7eb4080ff342296c54852c604b4b (commit)
       via  49e6378f7737a03280df9087242e124385e26a4e (commit)
       via  7c4b9b16ce70cb47e9c39945689eea1f6e04416f (commit)
       via  b8eb355ff5ab70b773d65648c7b84f9c3aef00b2 (commit)
       via  6888783349cecc81d43cf5ecafdd14db1e6a6b2a (commit)
       via  74394072b0ec11191a6917793d313992f7705db7 (commit)
       via  683538f4b998257ec50c53ba824f532c3ffab363 (commit)
       via  dd7199c180b0a58b1ab8aebda852fb9c12e4a01a (commit)
       via  509a89968595d8793a484739c10aa8ae00107b3e (commit)
      from  bdf3aa8831d5689dbdeb3ad74c6b5326ceddc5eb (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f

Author: Ryan O'Hara <[email protected]>
Date:   Mon Apr 7 11:16:55 2008 -0500

BZ 441323 : Redirect stderr to /dev/null when getting list of devices.

commit 8df38eef89cef15c8fa5a206ae0678933a544e45

Author: Chris Feist <[email protected]>
Date:   Thu Jan 24 22:20:23 2008 +0000

Added back in change to description line to make chkconfig work properly.

commit 5aabcde2f5d491ba458995baf67fee640712cefb

Author: Ryan O'Hara <[email protected]>
Date:   Fri Jan 18 23:02:58 2008 +0000

BZ: 373491, 373511, 373531, 373541, 373571, 429033
BZ: 373491, 373511, 373531, 373541, 373571, 429033

- Prevent "reservation conflict" messageswhen scsi_reserve starts.
- Leave the fence domain if scsi_reserve fails to register with any device.
- Improve logging in scsi_reserve script.
- Use "locking_type = 0" for all lvm commands (ie. vgs).
- Fix SCSI reservations scripts to handle LVM mirrors and stripes.
- Not an error if fence_scsi attempts to remove a non-existent key from a device.

commit 25db297266c0cbb9bab88de0cb0744a4f14b8b52

Author: Ryan O'Hara <[email protected]>
Date:   Thu Nov 8 18:48:08 2007 +0000

BZ 248715
- Use cluster ID and node ID for key rather than IP address.

commit fbe58e96cc24efd86a7414a30f6bffc2df97ed26

Author: Ryan McCabe <[email protected]>
Date:   Fri Sep 21 03:09:04 2007 +0000

fix bz277781 by accepting "nodename" as a synonym for "node"

commit c9a335dc94da64e72bd7dff54681d33a6631df8f

Author: Ryan O'Hara <[email protected]>
Date:   Tue Mar 6 19:10:34 2007 +0000

Fix help message to refer to script as 'fence_scsi_test'.

commit 3d977223d89aaffceb0164a520beeec323a325a7

Author: Ryan O'Hara <[email protected]>
Date:   Thu Dec 14 21:18:09 2006 +0000

Attempt to register the node in the case where it must perform fence_scsi fencing but is not registered with the device(s) that must be fence. With SCSI persistent reservations, in order to do a "preempt and abort" (which we are using to fence a node), the node doing this operation must be registered with the device. This fix will check to see the the node that is performing the fencing is registered with the device(s). If it is not, then it attempts to register with the device(s) so that it can then continue with the fence operation normally. Note that this situation should never happen, especially if things are configured properly.

commit 00b4e7e8b7ef4fee16ef27b161dc14bae639df76

Author: Ryan O'Hara <[email protected]>
Date:   Thu Dec 14 18:32:43 2006 +0000

Allow 'stop' to release the reservation if and only if there are no other keys registered with a given device. Prior to this fix, if was not possible for 'scsi_reserve stop' to unregister/release on the node that was holding the reservation.

commit 6f2dcc865aa13927baad8cdd2bbbd6d1e85c0347

Author: Ryan O'Hara <[email protected]>
Date:   Tue Dec 12 23:20:47 2006 +0000

Record devices that are successfully registered to /var/run/scsi_reserve.

commit 9c762815ed9a2ec7747d60692ceb8042699a5f05

Author: Ryan O'Hara <[email protected]>
Date:   Tue Dec 12 22:22:51 2006 +0000

Rewrite of get_scsi_devices function.
It is no longer possible to use lvs to get a list of cluster volumes (and underlying devices) at fence time. For this reason we must "keep state" by recording which devices we register with at startup. The init script (scsi_reserve) will record each device it successfully registered with to a file (/var/run/scsi_reserve). Then, and fence time, the fence_scsi agent will unregister each device listed in the state file.

commit 7094b509386a7eb4080ff342296c54852c604b4b

Author: Ryan O'Hara <[email protected]>
Date:   Tue Dec 12 21:32:53 2006 +0000

Fix success/failure reporting when registering devices at startup. If our node (key) is already registered with a given device, do not report failure since this is misleading.

commit 49e6378f7737a03280df9087242e124385e26a4e

Author: Ryan O'Hara <[email protected]>
Date:   Fri Dec 8 22:22:34 2006 +0000
    Replace /var/lock/subsys/${0##*/} with /var/lock/subsys/scsi_reserve.

commit 7c4b9b16ce70cb47e9c39945689eea1f6e04416f

Author: Ryan O'Hara <[email protected]>
Date:   Fri Dec 8 21:23:00 2006 +0000

Fix split calls to be consistent. Remove the optional LIMIT parameter.

commit b8eb355ff5ab70b773d65648c7b84f9c3aef00b2

Author: Ryan O'Hara <[email protected]>
Date:   Fri Dec 8 20:48:00 2006 +0000

Fix code to use get_key subroutine.
Fix sg_persist commands to specify device via -d parameter.

commit 6888783349cecc81d43cf5ecafdd14db1e6a6b2a

Author: Ryan O'Hara <[email protected]>
Date:   Fri Dec 1 17:53:22 2006 +0000

Remove "self" parameter. This was used to specify the name of the node performing the fence operation, and was passed to the agent. This is no longer used. Instead, we get the name of the local node in the agent by parsing the output from 'cman_tool status'.

commit 74394072b0ec11191a6917793d313992f7705db7

Author: Ryan O'Hara <[email protected]>
Date:   Wed Nov 29 20:54:42 2006 +0000

Fix unregister code to report failure correctly.

commit 683538f4b998257ec50c53ba824f532c3ffab363

Author: Ryan O'Hara <[email protected]>
Date:   Wed Nov 29 20:50:22 2006 +0000

Variable should be quoted in conditional statement.

commit dd7199c180b0a58b1ab8aebda852fb9c12e4a01a

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Apr 9 05:33:54 2008 +0200

Revert "fix bz277781 by accepting "nodename" as a synonym for "node""

This reverts commit 57a07697afeb2e5d3bb2a4220e844bcdc44598cb.

commit 509a89968595d8793a484739c10aa8ae00107b3e

Author: Fabio M. Di Nitto <[email protected]>
Date:   Wed Apr 9 05:33:18 2008 +0200

Revert "Fix help message to refer to script as 'fence_scsi_test'."

This reverts commit e9b17a088668ceaba5c6ea35f8d22ec2613cfe96.

-----------------------------------------------------------------------

Summary of changes:

 fence/agents/scsi/fence_scsi.pl      |  248 ++++++++++++++++++++++++----
 fence/agents/scsi/fence_scsi_test.pl |  171 ++++++++++----------
 fence/agents/scsi/scsi_reserve       |  300 +++++++++++++++++++++++-----------
 3 files changed, 506 insertions(+), 213 deletions(-)
fence/agents/scsi/fence_scsi.pl +215 -33
index 89822e8..b9aea99 100755
@@ -1,19 +1,16 @@
 #!/usr/bin/perl
 
 use Getopt::Std;
+use XML::LibXML;
 use IPC::Open3;
 use POSIX;
 
-my $verbose = 0;
 my @volumes;
 
 $_ = $0;
 s/.*\///;
 my $pname = $_;
 
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-                                                                                
 #BEGIN_VERSION_GENERATION
 $RELEASE_VERSION="";
 $REDHAT_COPYRIGHT="";
@@ -62,13 +59,137 @@ sub fail_usage
     exit 1;
 }
 
+sub get_cluster_id
+{
+    my $cluster_id;
+
+    my ($in, $out, $err);
+    my $cmd = "cman_tool status";
+
+    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
+
+    waitpid($pid, 0);
+
+    die "Unable to execute cman_tool.\n" if ($?>>8);
+
+    while (<$out>)
+    {
+	chomp;
+	print "OUT: $_\n" if $opt_v;
+
+	my ($name, $value) = split(/\s*:\s*/, $_);
+
+	if ($name eq "Cluster Id")
+	{
+	    $cluster_id = $value;
+	    last;
+	}
+    }
+
+    close($in);
+    close($out);
+    close($err);
+
+    return $cluster_id;
+}
+
+sub get_node_id
+{
+    ($node)=@_;
+
+    my $xml = XML::LibXML->new();
+    my $tree = $xml->parse_file("/etc/cluster/cluster.conf");
+
+    my $xpath = "//cluster/clusternodes/clusternode[\@name='$node']/\@nodeid";
+
+    my $node_id = $tree->findvalue($xpath);
+
+    return $node_id;
+}
+
+sub get_node_name
+{
+    return $opt_n;
+}
+
+sub get_host_id
+{
+    my $host_id;
+
+    my ($in, $out, $err);
+    my $cmd = "cman_tool status";
+
+    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
+
+    waitpid($pid, 0);
+
+    die "Unable to execute cman_tool.\n" if ($?>>8);
+
+    while (<$out>)
+    {
+	chomp;
+	print "OUT: $_\n" if $opt_v;
+
+	my ($name, $value) = split(/\s*:\s*/, $_);
+
+	if ($name eq "Node ID")
+	{
+	    $host_id = $value;
+	    last;
+	}
+    }
+
+    close($in);
+    close($out);
+    close($err);
+
+    return $host_id;
+}
+
+sub get_host_name
+{
+    my $host_name;
+
+    my ($in, $out, $err);
+    my $cmd = "cman_tool status";
+
+    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
+
+    waitpid($pid, 0);
+
+    die "Unable to execute cman_tool.\n" if ($?>>8);
+
+    while (<$out>)
+    {
+	chomp;
+	print "OUT: $_\n" if $opt_v;
+
+	my ($name, $value) = split(/\s*:\s*/, $_);
+
+	if ($name eq "Node name")
+	{
+	    $host_name = $value;
+	    last;
+	}
+    }
+
+    close($in);
+    close($out);
+    close($err);
+
+    return $host_name;
+}
+
 sub get_key
 {
     ($node)=@_;
 
-    my $addr = gethostbyname($node) or die "$!\n";
+    my $cluster_id = get_cluster_id;
+    my $node_id = get_node_id($node);
+
+    my $key = sprintf "%x%.4x", $cluster_id, $node_id;
 
-    return unpack("H*", $addr);
+    return $key;
 }
 
 sub get_options_stdin
@@ -93,7 +214,7 @@ sub get_options_stdin
 
 	next unless $opt;
 
-	($name, $val) = split /\s*=\s*/, $opt;
+	($name, $val) = split(/\s*=\s*/, $opt);
 
 	if ($name eq "")
 	{
@@ -111,10 +232,6 @@ sub get_options_stdin
 	{
 	    $opt_n = $val;
 	}
-	elsif ($name eq "self")
-	{
-	    $opt_s = $val;
-	}
 	elsif ($name eq "verbose")
 	{
 	    $opt_v = $val;
@@ -126,10 +243,45 @@ sub get_options_stdin
     }
 }
 
+sub get_key_list
+{
+    ($dev) = @_;
+
+    my ($in, $out, $err);
+
+    my $cmd = "sg_persist -n -d $dev -i -k";
+    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
+
+    waitpid($pid, 0);
+
+    die "Unable to execute sg_persist.\n" if ($?>>8);
+
+    while (<$out>)
+    {
+	chomp;
+	if ($_ =~ /^\s*0x/)
+	{
+	    s/^\s+0x//;
+	    s/\s+$//;
+
+	    $key_list{$_} = 1;
+	}
+    }
+
+    close($in);
+    close($out);
+    close($err);
+
+    return %key_list;
+}
+
 sub get_scsi_devices
 {
     my ($in, $out, $err);
-    my $cmd = "lvs --noheadings --separator : -o vg_attr,devices";
+
+    my $cmd = "vgs --config 'global { locking_type = 0 }'" .
+              "    --noheadings --separator : -o vg_attr,pv_name 2> /dev/null";
+
     my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
 
     waitpid($pid, 0);
@@ -141,12 +293,12 @@ sub get_scsi_devices
 	chomp;
 	print "OUT: $_\n" if $opt_v;
 
-	my ($vg_attrs, $device) = split /:/, $_, 3;
+	my ($vg_attrs, $device) = split(/:/, $_);
 
 	if ($vg_attrs =~ /.*c$/)
 	{
 	    $device =~ s/\(.*\)//;
-	    push @volumes, $device;
+	    push(@volumes, $device);
 	}
     }
 
@@ -176,43 +328,74 @@ sub check_sg_persist
     close($err);
 }
 
+sub do_register
+{
+    ($dev, $key) = @_;
+
+    my ($in, $out, $err);
+    my $cmd = "sg_persist -n -d $dev -o -G -S $key";
+    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
+
+    waitpid($pid, 0);
+
+    die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
+
+    while (<$out>)
+    {
+	chomp;
+	print "OUT: $_\n" if $opt_v;
+    }
+
+    close($in);
+    close($out);
+    close($err);
+}
+
 sub fence_node
 {
-    # my $name = (POSIX::uname())[1];
+    my $host_name = get_host_name();
+    my $node_name = get_node_name();
+
+    my $host_key = get_key($host_name);
+    my $node_key = get_key($node_name);
 
-    my $host_key = get_key($opt_s);
-    my $node_key = get_key($opt_n);
-    
-    my $cmd;
     my ($in, $out, $err);
 
     foreach $dev (@volumes)
     {
+	my %key_list = get_key_list($dev);
+
+	if (!$key_list{$host_key})
+	{
+	    do_register($dev, $host_key);
+	}
+
+	if (!$key_list{$node_key})
+	{
+	    next;
+	}
+
 	if ($host_key eq $node_key)
 	{
-	    $cmd = "sg_persist -d $dev -o -G -K $host_key -S 0";
+	    $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0";
 	}
 	else
 	{
-	    $cmd = "sg_persist -d $dev -o -A -K $host_key -S $node_key -T 5";
+	    $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5";
 	}
 
 	my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
 
 	waitpid($pid, 0);
 
-	if ($opt_v)
+	die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
+
+	while (<$out>)
 	{
-	    print "$cmd\n";
-	    while (<$out>)
-	    {
-		chomp;
-		print "OUT: $_\n";
-	    }
+	    chomp;
+	    print "OUT: $_\n" if $opt_v;
 	}
 
-	die "Unable to execute sg_persist.\n" if ($?>>8);
-
 	close($in);
 	close($out);
 	close($err);
@@ -228,16 +411,15 @@ if (@ARGV > 0) {
     usage if defined $opt_h;
     version if defined $opt_V;
 
-    fail_usage "Unkown parameter." if (@ARGV > 0);
+    fail_usage "Unknown parameter." if (@ARGV > 0);
+
     fail_usage "No '-n' flag specified." unless defined $opt_n;
-    fail_usage "No '-s' flag specified." unless defined $opt_s;
 
 } else {
 
     get_options_stdin();
 
     fail "failed: missing 'node'" unless defined $opt_n;
-    fail "failed: missing 'self'" unless defined $opt_s;
 
 }
 
fence/agents/scsi/fence_scsi_test.pl +87 -84

261 lines not on this page · raw message

fence/agents/scsi/scsi_reserve +204 -96

344 lines not on this page · raw message

hooks/post-receive
--
Cluster Project