cluster: RHEL6 - resource-agents: Add option disable_rdisc to ip.sh
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 9e0190a646d7ab7236969d77d5621c19d5566366
Parent: a9dd0bb396423ac45120f01bfbe62225eb3d5cd7
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Jan 28 15:29:48 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Jan 28 15:36:24 2011 +0100
resource-agents: Add option disable_rdisc to ip.sh
rdisc is called by ip.sh which causes static routes to be updated by
dynamic ones. This option adds possibility to disable this feature.
Resolves: rhbz#621538
---
rgmanager/src/resources/ip.sh | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
old mode 100644
new mode 100755
index 714da05..f9256e7
--- a/rgmanager/src/resources/ip.sh
+++ b/rgmanager/src/resources/ip.sh
@@ -101,6 +101,17 @@ meta_data()
<content type="string"/>
</parameter>
+ <parameter name="disable_rdisc">
+ <longdesc lang="en">
+ Disable updating of routing using RDISC protocol and
+ preserve static routes.
+ </longdesc>
+ <shortdesc lang="en">
+ Disable updating of routing using RDISC protocol
+ </shortdesc>
+ <content type="boolean"/>
+ </parameter>
+
</parameters>
<actions>
@@ -611,7 +622,10 @@ ipv6()
# Not sure if this is necessary for ipv6 either.
file=$(which rdisc 2>/dev/null)
if [ -f "$file" ]; then
- killall -HUP rdisc || rdisc -fs
+ if [ "$OCF_RESKEY_disable_rdisc" != "yes" ] && \
+ [ "$OCF_RESKEY_disable_rdisc" != "1" ]; then
+ killall -HUP rdisc || rdisc -fs
+ fi
fi
return 0
@@ -690,7 +704,10 @@ ipv4()
file=$(which rdisc 2>/dev/null)
if [ -f "$file" ]; then
- killall -HUP rdisc || rdisc -fs
+ if [ "$OCF_RESKEY_disable_rdisc" != "yes" ] && \
+ [ "$OCF_RESKEY_disable_rdisc" != "1" ]; then
+ killall -HUP rdisc || rdisc -fs
+ fi
fi
return 0
13 years, 3 months
resource-agents: master - resource-agents: Add option disable_rdisc to ip.sh
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git...
Commit: 488c4ff3a1c3ed1734a00f86d8b639f06e146a11
Parent: 394c23c8f9e1e0fb934ba994e2e5a786467d6bec
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Jan 28 15:29:48 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Jan 28 15:29:48 2011 +0100
resource-agents: Add option disable_rdisc to ip.sh
rdisc is called by ip.sh which causes static routes to be updated by
dynamic ones. This option adds possibility to disable this feature.
Resolves: rhbz#621538
---
rgmanager/src/resources/ip.sh | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
old mode 100644
new mode 100755
index 714da05..f9256e7
--- a/rgmanager/src/resources/ip.sh
+++ b/rgmanager/src/resources/ip.sh
@@ -101,6 +101,17 @@ meta_data()
<content type="string"/>
</parameter>
+ <parameter name="disable_rdisc">
+ <longdesc lang="en">
+ Disable updating of routing using RDISC protocol and
+ preserve static routes.
+ </longdesc>
+ <shortdesc lang="en">
+ Disable updating of routing using RDISC protocol
+ </shortdesc>
+ <content type="boolean"/>
+ </parameter>
+
</parameters>
<actions>
@@ -611,7 +622,10 @@ ipv6()
# Not sure if this is necessary for ipv6 either.
file=$(which rdisc 2>/dev/null)
if [ -f "$file" ]; then
- killall -HUP rdisc || rdisc -fs
+ if [ "$OCF_RESKEY_disable_rdisc" != "yes" ] && \
+ [ "$OCF_RESKEY_disable_rdisc" != "1" ]; then
+ killall -HUP rdisc || rdisc -fs
+ fi
fi
return 0
@@ -690,7 +704,10 @@ ipv4()
file=$(which rdisc 2>/dev/null)
if [ -f "$file" ]; then
- killall -HUP rdisc || rdisc -fs
+ if [ "$OCF_RESKEY_disable_rdisc" != "yes" ] && \
+ [ "$OCF_RESKEY_disable_rdisc" != "1" ]; then
+ killall -HUP rdisc || rdisc -fs
+ fi
fi
return 0
13 years, 3 months
cluster: STABLE31 - rgmanager: Fix clustat help & version operations
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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)
13 years, 3 months
cluster: STABLE31 - rgmanager: Fix nofailback when service is in 'starting' state
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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;
13 years, 3 months
cluster: RHEL57 - enable gfs2_grow on completely full filesystems
by Benjamin Marzinski
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3575517393317423b10a9717fc5157261993625d
Parent: 98ea28be22109e64107db447a829e0b8a42863b2
Author: Benjamin Marzinski <bmarzins(a)redhat.com>
AuthorDate: Tue Jan 25 13:39:03 2011 -0600
Committer: Benjamin Marzinski <bmarzins(a)redhat.com>
CommitterDate: Tue Jan 25 13:39:03 2011 -0600
enable gfs2_grow on completely full filesystems
The rindex file needs some pre-allocated space so that when gfs2_grow tries
to grow the filesystem, there will always be room for at least one more
rindex entry. mkfs.gfs2 and gfs2_grow now both pre-allocate space in the
rindex file.
---
gfs2/libgfs2/fs_ops.c | 6 +++---
gfs2/libgfs2/libgfs2.h | 6 ++++--
gfs2/libgfs2/structures.c | 7 ++++++-
gfs2/mkfs/main_grow.c | 35 +++++++++++++++++++++++++++++++++--
4 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 2b1fa46..e2b4f54 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -575,8 +575,8 @@ static void copy_from_mem(struct gfs2_buffer_head *bh, void **buf,
*p += size;
}
-int gfs2_writei(struct gfs2_inode *ip, void *buf,
- uint64_t offset, unsigned int size)
+int __gfs2_writei(struct gfs2_inode *ip, void *buf,
+ uint64_t offset, unsigned int size, int resize)
{
struct gfs2_sbd *sdp = ip->i_sbd;
struct gfs2_buffer_head *bh;
@@ -647,7 +647,7 @@ int gfs2_writei(struct gfs2_inode *ip, void *buf,
o = (isdir) ? sizeof(struct gfs2_meta_header) : 0;
}
- if (ip->i_di.di_size < start + copied) {
+ if (resize && ip->i_di.di_size < start + copied) {
bmodified(ip->i_bh);
ip->i_di.di_size = start + copied;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index cd2042a..3e1b11d 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -443,8 +443,10 @@ extern uint64_t meta_alloc(struct gfs2_inode *ip);
extern uint64_t dinode_alloc(struct gfs2_sbd *sdp);
extern int gfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
unsigned int size);
-extern int gfs2_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
- unsigned int size);
+#define gfs2_writei(ip, buf, offset, size) \
+ __gfs2_writei(ip, buf, offset, size, 1)
+extern int __gfs2_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+ unsigned int size, int resize);
extern struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip,
uint64_t lbn, int prealloc);
extern struct gfs2_buffer_head *init_dinode(struct gfs2_sbd *sdp,
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index bb72e30..2a09214 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -337,10 +337,15 @@ int build_rindex(struct gfs2_sbd *sdp)
gfs2_rindex_out(&rl->ri, buf);
count = gfs2_writei(ip, buf, ip->i_di.di_size,
- sizeof(struct gfs2_rindex));
+ sizeof(struct gfs2_rindex));
if (count != sizeof(struct gfs2_rindex))
return -1;
}
+ memset(buf, 0, sizeof(struct gfs2_rindex));
+ count = __gfs2_writei(ip, buf, ip->i_di.di_size,
+ sizeof(struct gfs2_rindex), 0);
+ if (count != sizeof(struct gfs2_rindex))
+ return -1;
if (sdp->debug) {
printf("\nResource Index:\n");
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 75b6715..f194443 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -9,7 +9,6 @@
**
*******************************************************************************
******************************************************************************/
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -29,6 +28,7 @@
#include <stdarg.h>
#include <linux/types.h>
#include <libintl.h>
+#include <sys/syscall.h>
#define _(String) gettext(String)
#include "libgfs2.h"
@@ -196,6 +196,7 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
char *buf, *bufptr;
osi_list_t *tmp;
ssize_t writelen;
+ struct stat statbuf;
/* Count the number of new RGs. */
rg = 0;
@@ -219,14 +220,44 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
gfs2_rgrp_free(&sdp->rglist);
fsync(sdp->device_fd);
if (!test) {
+ if (fstat(rindex_fd, &statbuf) != 0) {
+ log_crit("Can't stat rindex : %s\n", strerror(errno));
+ goto out;
+ }
+ if (statbuf.st_size !=
+ old_rg_count * sizeof(struct gfs2_rindex)) {
+ log_crit("Incorrect rindex size. want %ld(%d RGs), "
+ "have %ld\n",
+ old_rg_count * sizeof(struct gfs2_rindex),
+ old_rg_count, statbuf.st_size);
+ goto out;
+ }
/* Now write the new RGs to the end of the rindex */
lseek(rindex_fd, 0, SEEK_END);
count = write(rindex_fd, buf, writelen);
- if (count != writelen)
+ if (count != writelen) {
log_crit( _("Error writing new rindex entries;"
"aborted.\n"));
+ if (count > 0)
+ goto trunc;
+ else
+ goto out;
+ }
+ if (syscall(__NR_fallocate, rindex_fd, 1,
+ statbuf.st_size + writelen,
+ sizeof(struct gfs2_rindex)) != 0)
+ log_crit("Error fallocating extra space : %s\n",
+ strerror(errno));
fsync(rindex_fd);
}
+out:
+ free(buf);
+ return;
+trunc:
+ count = (count / sizeof(struct gfs2_rindex)) + old_rg_count;
+ log_crit("truncating rindex to %ld\n",
+ (off_t)count * sizeof(struct gfs2_rindex));
+ ftruncate(rindex_fd, (off_t)count * sizeof(struct gfs2_rindex));
free(buf);
}
13 years, 3 months
resource-agents: master - resource-agents: Improve LD_LIBRARY_PATH handling by SAP*
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git...
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"
13 years, 3 months
cluster: RHEL6 - fence_scsi: verify that on/off actions succeed
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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);
13 years, 3 months
cluster: RHEL6 - fence_scsi: always do sg_turs for dm-mp devices
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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;
}
13 years, 3 months
cluster: RHEL6 - fence_scsi: always do sg_turs before registration
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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];
13 years, 3 months
cluster: RHEL6 - fence_scsi: fix regular expression for grep
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
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++;
13 years, 3 months