gfs2-utils: master - gfs2 manual pages: gfs2_convert manpage and documentation updates
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 3b88306556547f881df33a99858ef3d26d616b43
Parent: d5f06e0fff177883304727e8c64f942d2f962249
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Fri Jun 25 16:29:47 2010 -0500
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Fri Jun 25 16:38:27 2010 -0500
gfs2 manual pages: gfs2_convert manpage and documentation updates
The recent fixes/updates to gfs2_convert change its behavior
in a few cases such as handling of CDPNs, converting full
filesystems etc. This updates the manpage to reflect that.
Resolves: rhbz#601315
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
gfs2/man/gfs2_convert.8 | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/gfs2/man/gfs2_convert.8 b/gfs2/man/gfs2_convert.8
index a05a690..5969432 100644
--- a/gfs2/man/gfs2_convert.8
+++ b/gfs2/man/gfs2_convert.8
@@ -8,21 +8,13 @@ gfs2_convert - Convert a GFS1 filesystem to GFS2
[\fIOPTION\fR]... \fIDEVICE\fR
.SH DESCRIPTION
-gfs2_convert is used to convert a filesystem from GFS1 to GFS2. Do not
-attempt to convert a GFS1 filesystem which is not clean - the process
-of conversion will reinitialise the journals. We highly recommend that
-.B fsck.gfs
-is run successfully before attempting to convert a filesystem. Many
-of the on-disk structures are identical between GFS1 and GFS2, so
-the conversion process updates the journals, a few items of incompatible
-metadata (mostly indirect pointers and inodes) and adds the per-node
-directories required by the gfs2meta filesystem. The conversion process
-is performed in-place and does not require any extra disk space so that
-it is possible to successfully convert a GFS1 filesystem that is
-completely full.
-
-Always ensure you have a complete backup of the data on any filesystem
-before starting the conversion process.
+gfs2_convert is used to convert a filesystem from GFS1 to GFS2. It is
+required that the GFS1 filesystem be checked and fixed for errors using
+\fBgfs_fsck\fP and that the filesystem be backed up before
+attempting to convert it. The convert process is irreversible and any
+error encountered during the conversion can result in the abrupt
+termination of the program and consequently an unusable filesystem.
+See \fBNOTES\fP section below for more information.
.SH OPTIONS
.TP
@@ -58,3 +50,19 @@ changes.
gfs2_convert /dev/vg0/lvol0
This will convert the Global File System on the block device
"/dev/vg0/lvol0" to gfs2 format.
+
+.SH NOTES
+If gfs2_convert is interrupted for some reason other than a conversion
+failure, DO NOT run \fBgfs2_fsck\fP on this partially converted filesystem.
+When this occurs, reissue the gfs2_convert command on the partially converted
+filesystem to complete the conversion process.
+
+The GFS2 filesystem does not support Context-Dependent Path Names (CDPNs).
+gfs2_convert identifies such CDPNs and replaces them with empty directories
+with the same name. The administrator can use bind mounts on these
+directories to get the same effect as CDPNs.
+
+When converting full or nearly full filesystems, it is possible that there
+won't be enough space available to fit all the GFS2 filesystem data
+structures. In such cases, the size of all the journals is reduced uniformly
+such that everything fits in the available space.
13 years, 11 months
cluster: STABLE3 - gfs2 manual pages: gfs2_convert manpage and documentation updates
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 49d1ad101092e05efa2346917f3f0907ffdd3f28
Parent: 110bd965b6d5d5b2d1a07b0139cfaacce380d801
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Fri Jun 25 16:29:47 2010 -0500
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Fri Jun 25 16:29:47 2010 -0500
gfs2 manual pages: gfs2_convert manpage and documentation updates
The recent fixes/updates to gfs2_convert change its behavior
in a few cases such as handling of CDPNs, converting full
filesystems etc. This updates the manpage to reflect that.
Resolves: rhbz#601315
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
gfs2/man/gfs2_convert.8 | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/gfs2/man/gfs2_convert.8 b/gfs2/man/gfs2_convert.8
index a05a690..5969432 100644
--- a/gfs2/man/gfs2_convert.8
+++ b/gfs2/man/gfs2_convert.8
@@ -8,21 +8,13 @@ gfs2_convert - Convert a GFS1 filesystem to GFS2
[\fIOPTION\fR]... \fIDEVICE\fR
.SH DESCRIPTION
-gfs2_convert is used to convert a filesystem from GFS1 to GFS2. Do not
-attempt to convert a GFS1 filesystem which is not clean - the process
-of conversion will reinitialise the journals. We highly recommend that
-.B fsck.gfs
-is run successfully before attempting to convert a filesystem. Many
-of the on-disk structures are identical between GFS1 and GFS2, so
-the conversion process updates the journals, a few items of incompatible
-metadata (mostly indirect pointers and inodes) and adds the per-node
-directories required by the gfs2meta filesystem. The conversion process
-is performed in-place and does not require any extra disk space so that
-it is possible to successfully convert a GFS1 filesystem that is
-completely full.
-
-Always ensure you have a complete backup of the data on any filesystem
-before starting the conversion process.
+gfs2_convert is used to convert a filesystem from GFS1 to GFS2. It is
+required that the GFS1 filesystem be checked and fixed for errors using
+\fBgfs_fsck\fP and that the filesystem be backed up before
+attempting to convert it. The convert process is irreversible and any
+error encountered during the conversion can result in the abrupt
+termination of the program and consequently an unusable filesystem.
+See \fBNOTES\fP section below for more information.
.SH OPTIONS
.TP
@@ -58,3 +50,19 @@ changes.
gfs2_convert /dev/vg0/lvol0
This will convert the Global File System on the block device
"/dev/vg0/lvol0" to gfs2 format.
+
+.SH NOTES
+If gfs2_convert is interrupted for some reason other than a conversion
+failure, DO NOT run \fBgfs2_fsck\fP on this partially converted filesystem.
+When this occurs, reissue the gfs2_convert command on the partially converted
+filesystem to complete the conversion process.
+
+The GFS2 filesystem does not support Context-Dependent Path Names (CDPNs).
+gfs2_convert identifies such CDPNs and replaces them with empty directories
+with the same name. The administrator can use bind mounts on these
+directories to get the same effect as CDPNs.
+
+When converting full or nearly full filesystems, it is possible that there
+won't be enough space available to fit all the GFS2 filesystem data
+structures. In such cases, the size of all the journals is reduced uniformly
+such that everything fits in the available space.
13 years, 11 months
cluster: RHEL56 - gfs2_fsck ends on journal recovery
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4e3322cb8fcb1109fc5f16131b467127c229fa5d
Parent: 42396b11a75672caa2c8220d76fd6fb8721cef89
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Jun 25 13:45:36 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Jun 25 13:45:36 2010 -0500
gfs2_fsck ends on journal recovery
This patch adds a return code to function write_journal and correctly
processes it as it does in the upstream code.
rhbz#606468
---
gfs2/fsck/fs_recovery.c | 6 +++---
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/structures.c | 11 ++++++-----
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 654556c..d5ccb75 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -553,9 +553,9 @@ out:
log_info( _("jid=%u: Failed\n"), j);
reinit:
if (query( _("Do you want to clear the journal instead? (y/n)")))
- write_journal(sdp, sdp->md.journal[j], j,
- sdp->md.journal[j]->i_di.di_size /
- sdp->sd_sb.sb_bsize);
+ error = write_journal(sdp, sdp->md.journal[j], j,
+ sdp->md.journal[j]->i_di.di_size /
+ sdp->sd_sb.sb_bsize);
else
log_err( _("jid=%u: journal not cleared.\n"), j);
return error;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c94c05d..c8cb958 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -478,8 +478,8 @@ extern int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
extern void build_height(struct gfs2_inode *ip, int height);
extern void unstuff_dinode(struct gfs2_inode *ip);
extern unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size);
-extern void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
- unsigned int j, unsigned int blocks);
+extern int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
+ unsigned int j, unsigned int blocks);
/**
* device_size - figure out a device's size
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index ea0ca6a..ce12174 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -86,12 +86,12 @@ build_sb(struct gfs2_sbd *sdp, const unsigned char *uuid)
}
}
-void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
- unsigned int blocks)
+int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
+ unsigned int blocks)
{
struct gfs2_log_header lh;
unsigned int x;
- uint64_t seq = RANDOM(blocks);
+ uint64_t seq = ((blocks) * (random() / (RAND_MAX + 1.0)));
uint32_t hash;
unsigned int height;
@@ -109,14 +109,14 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = get_file_buf(ip, x, TRUE);
if (!bh)
- die("write_journal\n");
+ return -1;
bmodified(bh);
brelse(bh);
}
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = get_file_buf(ip, x, FALSE);
if (!bh)
- die("write_journal\n");
+ return -1;
memset(bh->b_data, 0, sdp->bsize);
lh.lh_sequence = seq;
@@ -136,6 +136,7 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
printf("\nJournal %u:\n", j);
gfs2_dinode_print(&ip->i_di);
}
+ return 0;
}
void
13 years, 11 months
cluster: RHEL6 - rgmanager: Pass timeouts to resource agents
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: bb9f20a6bd89d4b018d5f1df8bbbfcd402061738
Parent: a365c9baa8d424476c8d4967b83ad2acf6627e71
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Jun 21 12:21:31 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Jun 25 10:26:07 2010 -0400
rgmanager: Pass timeouts to resource agents
This increases user control of resource agent
handling and allows users and developers to control
resource agent behavior more accurately.
Note that timeouts are not passed to the resource
agent if __enforce_timeouts is set.
Resolves: bz606480
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/include/res-ocf.h | 1 +
rgmanager/src/daemons/restree.c | 29 ++++++++++++++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/rgmanager/include/res-ocf.h b/rgmanager/include/res-ocf.h
index 6e71ac2..557e128 100644
--- a/rgmanager/include/res-ocf.h
+++ b/rgmanager/include/res-ocf.h
@@ -14,6 +14,7 @@
#define OCF_CHECK_LEVEL_STR "OCF_CHECK_LEVEL"
#define OCF_RESOURCE_TYPE_STR "OCF_RESOURCE_TYPE"
#define OCF_REFCNT_STR "OCF_RESKEY_RGMANAGER_meta_refcnt"
+#define OCF_TIMEOUT_STR "OCF_RESKEY_RGMANAGER_meta_timeout"
/*
LSB return codes
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 85f9ec1..1ae9746 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -95,7 +95,7 @@ kill_env(char **env)
@see build_env
*/
static void
-add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
+add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt, int timeout)
{
char ver[10];
char *minor, *val;
@@ -190,6 +190,17 @@ add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
return;
snprintf(val, n, "%s=%s", OCF_REFCNT_STR, ver);
*env = val; env++;
+
+ /*
+ Store the resource action timeout
+ */
+ snprintf(ver, sizeof(ver), "%d", timeout);
+ n = strlen(OCF_TIMEOUT_STR) + strlen(ver) + 2;
+ val = malloc(n);
+ if (!val)
+ return;
+ snprintf(val, n, "%s=%s", OCF_TIMEOUT_STR, ver);
+ *env = val; env++;
}
@@ -203,7 +214,7 @@ add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
@see kill_env res_exec add_ocf_stuff
*/
static char **
-build_env(resource_node_t *node, int depth, int refcnt)
+build_env(resource_node_t *node, int depth, int refcnt, int timeout)
{
resource_t *res = node->rn_resource;
char **env;
@@ -211,7 +222,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
int x, attrs, n;
for (attrs = 0; res->r_attrs && res->r_attrs[attrs].ra_name; attrs++);
- attrs += 8; /*
+ attrs += 9; /*
Leave space for:
OCF_RA_VERSION_MAJOR
OCF_RA_VERSION_MINOR
@@ -220,6 +231,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
OCF_RESOURCE_TYPE
OCF_CHECK_LEVEL
OCF_RESKEY_RGMANAGER_meta_refcnt
+ OCF_RESKEY_RGMANAGER_meta_timeout
(null terminator)
*/
@@ -259,7 +271,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
++attrs;
}
- add_ocf_stuff(res, &env[attrs], depth, refcnt);
+ add_ocf_stuff(res, &env[attrs], depth, refcnt, timeout);
return env;
}
@@ -318,7 +330,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
int childpid, pid;
int ret = 0;
int act_index;
- time_t sleeptime = 0;
+ time_t sleeptime = 0, timeout = 0;
char **env = NULL;
resource_t *res = node->rn_resource;
const char *op_str = agent_op_str(op);
@@ -338,8 +350,11 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
if (act_index < 0)
return 0;
+ if (!(node->rn_flags & RF_ENFORCE_TIMEOUTS))
+ timeout = node->rn_actions[act_index].ra_timeout;
+
#ifdef DEBUG
- env = build_env(node, depth, node->rn_resource->r_incarnations);
+ env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
if (!env)
return -errno;
#endif
@@ -365,7 +380,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
#endif
#ifndef DEBUG
- env = build_env(node, depth, node->rn_resource->r_incarnations);
+ env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
#endif
if (!env)
13 years, 11 months
cluster: RHEL6 - cman: Recalculate expected_votes on a config reload.
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a365c9baa8d424476c8d4967b83ad2acf6627e71
Parent: 1aa83158556acbd04e598f36ccac60a6bebf8ab7
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Wed Jun 23 10:28:33 2010 +0100
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Jun 25 09:14:20 2010 -0400
cman: Recalculate expected_votes on a config reload.
Add code to recalculate the expected_votes (and therefore quorum)
when the configuration is reloaded. This means that removing
a node now properly sets expected_votes down and the cluster
remains quorate. It will also raise expected_votes if a node is added.
rhbz#606989
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cmanconfig.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index 4a82525..16ef65f 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -45,6 +45,7 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
int error;
unsigned int expected = 0;
unsigned int votes = 0;
+ unsigned int total_votes = 0;
hdb_handle_t object_handle;
hdb_handle_t nodes_handle;
hdb_handle_t find_handle;
@@ -102,11 +103,14 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
log_printf(LOGSYS_LEVEL_DEBUG, "memb: Got node %s from ccs (id=%d, votes=%d)\n", nodename, this_nodeid, votes);
add_ccs_node(nodename, this_nodeid, votes, expected);
nodes_handle = nodeslist_next(corosync, find_handle);
+ total_votes += votes;
} while (nodes_handle);
corosync->object_find_destroy(find_handle);
- if (expected)
- override_expected(expected);
+ if (!expected)
+ expected = total_votes;
+
+ override_expected(expected);
remove_unread_nodes();
error = 0;
13 years, 11 months
cluster: RHEL6 - fence_apc: fence_apc fails for some port numbers
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 1aa83158556acbd04e598f36ccac60a6bebf8ab7
Parent: 2957fe2e67b2f2594fa20fe72c99a541afdac9f9
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Jun 23 18:29:02 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Jun 23 18:34:35 2010 +0200
fence_apc: fence_apc fails for some port numbers
Problem is that string we parse looks like:
'Press Enter to continue ...\r 23-bar1 ON' and we did not expect text
message before our line.
Resolves: #606297
---
fence/agents/apc/fence_apc.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 12ddf2a..d10dd5f 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -70,11 +70,11 @@ def get_power_status(conn, options):
while True:
exp_result = conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"]))
lines = conn.before.split("\n");
- show_re = re.compile('^\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
+ show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
res = show_re.search(x)
if (res != None):
- outlets[res.group(1)] = (res.group(2), res.group(3))
+ outlets[res.group(2)] = (res.group(3), res.group(4))
conn.send("\r\n")
if exp_result == 0:
break
13 years, 12 months
cluster: STABLE3 - fence_apc: fence_apc fails for some port numbers
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 110bd965b6d5d5b2d1a07b0139cfaacce380d801
Parent: e95deaf87607f483f4066e2cbc105ffa725ddd05
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Jun 23 18:29:02 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Jun 23 18:29:02 2010 +0200
fence_apc: fence_apc fails for some port numbers
Problem is that string we parse looks like:
'Press Enter to continue ...\r 23-bar1 ON' and we did not expect text
message before our line.
Resolves: #606297
---
fence/agents/apc/fence_apc.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 12ddf2a..d10dd5f 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -70,11 +70,11 @@ def get_power_status(conn, options):
while True:
exp_result = conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"]))
lines = conn.before.split("\n");
- show_re = re.compile('^\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
+ show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
res = show_re.search(x)
if (res != None):
- outlets[res.group(1)] = (res.group(2), res.group(3))
+ outlets[res.group(2)] = (res.group(3), res.group(4))
conn.send("\r\n")
if exp_result == 0:
break
13 years, 12 months
cluster: STABLE3 - cman: Recalculate expected_votes on a config reload.
by Christine Caulfield
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e95deaf87607f483f4066e2cbc105ffa725ddd05
Parent: c9bbf4f12402c5e38e51e21d38682712c18ab5ee
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Wed Jun 23 10:28:33 2010 +0100
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Wed Jun 23 10:28:33 2010 +0100
cman: Recalculate expected_votes on a config reload.
Add code to recalculate the expected_votes (and therefore quorum)
when the configuration is reloaded. This means that removing
a node now properly sets expected_votes down and the cluster
remains quorate. It will also raise expected_votes if a node is added.
rhbz#606989
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cmanconfig.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index 4a82525..16ef65f 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -45,6 +45,7 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
int error;
unsigned int expected = 0;
unsigned int votes = 0;
+ unsigned int total_votes = 0;
hdb_handle_t object_handle;
hdb_handle_t nodes_handle;
hdb_handle_t find_handle;
@@ -102,11 +103,14 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
log_printf(LOGSYS_LEVEL_DEBUG, "memb: Got node %s from ccs (id=%d, votes=%d)\n", nodename, this_nodeid, votes);
add_ccs_node(nodename, this_nodeid, votes, expected);
nodes_handle = nodeslist_next(corosync, find_handle);
+ total_votes += votes;
} while (nodes_handle);
corosync->object_find_destroy(find_handle);
- if (expected)
- override_expected(expected);
+ if (!expected)
+ expected = total_votes;
+
+ override_expected(expected);
remove_unread_nodes();
error = 0;
13 years, 12 months
cluster: STABLE3 - resource-agents: Make vm.sh use stop/start timeouts
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c9bbf4f12402c5e38e51e21d38682712c18ab5ee
Parent: 3153871877e05f94570c444b17761b0027f36241
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Jun 21 12:22:23 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Jun 22 08:24:39 2010 -0400
resource-agents: Make vm.sh use stop/start timeouts
Startup timeouts are handled by calling the status_program
(if specified) every few seconds until either the timeout is
reached or the status program returns a successful result.
Because the combined VM boot + application time was the
basis for the 5 minute check interval for depth=10 (where
the status_program is called), it has been reduced to 1
minute intervals.
The startup timeout, since it may now be waiting for
services within the VM, has been increased to 5 minutes
from 20 seconds to match the previous status check timing
functionality.
Resolves: bz606754
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/vm.sh | 65 +++++++++++++++++++++++++++++++++++++---
1 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 08fd097..dee7564 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -261,15 +261,15 @@ meta_data()
</parameters>
<actions>
- <action name="start" timeout="20"/>
+ <action name="start" timeout="300"/>
<action name="stop" timeout="120"/>
<action name="status" timeout="10" interval="30"/>
<action name="monitor" timeout="10" interval="30"/>
<!-- depth 10 calls the status_program -->
- <action name="status" depth="10" timeout="10" interval="300"/>
- <action name="monitor" depth="10" timeout="10" interval="300"/>
+ <action name="status" depth="10" timeout="20" interval="60"/>
+ <action name="monitor" depth="10" timeout="20" interval="60"/>
<!-- reconfigure - reconfigure with new OCF parameters.
NOT OCF COMPATIBLE AT ALL -->
@@ -351,6 +351,31 @@ do_xm_start()
}
+get_timeout()
+{
+ declare -i default_timeout=60
+ declare -i tout
+
+ if [ -n "$OCF_RESKEY_RGMANAGER_meta_timeout" ]; then
+ tout=$OCF_RESKEY_RGMANAGER_meta_timeout
+ elif [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
+ tout=$OCF_RESKEY_CRM_meta_timeout
+ fi
+
+ if [ "$tout" -eq "0" ]; then
+ echo $default_timeout
+ return 0
+ fi
+ if [ $tout -lt 0 ]; then
+ echo $default_timeout
+ return 0
+ fi
+
+ echo $tout
+ return 0
+}
+
+
#
# Start a virtual machine given the parameters from
# the environment.
@@ -428,7 +453,7 @@ do_xm_stop()
#
do_virsh_stop()
{
- declare -i timeout=60
+ declare -i timeout=$(get_timeout)
declare -i ret=1
declare state
@@ -443,7 +468,7 @@ do_virsh_stop()
echo virsh $op $OCF_RESKEY_name ...
virsh $op $OCF_RESKEY_name
- timeout=60
+ timeout=$(get_timeout)
while [ $timeout -gt 0 ]; do
sleep 5
((timeout -= 5))
@@ -913,6 +938,30 @@ migrate()
return $rv
}
+
+wait_start()
+{
+ declare -i timeout_remaining=$(get_timeout)
+
+ if [ -z "$OCF_RESKEY_status_program" ]; then
+ return 0
+ fi
+
+ while [ $timeout_remaining -gt 0 ]; do
+ bash -c "$OCF_RESKEY_status_program" &> /dev/null
+ if [ $? -eq 0 ]; then
+ return 0
+ fi
+ sleep 5
+ ((timeout_remaining -= 5))
+ done
+
+ ocf_log err "Start of $OCF_RESOURCE_INSTANCE has failed"
+ ocf_log err "Timeout exceeded while waiting for \"$OCF_RESKEY_status_program\""
+
+ return 1
+}
+
#
#
#
@@ -921,6 +970,12 @@ case $1 in
start)
validate_all || exit $OCF_ERR_ARGS
do_start
+ rv=$?
+ if [ $rv -ne 0 ]; then
+ exit $rv
+ fi
+
+ wait_start
exit $?
;;
stop)
13 years, 12 months
cluster: STABLE3 - rgmanager: Pass timeouts to resource agents
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3153871877e05f94570c444b17761b0027f36241
Parent: 227d24bf7e5e56b303b64abd3e84db1ad3572ca6
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Jun 21 12:21:31 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Jun 22 08:19:22 2010 -0400
rgmanager: Pass timeouts to resource agents
This increases user control of resource agent
handling and allows users and developers to control
resource agent behavior more accurately.
Note that timeouts are not passed to the resource
agent if __enforce_timeouts is set.
Resolves: bz606480
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/include/res-ocf.h | 1 +
rgmanager/src/daemons/restree.c | 29 ++++++++++++++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/rgmanager/include/res-ocf.h b/rgmanager/include/res-ocf.h
index 6e71ac2..557e128 100644
--- a/rgmanager/include/res-ocf.h
+++ b/rgmanager/include/res-ocf.h
@@ -14,6 +14,7 @@
#define OCF_CHECK_LEVEL_STR "OCF_CHECK_LEVEL"
#define OCF_RESOURCE_TYPE_STR "OCF_RESOURCE_TYPE"
#define OCF_REFCNT_STR "OCF_RESKEY_RGMANAGER_meta_refcnt"
+#define OCF_TIMEOUT_STR "OCF_RESKEY_RGMANAGER_meta_timeout"
/*
LSB return codes
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 85f9ec1..1ae9746 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -95,7 +95,7 @@ kill_env(char **env)
@see build_env
*/
static void
-add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
+add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt, int timeout)
{
char ver[10];
char *minor, *val;
@@ -190,6 +190,17 @@ add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
return;
snprintf(val, n, "%s=%s", OCF_REFCNT_STR, ver);
*env = val; env++;
+
+ /*
+ Store the resource action timeout
+ */
+ snprintf(ver, sizeof(ver), "%d", timeout);
+ n = strlen(OCF_TIMEOUT_STR) + strlen(ver) + 2;
+ val = malloc(n);
+ if (!val)
+ return;
+ snprintf(val, n, "%s=%s", OCF_TIMEOUT_STR, ver);
+ *env = val; env++;
}
@@ -203,7 +214,7 @@ add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
@see kill_env res_exec add_ocf_stuff
*/
static char **
-build_env(resource_node_t *node, int depth, int refcnt)
+build_env(resource_node_t *node, int depth, int refcnt, int timeout)
{
resource_t *res = node->rn_resource;
char **env;
@@ -211,7 +222,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
int x, attrs, n;
for (attrs = 0; res->r_attrs && res->r_attrs[attrs].ra_name; attrs++);
- attrs += 8; /*
+ attrs += 9; /*
Leave space for:
OCF_RA_VERSION_MAJOR
OCF_RA_VERSION_MINOR
@@ -220,6 +231,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
OCF_RESOURCE_TYPE
OCF_CHECK_LEVEL
OCF_RESKEY_RGMANAGER_meta_refcnt
+ OCF_RESKEY_RGMANAGER_meta_timeout
(null terminator)
*/
@@ -259,7 +271,7 @@ build_env(resource_node_t *node, int depth, int refcnt)
++attrs;
}
- add_ocf_stuff(res, &env[attrs], depth, refcnt);
+ add_ocf_stuff(res, &env[attrs], depth, refcnt, timeout);
return env;
}
@@ -318,7 +330,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
int childpid, pid;
int ret = 0;
int act_index;
- time_t sleeptime = 0;
+ time_t sleeptime = 0, timeout = 0;
char **env = NULL;
resource_t *res = node->rn_resource;
const char *op_str = agent_op_str(op);
@@ -338,8 +350,11 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
if (act_index < 0)
return 0;
+ if (!(node->rn_flags & RF_ENFORCE_TIMEOUTS))
+ timeout = node->rn_actions[act_index].ra_timeout;
+
#ifdef DEBUG
- env = build_env(node, depth, node->rn_resource->r_incarnations);
+ env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
if (!env)
return -errno;
#endif
@@ -365,7 +380,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
#endif
#ifndef DEBUG
- env = build_env(node, depth, node->rn_resource->r_incarnations);
+ env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
#endif
if (!env)
13 years, 12 months