* [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c
@ 2007-10-26 18:05 rmccabe
0 siblings, 0 replies; 5+ messages in thread
From: rmccabe @ 2007-10-26 18:05 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-10-26 18:05:43
Modified files:
fence/fenced : agent.c fd.h recover.c
Log message:
Applying patch from Marco Ceci to fix 354421
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.1&r2=1.15.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.24.2.2&r2=1.24.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.4&r2=1.25.2.5
--- cluster/fence/fenced/agent.c 2006/12/01 19:17:46 1.15.2.1
+++ cluster/fence/fenced/agent.c 2007/10/26 18:05:42 1.15.2.2
@@ -302,18 +302,45 @@
cman_finish(ch);
}
-int dispatch_fence_agent(int cd, char *victim)
+int dispatch_fence_agent(char *victim, int force)
{
char *method = NULL, *device = NULL;
- int num_methods, num_devices, m, d, error = -1;
+ int num_methods, num_devices, m, d, error = -1, cd;
+
+ if (force)
+ cd = ccs_force_connect(NULL, 0);
+ else {
+ while ((cd = ccs_connect()) < 0)
+ sleep(1);
+ }
+
+ if (cd < 0) {
+ syslog(LOG_ERR, "cannot connect to ccs %d\n", cd);
+ return -1;
+ }
num_methods = count_methods(cd, victim);
for (m = 0; m < num_methods; m++) {
error = get_method(cd, victim, m, &method);
+
+ /* if the connection timed out while we were trying
+ * to fence, try to open the connection again
+ */
+ if (error == -EBADR) {
+ syslog(LOG_INFO, "ccs connection timed out, "
+ "retrying\n");
+
+ while ((cd = ccs_connect()) < 0)
+ sleep(1);
+
+ error = get_method(cd, victim, m, &method);
+
if (error)
continue;
+ } else if (error)
+ continue;
/* if num_devices is zero we should return an error */
error = -1;
@@ -342,6 +369,8 @@
break;
}
+ ccs_disconnect(cd);
+
return error;
}
--- cluster/fence/fenced/fd.h 2007/01/29 20:30:25 1.24.2.2
+++ cluster/fence/fenced/fd.h 2007/10/26 18:05:42 1.24.2.3
@@ -176,7 +176,7 @@
void do_recovery_done(fd_t *fd);
/* agent.c */
-int dispatch_fence_agent(int cd, char *victim);
+int dispatch_fence_agent(char *victim, int force);
/* group.c */
int setup_groupd(void);
--- cluster/fence/fenced/recover.c 2007/09/18 20:53:17 1.25.2.4
+++ cluster/fence/fenced/recover.c 2007/10/26 18:05:42 1.25.2.5
@@ -12,7 +12,6 @@
******************************************************************************/
#include "fd.h"
-#include "ccs.h"
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
@@ -359,7 +358,7 @@
{
fd_node_t *node;
char *master_name;
- int master, error, cd;
+ int master, error;
int override = -1;
master = find_master_nodeid(fd, &master_name);
@@ -372,9 +371,6 @@
delay_fencing(fd, start_type);
- while ((cd = ccs_connect()) < 0)
- sleep(1);
-
while (!list_empty(&fd->victims)) {
node = list_entry(fd->victims.next, fd_node_t, list);
@@ -388,7 +384,7 @@
log_debug("fencing node %s", node->name);
syslog(LOG_INFO, "fencing node \"%s\"", node->name);
- error = dispatch_fence_agent(cd, node->name);
+ error = dispatch_fence_agent(node->name, 0);
syslog(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
@@ -415,8 +411,6 @@
}
close_override(&override, comline.override_path);
}
-
- ccs_disconnect(cd);
}
static void add_victims(fd_t *fd, int start_type, int member_count,
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c
@ 2007-10-26 20:36 rmccabe
0 siblings, 0 replies; 5+ messages in thread
From: rmccabe @ 2007-10-26 20:36 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rmccabe at sourceware.org 2007-10-26 20:36:49
Modified files:
fence/fenced : agent.c fd.h recover.c
Log message:
patch from Marco Ceci to fix 354421
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
--- cluster/fence/fenced/agent.c 2007/10/26 18:46:16 1.18
+++ cluster/fence/fenced/agent.c 2007/10/26 20:36:49 1.19
@@ -302,11 +302,23 @@
cman_finish(ch);
}
-int dispatch_fence_agent(int cd, char *victim)
+int dispatch_fence_agent(char *victim, int force)
{
char *method = NULL, *device = NULL;
char *victim_nodename = NULL;
- int num_methods, num_devices, m, d, error = -1;
+ int num_methods, num_devices, m, d, error = -1, cd;
+
+ if (force)
+ cd = ccs_force_connect(NULL, 0);
+ else {
+ while ((cd = ccs_connect()) < 0)
+ sleep(1);
+ }
+
+ if (cd < 0) {
+ syslog(LOG_ERR, "cannot connect to ccs %d\n", cd);
+ return -1;
+ }
if (ccs_lookup_nodename(cd, victim, &victim_nodename) == 0)
victim = victim_nodename;
@@ -316,8 +328,23 @@
for (m = 0; m < num_methods; m++) {
error = get_method(cd, victim, m, &method);
+
+ /* if the connection timed out while we were trying
+ * to fence, try to open the connection again
+ */
+ if (error == -EBADR) {
+ syslog(LOG_INFO, "ccs connection timed out, "
+ "retrying\n");
+
+ while ((cd = ccs_connect()) < 0)
+ sleep(1);
+
+ error = get_method(cd, victim, m, &method);
+
if (error)
continue;
+ } else if (error)
+ continue;
/* if num_devices is zero we should return an error */
error = -1;
@@ -348,6 +375,8 @@
break;
}
+ ccs_disconnect(cd);
+
return error;
}
--- cluster/fence/fenced/fd.h 2007/02/22 16:12:42 1.26
+++ cluster/fence/fenced/fd.h 2007/10/26 20:36:49 1.27
@@ -2,7 +2,7 @@
*******************************************************************************
**
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
-** Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
@@ -176,7 +176,7 @@
void do_recovery_done(fd_t *fd);
/* agent.c */
-int dispatch_fence_agent(int cd, char *victim);
+int dispatch_fence_agent(char *victim, int force);
/* group.c */
int setup_groupd(void);
--- cluster/fence/fenced/recover.c 2007/09/18 20:53:47 1.29
+++ cluster/fence/fenced/recover.c 2007/10/26 20:36:49 1.30
@@ -2,7 +2,7 @@
*******************************************************************************
**
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
-** Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
@@ -12,7 +12,6 @@
******************************************************************************/
#include "fd.h"
-#include "ccs.h"
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
@@ -359,7 +358,7 @@
{
fd_node_t *node;
char *master_name;
- int master, error, cd;
+ int master, error;
int override = -1;
master = find_master_nodeid(fd, &master_name);
@@ -372,9 +371,6 @@
delay_fencing(fd, start_type);
- while ((cd = ccs_connect()) < 0)
- sleep(1);
-
while (!list_empty(&fd->victims)) {
node = list_entry(fd->victims.next, fd_node_t, list);
@@ -388,7 +384,7 @@
log_debug("fencing node %s", node->name);
syslog(LOG_INFO, "fencing node \"%s\"", node->name);
- error = dispatch_fence_agent(cd, node->name);
+ error = dispatch_fence_agent(node->name, 0);
syslog(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
@@ -415,8 +411,6 @@
}
close_override(&override, comline.override_path);
}
-
- ccs_disconnect(cd);
}
static void add_victims(fd_t *fd, int start_type, int member_count,
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c
@ 2006-12-01 19:57 rohara
0 siblings, 0 replies; 5+ messages in thread
From: rohara @ 2006-12-01 19:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rohara at sourceware.org 2006-12-01 19:57:25
Modified files:
fence/fenced : agent.c fd.h recover.c
Log message:
Remove option for passing "self" parameter.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.15&r2=1.15.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.24&r2=1.24.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.25&r2=1.25.4.1
--- cluster/fence/fenced/agent.c 2006/07/10 17:02:43 1.15
+++ cluster/fence/fenced/agent.c 2006/12/01 19:57:24 1.15.4.1
@@ -129,7 +129,7 @@
return -1;
}
-static int make_args(int cd, char *victim, char *self, char *method, int d,
+static int make_args(int cd, char *victim, char *method, int d,
char *device, char **args_out)
{
char path[256], *args, *str;
@@ -180,13 +180,6 @@
free(str);
}
- if (self != NULL) {
- memset(path, 0, 256);
- sprintf(path, "self=%s", self);
- strcat(args, path);
- strcat(args, "\n");
- }
-
if (error) {
free(args);
args = NULL;
@@ -260,7 +253,7 @@
return i;
}
-static int use_device(int cd, char *victim, char *self,char *method, int d,
+static int use_device(int cd, char *victim, char *method, int d,
char *device)
{
char path[256], *agent, *args = NULL;
@@ -273,7 +266,7 @@
if (error)
goto out;
- error = make_args(cd, victim, self, method, d, device, &args);
+ error = make_args(cd, victim, method, d, device, &args);
if (error)
goto out_agent;
@@ -309,7 +302,7 @@
cman_finish(ch);
}
-int dispatch_fence_agent(int cd, char *victim, char *self)
+int dispatch_fence_agent(int cd, char *victim)
{
char *method = NULL, *device = NULL;
int num_methods, num_devices, m, d, error = -1;
@@ -332,7 +325,7 @@
if (error)
break;
- error = use_device(cd, victim, self, method, d, device);
+ error = use_device(cd, victim, method, d, device);
if (error)
break;
--- cluster/fence/fenced/fd.h 2006/10/09 10:52:50 1.24
+++ cluster/fence/fenced/fd.h 2006/12/01 19:57:24 1.24.4.1
@@ -173,7 +173,7 @@
void do_recovery_done(fd_t *fd);
/* agent.c */
-int dispatch_fence_agent(int cd, char *victim, char *self);
+int dispatch_fence_agent(int cd, char *victim);
/* group.c */
int setup_groupd(void);
--- cluster/fence/fenced/recover.c 2006/10/09 10:52:50 1.25
+++ cluster/fence/fenced/recover.c 2006/12/01 19:57:24 1.25.4.1
@@ -16,7 +16,6 @@
extern int our_nodeid;
extern commandline_t comline;
-extern char *our_name;
/* Fencing recovery algorithm
@@ -310,7 +309,7 @@
log_debug("fencing node %s", node->name);
syslog(LOG_INFO, "fencing node \"%s\"", node->name);
- error = dispatch_fence_agent(cd, node->name, our_name);
+ error = dispatch_fence_agent(cd, node->name);
syslog(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c
@ 2006-12-01 19:17 rohara
0 siblings, 0 replies; 5+ messages in thread
From: rohara @ 2006-12-01 19:17 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rohara at sourceware.org 2006-12-01 19:17:46
Modified files:
fence/fenced : agent.c fd.h recover.c
Log message:
Remove option to pass "self" parameter.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15&r2=1.15.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.24&r2=1.24.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25&r2=1.25.2.1
--- cluster/fence/fenced/agent.c 2006/07/10 17:02:43 1.15
+++ cluster/fence/fenced/agent.c 2006/12/01 19:17:46 1.15.2.1
@@ -129,7 +129,7 @@
return -1;
}
-static int make_args(int cd, char *victim, char *self, char *method, int d,
+static int make_args(int cd, char *victim, char *method, int d,
char *device, char **args_out)
{
char path[256], *args, *str;
@@ -180,13 +180,6 @@
free(str);
}
- if (self != NULL) {
- memset(path, 0, 256);
- sprintf(path, "self=%s", self);
- strcat(args, path);
- strcat(args, "\n");
- }
-
if (error) {
free(args);
args = NULL;
@@ -260,7 +253,7 @@
return i;
}
-static int use_device(int cd, char *victim, char *self,char *method, int d,
+static int use_device(int cd, char *victim, char *method, int d,
char *device)
{
char path[256], *agent, *args = NULL;
@@ -273,7 +266,7 @@
if (error)
goto out;
- error = make_args(cd, victim, self, method, d, device, &args);
+ error = make_args(cd, victim, method, d, device, &args);
if (error)
goto out_agent;
@@ -309,7 +302,7 @@
cman_finish(ch);
}
-int dispatch_fence_agent(int cd, char *victim, char *self)
+int dispatch_fence_agent(int cd, char *victim)
{
char *method = NULL, *device = NULL;
int num_methods, num_devices, m, d, error = -1;
@@ -332,7 +325,7 @@
if (error)
break;
- error = use_device(cd, victim, self, method, d, device);
+ error = use_device(cd, victim, method, d, device);
if (error)
break;
--- cluster/fence/fenced/fd.h 2006/10/09 10:52:50 1.24
+++ cluster/fence/fenced/fd.h 2006/12/01 19:17:46 1.24.2.1
@@ -173,7 +173,7 @@
void do_recovery_done(fd_t *fd);
/* agent.c */
-int dispatch_fence_agent(int cd, char *victim, char *self);
+int dispatch_fence_agent(int cd, char *victim);
/* group.c */
int setup_groupd(void);
--- cluster/fence/fenced/recover.c 2006/10/09 10:52:50 1.25
+++ cluster/fence/fenced/recover.c 2006/12/01 19:17:46 1.25.2.1
@@ -16,7 +16,6 @@
extern int our_nodeid;
extern commandline_t comline;
-extern char *our_name;
/* Fencing recovery algorithm
@@ -310,7 +309,7 @@
log_debug("fencing node %s", node->name);
syslog(LOG_INFO, "fencing node \"%s\"", node->name);
- error = dispatch_fence_agent(cd, node->name, our_name);
+ error = dispatch_fence_agent(cd, node->name);
syslog(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c
@ 2006-07-10 17:02 rohara
0 siblings, 0 replies; 5+ messages in thread
From: rohara @ 2006-07-10 17:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rohara at sourceware.org 2006-07-10 17:02:43
Modified files:
fence/fenced : agent.c fd.h recover.c
Log message:
Added "self" parameter as a way to pass our_name to the agent.
This is needed for SCSI persistent reservation (fence_scsi).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/agent.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/fd.h.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
--- cluster/fence/fenced/agent.c 2006/05/09 19:47:40 1.14
+++ cluster/fence/fenced/agent.c 2006/07/10 17:02:43 1.15
@@ -129,8 +129,9 @@
return -1;
}
-static int make_args(int cd, char *victim, char *method, int d, char *device,
- char **args_out) {
+static int make_args(int cd, char *victim, char *self, char *method, int d,
+ char *device, char **args_out)
+{
char path[256], *args, *str;
int error;
@@ -179,6 +180,13 @@
free(str);
}
+ if (self != NULL) {
+ memset(path, 0, 256);
+ sprintf(path, "self=%s", self);
+ strcat(args, path);
+ strcat(args, "\n");
+ }
+
if (error) {
free(args);
args = NULL;
@@ -252,7 +260,8 @@
return i;
}
-static int use_device(int cd, char *victim, char *method, int d, char *device)
+static int use_device(int cd, char *victim, char *self,char *method, int d,
+ char *device)
{
char path[256], *agent, *args = NULL;
int error;
@@ -264,7 +273,7 @@
if (error)
goto out;
- error = make_args(cd, victim, method, d, device, &args);
+ error = make_args(cd, victim, self, method, d, device, &args);
if (error)
goto out_agent;
@@ -300,7 +309,7 @@
cman_finish(ch);
}
-int dispatch_fence_agent(int cd, char *victim)
+int dispatch_fence_agent(int cd, char *victim, char *self)
{
char *method = NULL, *device = NULL;
int num_methods, num_devices, m, d, error = -1;
@@ -323,7 +332,7 @@
if (error)
break;
- error = use_device(cd, victim, method, d, device);
+ error = use_device(cd, victim, self, method, d, device);
if (error)
break;
--- cluster/fence/fenced/fd.h 2006/06/20 18:11:58 1.21
+++ cluster/fence/fenced/fd.h 2006/07/10 17:02:43 1.22
@@ -173,7 +173,7 @@
void do_recovery_done(fd_t *fd);
/* agent.c */
-int dispatch_fence_agent(int cd, char *victim);
+int dispatch_fence_agent(int cd, char *victim, char *self);
/* group.c */
int setup_groupd(void);
--- cluster/fence/fenced/recover.c 2006/06/20 18:11:58 1.23
+++ cluster/fence/fenced/recover.c 2006/07/10 17:02:43 1.24
@@ -16,6 +16,7 @@
extern int our_nodeid;
extern commandline_t comline;
+extern char *our_name;
/* Fencing recovery algorithm
@@ -309,7 +310,7 @@
log_debug("fencing node %s", node->name);
syslog(LOG_INFO, "fencing node \"%s\"", node->name);
- error = dispatch_fence_agent(cd, node->name);
+ error = dispatch_fence_agent(cd, node->name, our_name);
syslog(LOG_INFO, "fence \"%s\" %s", node->name,
error ? "failed" : "success");
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-26 20:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 18:05 [Cluster-devel] cluster/fence/fenced agent.c fd.h recover.c rmccabe
-- strict thread matches above, loose matches on Subject: below --
2007-10-26 20:36 rmccabe
2006-12-01 19:57 rohara
2006-12-01 19:17 rohara
2006-07-10 17:02 rohara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).