* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2006-06-14 16:37 teigland
0 siblings, 0 replies; 7+ messages in thread
From: teigland @ 2006-06-14 16:37 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-06-14 16:37:37
Modified files:
group/dlm_controld: action.c
Log message:
don't syslog non-errors
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
--- cluster/group/dlm_controld/action.c 2006/06/09 20:59:57 1.1
+++ cluster/group/dlm_controld/action.c 2006/06/14 16:37:37 1.2
@@ -115,7 +115,7 @@
d = opendir(path);
if (!d) {
- log_error("%s: opendir failed: %d", path, errno);
+ log_debug("%s: opendir failed: %d", path, errno);
return -1;
}
@@ -384,7 +384,7 @@
d = opendir(path);
if (!d) {
- log_error("%s: opendir failed: %d", path, errno);
+ log_debug("%s: opendir failed: %d", path, errno);
return -1;
}
@@ -461,7 +461,7 @@
d = opendir(path);
if (!d) {
- log_error("%s: opendir failed: %d", path, errno);
+ log_debug("%s: opendir failed: %d", path, errno);
return;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2006-06-14 20:03 teigland
0 siblings, 0 replies; 7+ messages in thread
From: teigland @ 2006-06-14 20:03 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-06-14 20:03:04
Modified files:
group/dlm_controld: action.c
Log message:
change log_error to log_debug for non-error
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- cluster/group/dlm_controld/action.c 2006/06/14 16:37:37 1.2
+++ cluster/group/dlm_controld/action.c 2006/06/14 20:03:04 1.3
@@ -128,7 +128,7 @@
if (de->d_name[0] == '.')
continue;
dir_members[i++] = atoi(de->d_name);
- log_error("dir_member %d", dir_members[i-1]);
+ log_debug("dir_member %d", dir_members[i-1]);
}
closedir(d);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2006-07-14 13:59 rpeterso
0 siblings, 0 replies; 7+ messages in thread
From: rpeterso @ 2006-07-14 13:59 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-07-14 13:59:01
Modified files:
group/dlm_controld: action.c
Log message:
A printf to stdout was getting redirected to the daemon's socket
causing the daemon to log strange errors and mount hangs.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.3&r2=1.4
--- cluster/group/dlm_controld/action.c 2006/06/14 20:03:04 1.3
+++ cluster/group/dlm_controld/action.c 2006/07/14 13:59:01 1.4
@@ -55,16 +55,16 @@
fd = open(fname, O_WRONLY);
if (fd < 0) {
- printf("open \"%s\" error %d %d\n", fname, fd, errno);
+ log_error("open \"%s\" error %d %d\n", fname, fd, errno);
return -1;
}
- printf("write \"%s\" to \"%s\"\n", val, fname);
+ log_debug("write \"%s\" to \"%s\"\n", val, fname);
len = strlen(val) + 1;
rv = write(fd, val, len);
if (rv != len) {
- printf("write %d error %d %d\n", len, rv, errno);
+ log_error("write %d error %d %d\n", len, rv, errno);
rv = -1;
} else
rv = 0;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2006-07-24 18:50 teigland
0 siblings, 0 replies; 7+ messages in thread
From: teigland @ 2006-07-24 18:50 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-24 18:50:01
Modified files:
group/dlm_controld: action.c
Log message:
remove duplicate \n from a couple log_debug/log_error
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
--- cluster/group/dlm_controld/action.c 2006/07/14 13:59:01 1.4
+++ cluster/group/dlm_controld/action.c 2006/07/24 18:50:01 1.5
@@ -55,16 +55,16 @@
fd = open(fname, O_WRONLY);
if (fd < 0) {
- log_error("open \"%s\" error %d %d\n", fname, fd, errno);
+ log_error("open \"%s\" error %d %d", fname, fd, errno);
return -1;
}
- log_debug("write \"%s\" to \"%s\"\n", val, fname);
+ log_debug("write \"%s\" to \"%s\"", val, fname);
len = strlen(val) + 1;
rv = write(fd, val, len);
if (rv != len) {
- log_error("write %d error %d %d\n", len, rv, errno);
+ log_error("write %d error %d %d", len, rv, errno);
rv = -1;
} else
rv = 0;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2007-06-05 20:12 rohara
0 siblings, 0 replies; 7+ messages in thread
From: rohara @ 2007-06-05 20:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rohara at sourceware.org 2007-06-05 20:12:43
Modified files:
group/dlm_controld: action.c
Log message:
New lockspace config for external dlm.
Changed get_weight to look for node weight in lockspace config.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.3&r2=1.8.2.4
--- cluster/group/dlm_controld/action.c 2007/05/04 21:14:32 1.8.2.3
+++ cluster/group/dlm_controld/action.c 2007/06/05 20:12:43 1.8.2.4
@@ -205,12 +205,16 @@
/* when not set in cluster.conf, a node's default weight is 1 */
+#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master"
#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight"
-static int get_weight(int cd, int nodeid)
+#define MASTER_NAME MASTER_PATH "/@name"
+#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight"
+
+static int get_weight(int cd, int nodeid, char *lockspace)
{
char path[PATH_MAX], *str, *name;
- int error, w;
+ int error, weight, flag = 0, count = 0;
name = nodeid2name(nodeid);
if (!name) {
@@ -219,15 +223,48 @@
}
memset(path, 0, PATH_MAX);
- sprintf(path, WEIGHT_PATH, name);
+ sprintf(path, MASTER_NAME, lockspace);
- error = ccs_get(cd, path, &str);
- if (error || !str)
- return 1;
+ while (1)
+ {
+ error = ccs_get_list(cd, path, &str);
+ if (error || !str) {
+ break;
+ }
+ count++;
+ if (strcmp(str, name) == 0) {
+ flag = 1;
+ }
+ free(str);
+ }
- w = atoi(str);
- free(str);
- return w;
+ if (count > 0) {
+ if (flag) {
+ memset(path, 0, PATH_MAX);
+ sprintf(path, MASTER_WEIGHT, lockspace, name);
+
+ error = ccs_get(cd, path, &str);
+ if (error || !str)
+ return 1;
+
+ weight = atoi(str);
+ free(str);
+ return weight;
+ } else {
+ return 0;
+ }
+ } else {
+ memset(path, 0, PATH_MAX);
+ sprintf(path, WEIGHT_PATH, name);
+
+ error = ccs_get(cd, path, &str);
+ if (error || !str)
+ return 1;
+
+ weight = atoi(str);
+ free(str);
+ return weight;
+ }
}
int set_members(char *name, int new_count, int *new_members)
@@ -346,7 +383,7 @@
if (!cd)
cd = open_ccs();
- w = get_weight(cd, id);
+ w = get_weight(cd, id, name);
memset(path, 0, PATH_MAX);
snprintf(path, PATH_MAX, "%s/%s/nodes/%d/weight",
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2007-06-06 21:10 teigland
0 siblings, 0 replies; 7+ messages in thread
From: teigland @ 2007-06-06 21:10 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-06-06 21:10:03
Modified files:
group/dlm_controld: action.c
Log message:
Split the new get_weight() function into two pieces so it's easier to
understand (still does exactly the same steps).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.4&r2=1.8.2.5
--- cluster/group/dlm_controld/action.c 2007/06/05 20:12:43 1.8.2.4
+++ cluster/group/dlm_controld/action.c 2007/06/06 21:10:03 1.8.2.5
@@ -211,60 +211,94 @@
#define MASTER_NAME MASTER_PATH "/@name"
#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight"
-static int get_weight(int cd, int nodeid, char *lockspace)
-{
- char path[PATH_MAX], *str, *name;
- int error, weight, flag = 0, count = 0;
+/* look for node's weight in the dlm/lockspace section */
- name = nodeid2name(nodeid);
- if (!name) {
- log_error("no name for nodeid %d", nodeid);
- return 1;
- }
+static int get_weight_lockspace(int cd, char *node, char *lockspace)
+{
+ char path[PATH_MAX], *str;
+ int error, weight;
+ int master_count = 0, node_is_master = 0;
memset(path, 0, PATH_MAX);
sprintf(path, MASTER_NAME, lockspace);
- while (1)
- {
+ while (1) {
error = ccs_get_list(cd, path, &str);
- if (error || !str) {
+ if (error || !str)
break;
- }
- count++;
- if (strcmp(str, name) == 0) {
- flag = 1;
- }
+ master_count++;
+ if (strcmp(str, node) == 0)
+ node_is_master = 1;
free(str);
}
- if (count > 0) {
- if (flag) {
- memset(path, 0, PATH_MAX);
- sprintf(path, MASTER_WEIGHT, lockspace, name);
-
- error = ccs_get(cd, path, &str);
- if (error || !str)
- return 1;
-
- weight = atoi(str);
- free(str);
- return weight;
- } else {
- return 0;
- }
- } else {
- memset(path, 0, PATH_MAX);
- sprintf(path, WEIGHT_PATH, name);
+ /* if there are no masters, next check for a clusternode weight */
- error = ccs_get(cd, path, &str);
- if (error || !str)
- return 1;
+ if (!master_count)
+ return -1;
- weight = atoi(str);
- free(str);
- return weight;
+ /* if there's a master and this node isn't it, it gets weight 0 */
+
+ if (!node_is_master)
+ return 0;
+
+ /* master gets its specified weight or 1 if none is given */
+
+ memset(path, 0, PATH_MAX);
+ sprintf(path, MASTER_WEIGHT, lockspace, node);
+
+ error = ccs_get(cd, path, &str);
+ if (error || !str)
+ return 1;
+
+ weight = atoi(str);
+ free(str);
+ return weight;
+}
+
+/* look for node's weight on its clusternode line */
+
+static int get_weight_clusternode(int cd, char *node, char *lockspace)
+{
+ char path[PATH_MAX], *str;
+ int error, weight;
+
+ memset(path, 0, PATH_MAX);
+ sprintf(path, WEIGHT_PATH, node);
+
+ error = ccs_get(cd, path, &str);
+ if (error || !str)
+ return -1;
+
+ weight = atoi(str);
+ free(str);
+ return weight;
+}
+
+static int get_weight(int cd, int nodeid, char *lockspace)
+{
+ char *node;
+ int w;
+
+ node = nodeid2name(nodeid);
+ if (!node) {
+ log_error("no name for nodeid %d", nodeid);
+ w = 1;
+ goto out;
}
+
+ w = get_weight_lockspace(cd, node, lockspace);
+ if (w >= 0)
+ goto out;
+
+ w = get_weight_clusternode(cd, node, lockspace);
+ if (w >= 0)
+ goto out;
+
+ /* default weight is 1 */
+ w = 1;
+ out:
+ return w;
}
int set_members(char *name, int new_count, int *new_members)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cluster-devel] cluster/group/dlm_controld action.c
@ 2007-06-06 21:12 teigland
0 siblings, 0 replies; 7+ messages in thread
From: teigland @ 2007-06-06 21:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2007-06-06 21:12:39
Modified files:
group/dlm_controld: action.c
Log message:
(copy from RHEL5 branch)
New lockspace config for external dlm.
Changed get_weight to look for node weight in lockspace config.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
--- cluster/group/dlm_controld/action.c 2007/05/04 21:05:28 1.11
+++ cluster/group/dlm_controld/action.c 2007/06/06 21:12:39 1.12
@@ -205,28 +205,99 @@
/* when not set in cluster.conf, a node's default weight is 1 */
+#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master"
#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight"
-static int get_weight(int cd, int nodeid)
+#define MASTER_NAME MASTER_PATH "/@name"
+#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight"
+
+/* look for node's weight in the dlm/lockspace section */
+
+static int get_weight_lockspace(int cd, char *node, char *lockspace)
{
- char path[PATH_MAX], *str, *name;
- int error, w;
+ char path[PATH_MAX], *str;
+ int error, weight;
+ int master_count = 0, node_is_master = 0;
- name = nodeid2name(nodeid);
- if (!name) {
- log_error("no name for nodeid %d", nodeid);
- return 1;
+ memset(path, 0, PATH_MAX);
+ sprintf(path, MASTER_NAME, lockspace);
+
+ while (1) {
+ error = ccs_get_list(cd, path, &str);
+ if (error || !str)
+ break;
+ master_count++;
+ if (strcmp(str, node) == 0)
+ node_is_master = 1;
+ free(str);
}
+ /* if there are no masters, next check for a clusternode weight */
+
+ if (!master_count)
+ return -1;
+
+ /* if there's a master and this node isn't it, it gets weight 0 */
+
+ if (!node_is_master)
+ return 0;
+
+ /* master gets its specified weight or 1 if none is given */
+
memset(path, 0, PATH_MAX);
- sprintf(path, WEIGHT_PATH, name);
+ sprintf(path, MASTER_WEIGHT, lockspace, node);
error = ccs_get(cd, path, &str);
if (error || !str)
return 1;
- w = atoi(str);
+ weight = atoi(str);
free(str);
+ return weight;
+}
+
+/* look for node's weight on its clusternode line */
+
+static int get_weight_clusternode(int cd, char *node, char *lockspace)
+{
+ char path[PATH_MAX], *str;
+ int error, weight;
+
+ memset(path, 0, PATH_MAX);
+ sprintf(path, WEIGHT_PATH, node);
+
+ error = ccs_get(cd, path, &str);
+ if (error || !str)
+ return -1;
+
+ weight = atoi(str);
+ free(str);
+ return weight;
+}
+
+static int get_weight(int cd, int nodeid, char *lockspace)
+{
+ char *node;
+ int w;
+
+ node = nodeid2name(nodeid);
+ if (!node) {
+ log_error("no name for nodeid %d", nodeid);
+ w = 1;
+ goto out;
+ }
+
+ w = get_weight_lockspace(cd, node, lockspace);
+ if (w >= 0)
+ goto out;
+
+ w = get_weight_clusternode(cd, node, lockspace);
+ if (w >= 0)
+ goto out;
+
+ /* default weight is 1 */
+ w = 1;
+ out:
return w;
}
@@ -346,7 +417,7 @@
if (!cd)
cd = open_ccs();
- w = get_weight(cd, id);
+ w = get_weight(cd, id, name);
memset(path, 0, PATH_MAX);
snprintf(path, PATH_MAX, "%s/%s/nodes/%d/weight",
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-06-06 21:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06 21:10 [Cluster-devel] cluster/group/dlm_controld action.c teigland
-- strict thread matches above, loose matches on Subject: below --
2007-06-06 21:12 teigland
2007-06-05 20:12 rohara
2006-07-24 18:50 teigland
2006-07-14 13:59 rpeterso
2006-06-14 20:03 teigland
2006-06-14 16:37 teigland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.