Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=58…
Commit: 5822073b63d1b83af623bb3c72dccc97f4eb2e27
Parent: 9a4c263b0367fe2d80127e17b94c049e9ee2c59e
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Jan 26 10:16:27 2011 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Jan 26 10:16:27 2011 -0500
rgmanager: Fix clustat help & version operations
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/utils/clustat.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
index 2b47306..d7e8dd8 100644
--- a/rgmanager/src/utils/clustat.c
+++ b/rgmanager/src/utils/clustat.c
@@ -1031,11 +1031,11 @@ usage(char *arg0)
" -I Display local node ID and exit\n"
" -m <member> Display status of <member> and exit\n"
" -s <service> Display status of <service> and exit\n"
-" -v Display version & cluster plugin and exit\n"
+" -v Display version and exit\n"
" -x Dump information as XML\n"
-" -Q Return 0 if quorate, 1 if not (no output)\n"
-" -f Enable fast clustat reports\n"
-" -l Use long format for services\n"
+" -Q Return 0 if quorate, 1 if not (no output)\n"
+" -f Enable fast clustat reports\n"
+" -l Use long format for services\n"
"\n", basename(arg0));
}
@@ -1130,7 +1130,7 @@ main(int argc, char **argv)
/* Connect & grab all our info */
ch = cman_init(NULL);
- if (!ch) {
+ if (!ch && (runtype != VERSION_ONLY)) {
perror("Could not connect to CMAN");
return 1;
}
@@ -1144,8 +1144,6 @@ main(int argc, char **argv)
case VERSION_ONLY:
printf("%s version %s\n", basename(argv[0]),
RELEASE_VERSION);
- if (!ch)
- break;
goto cleanup;
case NODEID_ONLY:
if (!ch)
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9a…
Commit: 9a4c263b0367fe2d80127e17b94c049e9ee2c59e
Parent: deb7f90e820250a7bfad9c94abaf1b49ca62bf7d
Author: Shane Bradley <sbradley(a)redhat.com>
AuthorDate: Wed Jan 26 10:05:27 2011 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Jan 26 10:08:04 2011 -0500
rgmanager: Fix nofailback when service is in 'starting' state
If a failover domain has "nofailback" enabled a service that is
"starting" state would still failback to the original. If a
service takes a while to come up and is in the "starting" state
and the original node comes back online while it is in that state
the service will be failed back.
Signed-off-by: Shane Bradley <sbradley(a)redhat.com>
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/fo_domain.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
index 0448e0d..638dde9 100644
--- a/rgmanager/src/daemons/fo_domain.c
+++ b/rgmanager/src/daemons/fo_domain.c
@@ -529,7 +529,7 @@ node_should_start(int nodeid, cluster_member_list_t *membership,
* Check to see if the service is started and if we are the owner in case of
* restricted+owner+no failback
*/
- if (svc_state.rs_state == RG_STATE_STARTED)
+ if (svc_state.rs_state == RG_STATE_STARTED || svc_state.rs_state == RG_STATE_STARTING)
started = 1;
if (svc_state.rs_owner == (uint32_t)nodeid)
owned_by_node = 1;
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 394c23c8f9e1e0fb934ba994e2e5a786467d6bec
Parent: 94785737630d925368fd98639709b1e8518cf872
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Jan 25 12:10:25 2011 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Jan 25 12:10:25 2011 -0500
resource-agents: Improve LD_LIBRARY_PATH handling by SAP*
This is a backport from the Heartbeat resource agents repository.
Author: Dejan Muhamedagic (dejan at hello-penguin com)
http://hg.linux-ha.org/agents/rev/2773e5850003
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/SAPDatabase | 3 ++-
rgmanager/src/resources/SAPInstance | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/resources/SAPDatabase b/rgmanager/src/resources/SAPDatabase
index e1249b8..e03e8b6 100644
--- a/rgmanager/src/resources/SAPDatabase
+++ b/rgmanager/src/resources/SAPDatabase
@@ -993,7 +993,8 @@ fi
# as root user we need the library path to the SAP kernel to be able to call executables
if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then
- LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
+ LD_LIBRARY_PATH=$DIR_EXECUTABLE${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH
fi
sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"
diff --git a/rgmanager/src/resources/SAPInstance b/rgmanager/src/resources/SAPInstance
index a97aaf6..7d05b3a 100644
--- a/rgmanager/src/resources/SAPInstance
+++ b/rgmanager/src/resources/SAPInstance
@@ -566,7 +566,8 @@ fi
# as root user we need the library path to the SAP kernel to be able to call sapcontrol
if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then
- LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
+ LD_LIBRARY_PATH=$DIR_EXECUTABLE${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH
fi
sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a9…
Commit: a9dd0bb396423ac45120f01bfbe62225eb3d5cd7
Parent: 3a8e770b5466fa477a98c6e010babe96fbab0bd1
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Mon Jan 24 13:54:25 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Jan 25 10:00:31 2011 -0600
fence_scsi: verify that on/off actions succeed
This patch adds code to verify that both "on" and "off" actions are
successful. This is needed because there seem to be some arrays that
do not report an error even when no registration was created, etc.
These verification steps takes places after the action has been
performed successfully. If an error was encountered while performing
either an "on" or "off" action, fence_scsi will exit and no verification
will take place. Failure to verify that an action was successful for any
device will result is failure.
For the "on" action, do_verify_on will check that the key was
successfully registered with each devices and that a reservation exists
on each device.
For the "off" action, do_verify_off will check that the key was removed
from each device and that a reservation exists on each device.
Resolves: rhbz#644385
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 58 +++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 5156881..efeeba3 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -110,6 +110,62 @@ sub do_action_status ($@)
}
}
+sub do_verify_on ($@)
+{
+ my $self = (caller(0))[3];
+ my ($node_key, @devices) = @_;
+ my $count = 0;
+
+ for $dev (@devices) {
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
+
+ ## check that our key is registered
+ if (scalar (@keys) == 0) {
+ log_debug ("failed to register key $node_key on device $dev");
+ $count++;
+ next;
+ }
+
+ ## check that a reservation exists
+ if (!get_reservation_key ($dev)) {
+ log_debug ("no reservation exists on device $dev");
+ $count++;
+ }
+ }
+
+ if ($count != 0) {
+ log_error ("$self: failed to verify $count devices");
+ }
+}
+
+sub do_verify_off ($@)
+{
+ my $self = (caller(0))[3];
+ my ($node_key, @devices) = @_;
+ my $count = 0;
+
+ for $dev (@devices) {
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
+
+ ## check that our key is not registered
+ if (scalar (@keys) != 0) {
+ log_debug ("failed to remove key $node_key from device $dev");
+ $count++;
+ next;
+ }
+
+ ## check that a reservation exists
+ if (!get_reservation_key ($dev)) {
+ log_debug ("no reservation exists on device $dev");
+ $count++;
+ }
+ }
+
+ if ($count != 0) {
+ log_error ("$self: failed to verify $count devices");
+ }
+}
+
sub do_register ($$$)
{
my $self = (caller(0))[3];
@@ -668,9 +724,11 @@ if (!defined $opt_o) {
##
if ($opt_o =~ /^on$/i) {
do_action_on ($key, @devices);
+ do_verify_on ($key, @devices);
}
elsif ($opt_o =~ /^off$/i) {
do_action_off ($key, @devices);
+ do_verify_off ($key, @devices);
}
elsif ($opt_o =~ /^status/i) {
do_action_status ($key, @devices);
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3a…
Commit: 3a8e770b5466fa477a98c6e010babe96fbab0bd1
Parent: 337eecbdc58818617ae7124d1eeb0aeb002caf59
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Mon Jan 24 12:47:23 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Jan 25 09:38:30 2011 -0600
fence_scsi: always do sg_turs for dm-mp devices
This patch fixes a with the original patch posted last week. Before
attempting to register with a device, we should call sg_turs on the
device. If that device is a dm-multipath device, we should call sg_turs
on all the paths. This can be done by simply moving the call to do_reset
to do_register and do_register_ignore.
Also, the patch adds a call to do_reset before doing a "status" action.
If a node has been fenced and then proceeds to check its status, it will
be in "unit attention" state.
Resolves: rhbz#640343
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 10dc26a..5156881 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -46,7 +46,6 @@ sub do_action_on ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- do_reset ($dev);
do_register_ignore ($node_key, $dev);
if (!get_reservation_key ($dev)) {
@@ -94,6 +93,8 @@ sub do_action_status ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
+ do_reset ($dev);
+
my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
@@ -129,6 +130,8 @@ sub do_register ($$$)
my $cmd;
my $out;
+ do_reset ($dev);
+
$cmd = "sg_persist -n -o -G -K $host_key -S $node_key -d $dev";
$cmd .= " -Z" if (defined $opt_a);
$out = qx { $cmd };
@@ -158,11 +161,13 @@ sub do_register_ignore ($$)
my $cmd;
my $out;
+ do_reset ($dev);
+
$cmd = "sg_persist -n -o -I -S $node_key -d $dev";
$cmd .= " -Z" if (defined $opt_a);
$out = qx { $cmd };
- die "[error]: $self\n" if ($?>>8);
+ die "[error]: $self ($dev)\n" if ($?>>8);
return;
}
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=33…
Commit: 337eecbdc58818617ae7124d1eeb0aeb002caf59
Parent: cecc4a5fd1e3f494d6f7cf2eeded1a5b77336336
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Wed Jan 19 14:18:54 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Fri Jan 21 12:39:30 2011 -0600
fence_scsi: always do sg_turs before registration
If a node has been fenced, or its key has been forcibly removed from
device(s) by another node, the victim will see "unit attention" from the
devices if/when it attempts to re-register. This error is normally
reported just once, but will cause registration to fail. We can safely
avoid this by calling sg_turs prior to each attempt to register with a
device.
Resolves: rhbz#640343
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 818e1d9..10dc26a 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -46,6 +46,7 @@ sub do_action_on ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
+ do_reset ($dev);
do_register_ignore ($node_key, $dev);
if (!get_reservation_key ($dev)) {
@@ -226,6 +227,23 @@ sub do_preempt_abort ($$$)
return;
}
+sub do_reset (S)
+{
+ my $self = (caller(0))[3];
+ my ($dev) = @_;
+
+ my $cmd = "sg_turs $dev";
+ my @out = qx { $cmd 2> /dev/null };
+ my $err = ($?>>8);
+
+ ## note that it is not necessarily an error is $err is non-zero,
+ ## so just log the device and status and continue.
+
+ log_debug ("$self (dev=$dev, status=$err)");
+
+ return;
+}
+
sub key_read ()
{
my $self = (caller(0))[3];
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=ce…
Commit: cecc4a5fd1e3f494d6f7cf2eeded1a5b77336336
Parent: 5710603c4af1d832f21a7583da5bd834606c4995
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Wed Jan 19 10:57:15 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Fri Jan 21 12:38:17 2011 -0600
fence_scsi: fix regular expression for grep
When fence_scsi checks to see if a specific keys is registered for a
specific device, it uses grep to look through a list of all registered
keys. The existing regular expression was not specific enough, and could
result in false positives. This patch fixes the problem by using anchors
to make the regular expression more specific.
Resolves: rhbz#670910
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(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 8ddde4e..818e1d9 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -71,7 +71,7 @@ sub do_action_off ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
do_preempt_abort ($host_key, $node_key, $dev);
@@ -93,7 +93,7 @@ sub do_action_status ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
- my @keys = grep { /$node_key/ } get_registration_keys ($dev);
+ my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
$dev_count++;