cluster: STABLE3 - Add support for metadata action.
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 42a7a307821a94e1115ed408147517db905d55dd
Parent: badaf4864f102fccb1705462d6aca415abef4cde
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Dec 15 01:45:25 2009 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Dec 15 01:45:25 2009 -0600
Add support for metadata action.
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 77 +++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 144bf4c..3e37d5b 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -569,6 +569,77 @@ sub print_version ()
exit (0);
}
+sub print_metadata ()
+{
+ print "<?xml version=\"1.0\" ?>\n";
+ print "<resource-agent name=\"fence_scsi\"" .
+ " shortdesc=\"fence agent for SCSI-3 persistent reservations\">\n";
+ print "<longdesc>fence_scsi</longdesc>\n";
+
+ print "<parameters>\n";
+
+ print "\t<parameter name=\"aptpl\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-a\"/>\n";
+ print "\t\t<content type=\"boolean\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Use APTPL flag for registrations" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "\t<parameter name=\"devices\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-d\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "List of devices to be used for fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "\t<parameter name=\"logfile\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-f\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "File to write error/debug messages" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "\t<parameter name=\"key\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-k\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Key value to be used for fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "\t<parameter name=\"action\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-o\"/>\n";
+ print "\t\t<content type=\"string\" default=\"off\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "\t<parameter name=\"nodename\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-n\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Name of node" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+
+ print "</parameters>\n";
+
+ print "<actions>\n";
+ print "\t<action name=\"on\"/>\n";
+ print "\t<action name=\"off\"/>\n";
+ print "\t<action name=\"status\"/>\n";
+ print "\t<action name=\"metadata\"/>\n";
+ print "</actions>\n";
+
+ print "</resource-agent>\n";
+
+ exit (0);
+}
+
################################################################################
if (@ARGV > 0) {
@@ -576,6 +647,12 @@ if (@ARGV > 0) {
print_usage if (defined $opt_h);
print_version if (defined $opt_V);
+
+ ## handle the metadata action here to avoid other parameter checks
+ ##
+ if ($opt_o =~ /^metadata$/i) {
+ print_metadata;
+ }
}
else {
get_options_stdin ();
14 years, 5 months
cluster: RHEL55 - Merge branch 'RHEL55' of ssh://git.fedoraproject.org/git/cluster into myRHEL55
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 1acb04cb45030aa371c2f2204abbd96c0d7247e0
Parent: 3431e564c5873134bea32dadc488bed728805d10 3bcd3e1017cf489c9baa6d6fb7d16a43862f22df
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Mon Dec 14 16:31:06 2009 -0600
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Mon Dec 14 16:31:06 2009 -0600
Merge branch 'RHEL55' of ssh://git.fedoraproject.org/git/cluster into myRHEL55
rgmanager/include/event.h | 1 +
rgmanager/include/reslist.h | 8 ++-
rgmanager/src/daemons/event_config.c | 31 +++++++----
rgmanager/src/daemons/fo_domain.c | 31 +++++++----
rgmanager/src/daemons/groups.c | 25 ++++++++-
rgmanager/src/daemons/main.c | 3 +
rgmanager/src/daemons/reslist.c | 69 +++++++++++++++---------
rgmanager/src/daemons/resrules.c | 97 ++++++++++++++++++++--------------
rgmanager/src/daemons/restree.c | 57 +++++++++++++-------
rgmanager/src/daemons/rg_state.c | 53 +++++--------------
rgmanager/src/daemons/test.c | 9 +--
rgmanager/src/resources/vm.sh | 18 ++++++-
12 files changed, 243 insertions(+), 159 deletions(-)
14 years, 5 months
cluster: RHEL55 - gfs2_quota: Bug 536902 - quota file size not a multiple of struct gfs2_quota
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3431e564c5873134bea32dadc488bed728805d10
Parent: d360c0537aa734205e49939de92c763696ef477b
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Mon Dec 14 16:27:28 2009 -0600
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Mon Dec 14 16:27:28 2009 -0600
gfs2_quota: Bug 536902 - quota file size not a multiple of struct gfs2_quota
This is the userland portion of a patch-set that rips out the
linked list implementation in the quota file. It makes all
the quota linked list related warnings go away.
An accompanying kernel patch (tracked in bz 546455) is the
other half of this patch-set. This userland patch should
work harmoniously with an unpatched kernel, but it is
recommended that the kernel patch be applied as well.
Patched kernel and unpatched userland gfs2_quota is not
tested and is likely to crash.
It is also recommended that the quotas be reset on the
filesystem using "gfs2_quota reset -f /mnt/gfs2". This is to
avoid a possible corruption introduced by the linked-list
code.
---
gfs2/libgfs2/ondisk.c | 6 +-
gfs2/quota/check.c | 128 +++++++++++++----------
gfs2/quota/gfs2_quota.h | 3 -
gfs2/quota/main.c | 269 ++++++++++++-----------------------------------
4 files changed, 143 insertions(+), 263 deletions(-)
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 60a0bd8..896ec73 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -267,8 +267,7 @@ void gfs2_quota_in(struct gfs2_quota *qu, char *buf)
CPIN_64(qu, str, qu_limit);
CPIN_64(qu, str, qu_warn);
CPIN_64(qu, str, qu_value);
- CPIN_32(qu, str, qu_ll_next);
- CPIN_08(qu, str, qu_reserved, 60);
+ CPIN_08(qu, str, qu_reserved, sizeof(qu->qu_reserved));
}
void gfs2_quota_out(struct gfs2_quota *qu, char *buf)
@@ -278,8 +277,7 @@ void gfs2_quota_out(struct gfs2_quota *qu, char *buf)
CPOUT_64(qu, str, qu_limit);
CPOUT_64(qu, str, qu_warn);
CPOUT_64(qu, str, qu_value);
- CPOUT_32(qu, str, qu_ll_next);
- CPOUT_08(qu, str, qu_reserved, 60);
+ memset(qu->qu_reserved, 0, sizeof(qu->qu_reserved));
}
void gfs2_quota_print(struct gfs2_quota *qu)
diff --git a/gfs2/quota/check.c b/gfs2/quota/check.c
index ae09cd0..f33aa17 100644
--- a/gfs2/quota/check.c
+++ b/gfs2/quota/check.c
@@ -25,12 +25,16 @@
#include <limits.h>
#include <stdint.h>
#include <inttypes.h>
+#include <linux/types.h>
+#include <linux/fiemap.h>
#define __user
#include "osi_list.h"
#include "gfs2_quota.h"
+#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
+
struct values {
osi_list_t v_list;
@@ -187,9 +191,12 @@ read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
char buf[sizeof(struct gfs2_quota)];
struct gfs2_quota q;
uint64_t offset = 0;
- uint32_t id, prev, maxid;
- int error, pass, id_type;
+ uint32_t id, startid;
+ int error = 0;
char quota_file[BUF_SIZE];
+ uint64_t quota_file_size = 0;
+ struct fiemap fmap = { 0, }, *fmap2;
+ struct stat statbuf;
strcpy(sdp->path_name, comline->filesystem);
check_for_gfs2(sdp);
@@ -206,62 +213,73 @@ read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
die("can't open file %s: %s\n", comline->filesystem,
strerror(errno));
}
-
- if (!is_valid_quota_list(fd)) {
- print_quota_list_warning();
- goto do_old_school;
+ if (fstat(fd, &statbuf) < 0) {
+ close(fd);
+ close(sdp->metafs_fd);
+ cleanup_metafs(sdp);
+ die("can't stat file %s: %s\n", quota_file,
+ strerror(errno));
}
- get_last_quota_id(fd, &maxid);
-
- for (pass=0; pass<2; pass++) {
- id = 0;
- id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
-
- do {
- read_quota_internal(fd, id, id_type, &q);
- prev = id;
- q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
-
- if (q.qu_value) {
- if (pass)
- add_value(gid, id, q.qu_value);
- else
- add_value(uid, id, q.qu_value);
- }
- id = q.qu_ll_next;
- } while(id && id > prev && id <= maxid);
+ quota_file_size = statbuf.st_size;
+ /* First find the number of extents in the quota file */
+ fmap.fm_start = 0;
+ fmap.fm_length = (~0ULL);
+ error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
+ if (error == -1) {
+ fprintf(stderr, "fiemap error (%d): %s\n", errno, strerror(errno));
+ goto out;
}
- goto out;
-
-do_old_school:
- do {
-
- memset(buf, 0, sizeof(struct gfs2_quota));
- /* read hidden quota file here */
- lseek(fd, offset, SEEK_SET);
- error = read(fd, buf, sizeof(struct gfs2_quota));
- if (error < 0) {
- close(fd);
- close(sdp->metafs_fd);
- cleanup_metafs(sdp);
- die("can't read quota file (%d): %s\n",
- error, strerror(errno));
- }
- gfs2_quota_in(&q, buf);
-
- id = (offset / sizeof(struct gfs2_quota)) >> 1;
- q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
-
- if (q.qu_value) {
- if (id * sizeof(struct gfs2_quota) * 2 == offset)
- add_value(uid, id, q.qu_value);
- else
- add_value(gid, id, q.qu_value);
+ fmap2 = malloc(sizeof(struct fiemap) +
+ fmap.fm_mapped_extents * sizeof(struct fiemap_extent));
+ if (fmap2 == NULL) {
+ fprintf(stderr, "malloc error (%d): %s\n", errno, strerror(errno));
+ goto out;
+ }
+ fmap2->fm_start = 0;
+ fmap2->fm_length = (~0ULL);
+ fmap2->fm_extent_count = fmap.fm_mapped_extents;
+ error = ioctl(fd, FS_IOC_FIEMAP, fmap2);
+ if (error == -1) {
+ fprintf(stderr, "fiemap error (%d): %s\n", errno, strerror(errno));
+ goto fmap2_free;
+ }
+ if (fmap2->fm_mapped_extents) {
+ int i;
+ for (i=0; i<fmap2->fm_mapped_extents; i++) {
+ struct fiemap_extent *fe = &fmap2->fm_extents[i];
+ uint64_t end = fe->fe_logical + fe->fe_length;
+
+ end = end > quota_file_size ? quota_file_size : end;
+ startid = DIV_RU(fe->fe_logical, sizeof(struct gfs2_quota));
+ offset = startid * sizeof(struct gfs2_quota);
+ do {
+ memset(buf, 0, sizeof(struct gfs2_quota));
+ /* read hidden quota file here */
+ lseek(fd, offset, SEEK_SET);
+ error = read(fd, buf, sizeof(struct gfs2_quota));
+ if (error < 0) {
+ fprintf(stderr, "read error (%d): %s\n",
+ errno, strerror(errno));
+ goto fmap2_free;
+ }
+ gfs2_quota_in(&q, buf);
+ id = (offset / sizeof(struct gfs2_quota)) >> 1;
+ q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
+
+ if (q.qu_value) {
+ if (id * sizeof(struct gfs2_quota) * 2 == offset)
+ add_value(uid, id, q.qu_value);
+ else
+ add_value(gid, id, q.qu_value);
+ }
+
+ offset += sizeof(struct gfs2_quota);
+ } while ((offset + sizeof(struct gfs2_quota)) <
+ end);
}
-
- offset += sizeof(struct gfs2_quota);
- } while (error == sizeof(struct gfs2_quota));
-
+ }
+fmap2_free:
+ free(fmap2);
out:
close(fd);
close(sdp->metafs_fd);
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 6c7c87f..a929dfa 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -81,13 +81,10 @@ void do_get_super(int fd, struct gfs2_sb *sb);
void do_sync(struct gfs2_sbd *sdp, commandline_t *comline);
void cleanup();
void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
-void get_last_quota_id(int fd, uint32_t *max_id);
-int is_valid_quota_list(int fd);
inline void read_quota_internal(int fd, unsigned int id, int id_type,
struct gfs2_quota *q);
inline void write_quota_internal(int fd, unsigned int id, int id_type,
struct gfs2_quota *q);
-void print_quota_list_warning();
/* check.c */
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
index 3b26a11..e8b0fa2 100644
--- a/gfs2/quota/main.c
+++ b/gfs2/quota/main.c
@@ -30,6 +30,7 @@
#include <inttypes.h>
#include <linux/types.h>
+#include <linux/fiemap.h>
#include "gfs2_quota.h"
#define __user
@@ -40,6 +41,7 @@
/* Constants */
#define OPTION_STRING ("bdf:g:hkl:mnsu:V")
+#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
char *prog_name;
@@ -319,7 +321,7 @@ read_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
if (error < 0)
die("failed to read from quota file: %s\n", strerror(errno));
if (error != sizeof(struct gfs2_quota))
- die("Couldn't read %lu bytes from quota file at offset %llu\n",
+ die("Couldn't read %u bytes from quota file at offset %llu\n",
sizeof(struct gfs2_quota), (unsigned long long)offset);
gfs2_quota_in(q, buf);
}
@@ -344,139 +346,6 @@ write_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
}
/**
- * get_last_quota_id - Get the last quota in the quota file
- * @fd: an open file descriptor of the quota file
- * @id_type: GQ_ID_USER or GQ_ID_GROUP
- * @max_id: return the maximum id obtained
- */
-void
-get_last_quota_id(int fd, uint32_t *max_id)
-{
- /* stat(2) the quota file to find how big it is. This will give us a
- * a rough idea of what the last valid quota uid/gid is. It is possible
- * that the last quota in the file belongs to a group with gid:x and
- * the corresponding user quota with uid:x doesn't exist. In such cases
- * we still return x as max_id. This max_id is ONLY A HINT. If used
- * as a terminating condition of a loop, another condition should also
- * be specified.
- */
- struct stat st;
- uint32_t qsize = sizeof(struct gfs2_quota);
- uint64_t size;
- if (fstat(fd, &st))
- die("failed to stat the quota file: %s\n", strerror(errno));
- size = st.st_size;
- if (!size)
- die("error: quota file is truncated to zero!\n");
- if (size % qsize) {
- printf("warning: quota file size not a multiple of "
- "struct gfs2_quota\n");
- size = qsize * (size / qsize);
- }
- *max_id = (size - 1) / (2 * qsize);
-}
-
-/**
- * is_valid_quota_list - Check if we have a valid quota list
- * @fd: an open file descriptor of the quota file
- * Returns 0 or 1.
- */
-int
-is_valid_quota_list(int fd)
-{
- /* This is a slow test to determine if the quotas are in a
- * linked list. We should come up with something better
- * Quota linked list format is identified by the following.
- * step1: Get the maximum groupid and userid having valid
- * quotas in the quota file.
- * step2: Obtain the size of the quota file. The size of the
- * quota file (position of the last valid quota)
- * determines the last user/group id.
- * step3: If we can obtain the last valid quota through the
- * lists, then our lists are good. Else, the lists are
- * either corrupt or an older quota file format is in use
- */
- int id_type = GQ_ID_GROUP;
- uint32_t id = 0, prev, ulast = 0, glast = 0, max;
- struct gfs2_quota q;
-
- get_last_quota_id(fd, &max);
-again:
- do {
- read_quota_internal(fd, id, id_type, &q);
- prev = id;
- id = q.qu_ll_next;
- if (id > max)
- return 0;
- } while (id && id > prev);
-
- if (id && id <= prev)
- return 0;
-
- if (id_type == GQ_ID_GROUP)
- glast = prev;
- else
- ulast = prev;
-
- if (id_type == GQ_ID_GROUP) {
- id_type = GQ_ID_USER;
- id = 0;
- goto again;
- }
-
- if (glast != max && ulast != max)
- return 0;
-
- return 1;
-}
-
-void
-print_quota_list_warning()
-{
- printf("\nWarning: This filesystem doesn't seem to have the new quota "
- "list format or the quota list is corrupt. list, check and init "
- "operation performance will suffer due to this. It is recommended "
- "that you run the 'gfs2_quota reset' operation to reset the quota "
- "file. All current quota information will be lost and you will "
- "have to reassign all quota limits and warnings\n\n");
-}
-
-/**
- * adjust_quota_list - Adjust the quota linked list
- * @fd: The quota file descriptor
- * @comline: the struct containing the parsed command line arguments
- */
-static void
-adjust_quota_list(int fd, commandline_t *comline)
-{
- uint32_t prev = 0, next = 0, id = comline->id;
- struct gfs2_quota tmpq, q;
- int id_type = comline->id_type;
-
- if (id == 0) /* root quota, don't do anything */
- goto out;
- /* We just wrote the quota for id in do_set(). Get it */
- next = 0;
- do {
- read_quota_internal(fd, next, id_type, &q);
- prev = next;
- next = q.qu_ll_next;
- if (prev == id) /* no duplicates, bail */
- goto out;
- if (prev < id && id < next) /* gotcha! */
- break;
- } while(next && next > prev);
- read_quota_internal(fd, id, id_type, &tmpq);
- tmpq.qu_ll_next = next;
- q.qu_ll_next = id;
- write_quota_internal(fd, id, id_type, &tmpq);
- write_quota_internal(fd, prev, id_type, &q);
-
-out:
- return;
-}
-
-/**
* do_reset - Reset all the quota data for a filesystem
* @comline: the struct containing the parsed command line arguments
*/
@@ -515,11 +384,9 @@ do_reset(struct gfs2_sbd *sdp, commandline_t *comline)
}
read_quota_internal(fd, 0, GQ_ID_USER, &q);
- q.qu_ll_next = 0;
write_quota_internal(fd, 0, GQ_ID_USER, &q);
read_quota_internal(fd, 0, GQ_ID_GROUP, &q);
- q.qu_ll_next = 0;
write_quota_internal(fd, 0, GQ_ID_GROUP, &q);
/* truncate the quota file such that only the first
@@ -544,13 +411,14 @@ do_list(struct gfs2_sbd *sdp, commandline_t *comline)
{
int fd;
struct gfs2_quota q;
- char buf[sizeof(struct gfs2_quota)];
- uint64_t offset;
- uint32_t id, prev, maxid;
+ uint32_t startid, endid;
+ int id_type;
int pass = 0;
int error = 0;
char quota_file[BUF_SIZE];
- int id_type = comline->id_type;
+ uint64_t quota_file_size = 0;
+ struct fiemap fmap = { 0, }, *fmap2;
+ struct stat statbuf;
if (!*comline->filesystem)
die("need a filesystem to work on\n");
@@ -570,54 +438,68 @@ do_list(struct gfs2_sbd *sdp, commandline_t *comline)
die("can't open file %s: %s\n", quota_file,
strerror(errno));
}
-
- if (!is_valid_quota_list(fd)) {
- print_quota_list_warning();
- goto do_old_school;
+ if (fstat(fd, &statbuf) < 0) {
+ close(fd);
+ close(sdp->metafs_fd);
+ cleanup_metafs(sdp);
+ die("can't stat file %s: %s\n", quota_file,
+ strerror(errno));
+ }
+ quota_file_size = statbuf.st_size;
+ /* First find the number of extents in the quota file */
+ fmap.fm_start = 0;
+ fmap.fm_length = (~0ULL);
+ error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
+ if (error == -1) {
+ fprintf(stderr, "fiemap error (%d): %s\n", errno, strerror(errno));
+ goto out;
+ }
+ fmap2 = malloc(sizeof(struct fiemap) +
+ fmap.fm_mapped_extents * sizeof(struct fiemap_extent));
+ if (fmap2 == NULL) {
+ fprintf(stderr, "malloc error (%d): %s\n", errno, strerror(errno));
+ goto out;
}
- get_last_quota_id(fd, &maxid);
+ fmap2->fm_start = 0;
+ fmap2->fm_length = (~0ULL);
+ fmap2->fm_extent_count = fmap.fm_mapped_extents;
- for (pass=0; pass<2; pass++) {
- id = 0;
- id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
-
- do {
- read_quota_internal(fd, id, id_type, &q);
- prev = id;
- if (q.qu_limit || q.qu_warn || q.qu_value)
- print_quota(comline,
- id_type == GQ_ID_USER ? TRUE : FALSE,
- id, &q, &sdp->sd_sb);
- id = q.qu_ll_next;
- } while(id && id > prev && id <= maxid);
+ error = ioctl(fd, FS_IOC_FIEMAP, fmap2);
+ if (error == -1) {
+ fprintf(stderr, "fiemap error (%d): %s\n", errno, strerror(errno));
+ goto fmap2_free;
}
- goto out;
-
-do_old_school:
- for (pass=0; pass<2; pass++) {
- if (!pass)
- offset = 0;
- else
- offset = sizeof(struct gfs2_quota);
-
- do {
- memset(buf, 0, sizeof(struct gfs2_quota));
-
- /* read hidden quota file here */
- lseek(fd, offset, SEEK_SET);
- error = read(fd, buf, sizeof(struct gfs2_quota));
-
- gfs2_quota_in(&q, buf);
-
- id = (offset / sizeof(struct gfs2_quota)) >> 1;
-
- if (q.qu_limit || q.qu_warn || q.qu_value)
- print_quota(comline, (pass) ? FALSE : TRUE, id,
- &q, &sdp->sd_sb);
-
- offset += 2 * sizeof(struct gfs2_quota);
- } while (error == sizeof(struct gfs2_quota));
+ if (fmap2->fm_mapped_extents) {
+ int i;
+ again:
+ for (i=0; i<fmap2->fm_mapped_extents; i++) {
+ struct fiemap_extent *fe = &fmap2->fm_extents[i];
+ uint64_t end = fe->fe_logical + fe->fe_length;
+
+ end = end > quota_file_size ? quota_file_size : end;
+ startid = DIV_RU(fe->fe_logical, sizeof(struct gfs2_quota));
+ endid = end /(2 * sizeof(struct gfs2_quota));
+ if (startid % 2 != pass)
+ startid++;
+
+ startid = DIV_RU(startid, 2);
+ id_type = pass == 0 ? GQ_ID_USER : GQ_ID_GROUP;
+ do {
+ read_quota_internal(fd, startid, id_type, &q);
+ if (q.qu_limit || q.qu_warn || q.qu_value)
+ print_quota(comline, (pass) ? FALSE : TRUE, startid,
+ &q, &sdp->sd_sb);
+ startid++;
+ } while (startid < endid);
+ }
+ if (!pass) {
+ pass = 1;
+ goto again;
+ }
}
+
+fmap2_free:
+ free(fmap2);
out:
close(fd);
close(sdp->metafs_fd);
@@ -639,7 +521,6 @@ do_get_one(struct gfs2_sbd *sdp, commandline_t *comline, char *filesystem)
struct gfs2_quota q;
uint64_t offset;
int error;
- uint32_t maxid;
char quota_file[BUF_SIZE];
strcpy(sdp->path_name, filesystem);
@@ -665,10 +546,6 @@ do_get_one(struct gfs2_sbd *sdp, commandline_t *comline, char *filesystem)
memset(&q, 0, sizeof(struct gfs2_quota));
- get_last_quota_id(fd, &maxid);
- if (comline->id > maxid)
- goto print_empty_quota;
-
lseek(fd, offset, SEEK_SET);
error = read(fd, buf, sizeof(struct gfs2_quota));
if (error < 0) {
@@ -680,9 +557,6 @@ do_get_one(struct gfs2_sbd *sdp, commandline_t *comline, char *filesystem)
}
gfs2_quota_in(&q, buf);
-
-
-print_empty_quota:
print_quota(comline,
(comline->id_type == GQ_ID_USER), comline->id,
&q, &sdp->sd_sb);
@@ -792,7 +666,7 @@ do_set(struct gfs2_sbd *sdp, commandline_t *comline)
int fd;
uint64_t offset;
uint64_t new_value;
- int error, adj_flag = 0;;
+ int error;
char quota_file[BUF_SIZE];
char id_str[16];
struct stat stat_buf;
@@ -811,7 +685,7 @@ do_set(struct gfs2_sbd *sdp, commandline_t *comline)
strcpy(quota_file, sdp->metafs_path);
strcat(quota_file, "/quota");
- fd = open(quota_file, O_RDWR);
+ fd = open(quota_file, O_WRONLY);
if (fd < 0) {
close(sdp->metafs_fd);
cleanup_metafs(sdp);
@@ -819,11 +693,6 @@ do_set(struct gfs2_sbd *sdp, commandline_t *comline)
strerror(errno));
}
- if (is_valid_quota_list(fd))
- adj_flag = 1;
- else
- print_quota_list_warning();
-
switch (comline->id_type) {
case GQ_ID_USER:
offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs2_quota);
@@ -941,8 +810,6 @@ do_set(struct gfs2_sbd *sdp, commandline_t *comline)
set_sysfs(fs, comline->id_type == GQ_ID_USER ?
"quota_refresh_user" : "quota_refresh_group", id_str);
- if (adj_flag)
- adjust_quota_list(fd, comline);
out:
close(fd);
close(sdp->metafs_fd);
14 years, 5 months
cluster: RHEL55 - resource-agents: Fix vm.sh migration failure handling
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 3bcd3e1017cf489c9baa6d6fb7d16a43862f22df
Parent: 94ce529d73ea7113f31fb9a369d7780e44fb7f5a
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Nov 30 17:29:02 2009 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 17:19:11 2009 -0500
resource-agents: Fix vm.sh migration failure handling
If a VM fails to migrate, there is a good chance that
the VM is still running locally. Return a non-fatal
error so that the resource does not enter the failed
state.
Resolves: rhbz#499835
Part 2 of 2
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/vm.sh | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 08c4d28..14978fc 100755
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -928,7 +928,23 @@ case $1 in
migrate)
validate_all || exit $OCF_ERR_ARGS
migrate $2 # Send VM to this node
- exit $?
+ rv=$?
+ if [ $rv -eq $OCF_ERR_GENERIC ]; then
+ # Catch-all: If migration failed with
+ # an unhandled error, do a status check
+ # to see if the VM is really dead.
+ #
+ # If the VM is still in good health, return
+ # a value to rgmanager to indicate the
+ # non-critical error
+ #
+ # XXX Is OCF_ERR_CONFIGURED the right value?
+ do_status > /dev/null
+ if [ $? -eq 0 ]; then
+ rv=$OCF_ERR_CONFIGURED
+ fi
+ fi
+ exit $rv
;;
reload)
exit 0
14 years, 5 months
cluster: RHEL55 - rgmanager: Remove async migration semantics
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 94ce529d73ea7113f31fb9a369d7780e44fb7f5a
Parent: ef388d3cba37b8779dd7fe31073867c3ee244daf
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Oct 19 13:18:54 2009 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 17:17:59 2009 -0500
rgmanager: Remove async migration semantics
Migration is a synchronous operation on both Xen and
KVM; we can rely on the return code.
Resolves: rhbz#499835
Part 1 of 2
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 53 +++++++++----------------------------
1 files changed, 13 insertions(+), 40 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 46fccad..d68ce9b 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -866,7 +866,8 @@ svc_start(char *svcName, int req)
/**
- * Migrate a service to another node.
+ * Migrate a service to another node. Relies on agent
+ * operating synchronously
*/
int
svc_migrate(char *svcName, int target)
@@ -944,20 +945,8 @@ svc_migrate(char *svcName, int target)
return RG_EFROZEN;
}
- /* LOCK HELD */
- svcStatus.rs_owner = target;
- svcStatus.rs_last_owner = my_id();
- svcStatus.rs_state = RG_STATE_MIGRATE;
- svcStatus.rs_transition = (uint64_t)time(NULL);
-
- if (set_rg_state(svcName, &svcStatus) != 0) {
- clulog(LOG_ERR,
- "#75: Failed changing service status\n");
- rg_unlock(&lockp);
- return RG_EFAIL;
- }
rg_unlock(&lockp);
-
+
ret = group_migrate(svcName, target);
switch(ret) {
@@ -976,45 +965,29 @@ svc_migrate(char *svcName, int target)
migration is simply impossible. */
/* Don't mark the service as failed; since it's either
recoverable or still running. */
- ret = RG_EFAIL;
- break;
+ return RG_EFAIL;
case OCF_RA_NOT_CONFIGURED:
- ret = RG_EINVAL;
- break;
+ return RG_EINVAL;
case 0:
- return 0;
+ break;
}
- /* Ok, we've hit a recoverable condition. Since VMs and migratory
- services are ... well, migratable, we can just flip the state
- back to 'started' and error checking will fix it later. */
+ /* Success - flip owner in state info */
if (rg_lock(svcName, &lockp) < 0) {
- clulog(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
+ clulog(LOG_ERR, "#45b: Unable to obtain cluster lock: %s\n",
strerror(errno));
- return ret;
- }
-
- if (get_rg_state(svcName, &svcStatus) != 0) {
- rg_unlock(&lockp);
- clulog(LOG_ERR, "#46: Failed getting status for RG %s\n",
- svcName);
- return ret;
- }
-
- if (svcStatus.rs_last_owner != (uint32_t)my_id() ||
- svcStatus.rs_owner != (uint32_t)target ||
- svcStatus.rs_state != RG_STATE_MIGRATE) {
- rg_unlock(&lockp);
- return ret;
+ return RG_EFAIL;
}
- svcStatus.rs_owner = my_id();
+ /* No need for a 'get' here since the service is still STARTED */
+ svcStatus.rs_last_owner = svcStatus.rs_owner;
+ svcStatus.rs_owner = target;
svcStatus.rs_state = RG_STATE_STARTED;
set_rg_state(svcName, &svcStatus);
rg_unlock(&lockp);
- return ret;
+ return 0;
}
14 years, 5 months
cluster: RHEL48 - dlm-kernel: can_be_granted workaround for user lockspaces
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e220cb0b3cef6279904967daabcbba6e3238d83f
Parent: 46d20cd6ace7ed9e35507ac823aa41999271b954
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 29 12:23:54 2009 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 14 16:17:47 2009 -0600
dlm-kernel: can_be_granted workaround for user lockspaces
bz 483685
There is a problem in the _can_be_granted() logic regarding the
waitqueue. Normally, a lock request cannot be granted if there's
another lock already on the waitqueue. This gives FIFO fairness.
One of the big problems in the RHEL4 dlm is that the waitqueue is
misused, and locks are kept there while waiting for on a remote
lock request. This can mess up the normal lock granting logic.
Example:
Requests for lkb1 and lkb2 are both sent to another node we think
is master. Both are kept on the rsb waitqueue while waiting for a
reply. The remote node ends up not being the master and returns
EINVAL for lkb1.
Local processing of lkb1 after getting the EINVAL reply:
- lkb1 is removed from the waitqueue
- we look up the master again (resdir is local for this rsb)
- the master ends up being us
- rsb nodeid set to 0
- lkb1 is passed into dlm_lock_stage2 and dlm_lock_stage3
- lkb1 is passed into _can_be_granted
- _can_be_granted sees lkb2 on the waitqueue so says lkb1 cannot
be granted
- so lkb1 is added to the waitqueue (in the proper sense,
i.e. not because it's waiting for a remote reply but because
of the master granting logic)
Local processing of lkb2 after getting its EINVAL reply:
- lkb2 removed from the waitqueue
- we see we are now the master, rsb nodid is 0
- lkb2 is passed into dlm_lock_stage2 and dlm_lock_stage3
- lkb2 is passed into _can_be_granted
- _can_be_granted sees lkb1 on the waitqueue so says lkb2 cannot be
granted
- so lkb2 is added to the waitqueue (again in the proper sense)
Other lock requests then arrive for this rsb, and all continue to
be added to the waitqueue because it's not empty.
This patch makes _can_be_granted return TRUE for locks, like lkb1,
that are being requested/tested by the grant logic for the first
time since being requested, i.e. they are not already on the
waitqueue.
To avoid regressions in this particularly sensitive area of code,
the fix is only enabled for user lockspaces (e.g. clvmd and
rgmanager), and the fix can be disabled by
echo 0 > /proc/cluster/config/dlm/user_grant_now
in case it causes a regression in some user lockspace workload.
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm-kernel/src/config.c | 8 +++++++-
dlm-kernel/src/config.h | 1 +
dlm-kernel/src/device.c | 11 +++++++++++
dlm-kernel/src/dlm_internal.h | 1 +
dlm-kernel/src/locking.c | 9 +++++++++
5 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlm-kernel/src/config.c b/dlm-kernel/src/config.c
index 2858c4f..3ce052c 100644
--- a/dlm-kernel/src/config.c
+++ b/dlm-kernel/src/config.c
@@ -29,6 +29,7 @@
#define DEFAULT_CONN_INCREMENT 32
#define DEFAULT_DEADLOCKTIME 10
#define DEFAULT_RECOVER_TIMER 5
+#define DEFAULT_USER_GRANT_NOW 1
struct config_info dlm_config = {
.tcp_port = DEFAULT_TCP_PORT,
@@ -40,7 +41,8 @@ struct config_info dlm_config = {
.dirtbl_size = DEFAULT_DIRTBL_SIZE,
.conn_increment = DEFAULT_CONN_INCREMENT,
.deadlocktime = DEFAULT_DEADLOCKTIME,
- .recover_timer = DEFAULT_RECOVER_TIMER
+ .recover_timer = DEFAULT_RECOVER_TIMER,
+ .user_grant_now = DEFAULT_USER_GRANT_NOW
};
@@ -87,6 +89,10 @@ static struct config_proc_info {
{
.name = "recover_timer",
.value = &dlm_config.recover_timer,
+ },
+ {
+ .name = "user_grant_now",
+ .value = &dlm_config.user_grant_now,
}
};
static struct proc_dir_entry *dlm_dir;
diff --git a/dlm-kernel/src/config.h b/dlm-kernel/src/config.h
index 0b37cf4..e0dab07 100644
--- a/dlm-kernel/src/config.h
+++ b/dlm-kernel/src/config.h
@@ -25,6 +25,7 @@ struct config_info {
int conn_increment;
int deadlocktime;
int recover_timer;
+ int user_grant_now;
};
extern struct config_info dlm_config;
diff --git a/dlm-kernel/src/device.c b/dlm-kernel/src/device.c
index d7afeaf..44e1379 100644
--- a/dlm-kernel/src/device.c
+++ b/dlm-kernel/src/device.c
@@ -37,6 +37,8 @@
#include "dlm_internal.h"
#include "device.h"
+#include "config.h"
+#include "lockspace.h"
extern struct dlm_lkb *dlm_get_lkb(struct dlm_ls *, int);
static struct file_operations _dlm_fops;
@@ -179,6 +181,7 @@ static void add_lockspace_to_list(struct user_ls *lsinfo)
device for userland to access it */
static int register_lockspace(char *name, struct user_ls **ls, int flags)
{
+ struct dlm_ls *dlmls;
struct user_ls *newls;
int status;
int namelen;
@@ -223,6 +226,14 @@ static int register_lockspace(char *name, struct user_ls **ls, int flags)
if (flags & DLM_USER_LSFLG_DEFAULTLS)
set_bit(LS_FLAG_DEFAULT, &newls->ls_flags);
+ dlmls = find_lockspace_by_name(name, strlen(name));
+ if (!dlmls) {
+ log_print("skip GRANT_NOW flag, lockspace not found");
+ } else {
+ if (dlm_config.user_grant_now)
+ set_bit(LSFL_USER_GRANT_NOW, &dlmls->ls_flags);
+ }
+
add_lockspace_to_list(newls);
*ls = newls;
return 0;
diff --git a/dlm-kernel/src/dlm_internal.h b/dlm-kernel/src/dlm_internal.h
index 3400ee7..ed54db3 100644
--- a/dlm-kernel/src/dlm_internal.h
+++ b/dlm-kernel/src/dlm_internal.h
@@ -232,6 +232,7 @@ struct dlm_recover {
#define LSFL_ALL_NODES_VALID (11)
#define LSFL_REQUEST_WARN (12)
#define LSFL_RECOVERD_EXIT (13)
+#define LSFL_USER_GRANT_NOW (14)
#define LSST_NONE (0)
#define LSST_INIT (1)
diff --git a/dlm-kernel/src/locking.c b/dlm-kernel/src/locking.c
index 51be67d..73897e9 100644
--- a/dlm-kernel/src/locking.c
+++ b/dlm-kernel/src/locking.c
@@ -229,6 +229,7 @@ static int conversion_deadlock_detect(struct dlm_rsb *rsb, struct dlm_lkb *lkb)
static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
{
+ struct dlm_ls *ls = r->res_ls;
int8_t conv = (lkb->lkb_grmode != DLM_LOCK_IV);
/*
@@ -340,6 +341,14 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now)
first_in_list(lkb, &r->res_waitqueue))
return TRUE;
+ /* special case for
+ https://bugzilla.redhat.com/show_bug.cgi?id=483685 */
+
+ if (test_bit(LSFL_USER_GRANT_NOW, &ls->ls_flags) &&
+ now && !conv && list_empty(&r->res_convertqueue) &&
+ list_empty(&r->res_grantqueue))
+ return TRUE;
+
out:
/*
* The following, enabled by CONVDEADLK, departs from VMS.
14 years, 5 months
cluster: RHEL55 - rgmanager: Add debug information to dumps
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ef388d3cba37b8779dd7fe31073867c3ee244daf
Parent: d360c0537aa734205e49939de92c763696ef477b
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Dec 1 10:35:05 2009 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 16:07:16 2009 -0500
rgmanager: Add debug information to dumps
Resolves: bz512052
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/include/event.h | 1 +
rgmanager/include/reslist.h | 8 ++-
rgmanager/src/daemons/event_config.c | 31 +++++++----
rgmanager/src/daemons/fo_domain.c | 31 +++++++----
rgmanager/src/daemons/groups.c | 25 ++++++++-
rgmanager/src/daemons/main.c | 3 +
rgmanager/src/daemons/reslist.c | 69 +++++++++++++++---------
rgmanager/src/daemons/resrules.c | 97 ++++++++++++++++++++--------------
rgmanager/src/daemons/restree.c | 57 +++++++++++++-------
rgmanager/src/daemons/test.c | 9 +--
10 files changed, 213 insertions(+), 118 deletions(-)
diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h
index 58edcd5..378ee4c 100644
--- a/rgmanager/include/event.h
+++ b/rgmanager/include/event.h
@@ -110,6 +110,7 @@ typedef struct _event_table {
int construct_events(int ccsfd, event_table_t **);
void deconstruct_events(event_table_t **);
void print_events(event_table_t *);
+void dump_events(FILE *fp, event_table_t *);
/* Does the event match a configured event? */
int event_match(event_t *pattern, event_t *actual);
diff --git a/rgmanager/include/reslist.h b/rgmanager/include/reslist.h
index b202c2f..4ce3838 100644
--- a/rgmanager/include/reslist.h
+++ b/rgmanager/include/reslist.h
@@ -179,14 +179,16 @@ int resource_tree_delta(resource_node_t **, resource_node_t **);
Load/kill resource rule sets
*/
int load_resource_rules(const char *rpath, resource_rule_t **rules);
-void print_resource_rule(resource_rule_t *rr);
+void print_resource_rules(resource_rule_t **rules);
+void dump_resource_rules(FILE *fp, resource_rule_t **rules);
void destroy_resource_rules(resource_rule_t **rules);
/*
Load/kill resource sets
*/
int load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist);
-void print_resource(resource_t *res);
+void print_resources(resource_t **reslist);
+void dump_resources(FILE *fp, resource_t **reslist);
void destroy_resources(resource_t **list);
/*
@@ -195,6 +197,7 @@ void destroy_resources(resource_t **list);
int build_resource_tree(int ccsfd, resource_node_t **tree,
resource_rule_t **rulelist, resource_t **reslist);
void print_resource_tree(resource_node_t **tree);
+void dump_resource_tree(FILE *fp, resource_node_t **tree);
void destroy_resource_tree(resource_node_t **tree);
/*
@@ -203,6 +206,7 @@ void destroy_resource_tree(resource_node_t **tree);
int construct_domains(int ccsfd, fod_t **domains);
void deconstruct_domains(fod_t **domains);
void print_domains(fod_t **domains);
+void dump_domains(FILE *fp, fod_t **domains);
int node_should_start(int nodeid, cluster_member_list_t *membership,
char *rg_name, fod_t **domains);
int node_domain_set(fod_t **domains, char *name, int **ret, int *retlen, int *flags);
diff --git a/rgmanager/src/daemons/event_config.c b/rgmanager/src/daemons/event_config.c
index 6305d41..0021a11 100644
--- a/rgmanager/src/daemons/event_config.c
+++ b/rgmanager/src/daemons/event_config.c
@@ -39,7 +39,7 @@
"/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid"
void deconstruct_events(event_table_t **);
-void print_event(event_t *ev);
+void print_event(FILE *fp, event_t *ev);
//#define DEBUG
@@ -479,37 +479,37 @@ construct_events(int ccsfd, event_table_t **events)
void
-print_event(event_t *ev)
+print_event(FILE *fp, event_t *ev)
{
- printf(" Name: %s\n", ev->ev_name);
+ fprintf(fp, " Name: %s\n", ev->ev_name);
switch(ev->ev_type) {
case EVENT_NODE:
- printf(" Node %d State %d\n", ev->ev.node.ne_nodeid,
+ fprintf(fp, " Node %d State %d\n", ev->ev.node.ne_nodeid,
ev->ev.node.ne_state);
break;
case EVENT_RG:
- printf(" RG %s State %s\n", ev->ev.group.rg_name,
+ fprintf(fp, " RG %s State %s\n", ev->ev.group.rg_name,
rg_state_str(ev->ev.group.rg_state));
break;
case EVENT_CONFIG:
- printf(" Config change - unsupported\n");
+ fprintf(fp, " Config change - unsupported\n");
break;
default:
- printf(" (Any event)\n");
+ fprintf(fp, " (Any event)\n");
break;
}
if (ev->ev_script) {
- printf(" Inline script.\n");
+ fprintf(fp, " Inline script.\n");
} else {
- printf(" File: %s\n", ev->ev_script_file);
+ fprintf(fp, " File: %s\n", ev->ev_script_file);
}
}
void
-print_events(event_table_t *events)
+dump_events(FILE *fp, event_table_t *events)
{
int x, y;
event_t *ev;
@@ -517,15 +517,22 @@ print_events(event_table_t *events)
for (x = 0; x <= events->max_prio; x++) {
if (!events->entries[x])
continue;
- printf("Event Priority Level %d:\n", x);
+ fprintf(fp, "Event Priority Level %d:\n", x);
list_for(&(events->entries[x]), ev, y) {
- print_event(ev);
+ print_event(fp, ev);
}
}
}
void
+print_events(event_table_t *events)
+{
+ dump_events(stdout, events);
+}
+
+
+void
deconstruct_events(event_table_t **eventsp)
{
int x;
diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
index 91bf7c9..d8d074f 100644
--- a/rgmanager/src/daemons/fo_domain.c
+++ b/rgmanager/src/daemons/fo_domain.c
@@ -246,7 +246,7 @@ deconstruct_domains(fod_t **domains)
void
-print_domains(fod_t **domains)
+dump_domains(FILE *fp, fod_t **domains)
{
fod_t *fod;
fod_node_t *fodn = NULL;
@@ -257,40 +257,47 @@ print_domains(fod_t **domains)
*/
list_do(domains, fod) {
- printf("Failover domain: %s\n", fod->fd_name);
- printf("Flags: ");
+ fprintf(fp, "Failover domain: %s\n", fod->fd_name);
+ fprintf(fp, "Flags: ");
if (!fod->fd_flags) {
- printf("none\n");
+ fprintf(fp, "none\n");
} else {
if (fod->fd_flags & FOD_ORDERED)
- printf("Ordered ");
+ fprintf(fp, "Ordered ");
if (fod->fd_flags & FOD_RESTRICTED)
- printf("Restricted ");
+ fprintf(fp, "Restricted ");
if (fod->fd_flags & FOD_NOFAILBACK)
- printf("No Failback");
- printf("\n");
+ fprintf(fp, "No Failback");
+ fprintf(fp, "\n");
}
list_do(&fod->fd_nodes, fodn) {
- printf(" Node %s (id %d, priority %d)\n",
+ fprintf(fp, " Node %s (id %d, priority %d)\n",
fodn->fdn_name, fodn->fdn_nodeid,
fodn->fdn_prio);
} while (!list_done(&fod->fd_nodes, fodn));
/*
node_domain_set(fod, &node_set, &node_set_len);
- printf(" Failover Order = {");
+ fprintf(fp, " Failover Order = {");
for (x = 0; x < node_set_len; x++) {
- printf(" %d ", node_set[x]);
+ fprintf(fp, " %d ", node_set[x]);
}
free(node_set);
- printf("}\n");
+ fprintf(fp, "}\n");
*/
} while (!list_done(domains, fod));
}
+void
+print_domains(fod_t **domains)
+{
+ dump_domains(stdout, domains);
+}
+
+
/**
* Check to see if a given node is the current preferred node within a domain
* on which we should start the service...
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index 377d2ed..9caf746 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -1617,6 +1617,30 @@ dump_config_version(FILE *fp)
}
+void
+dump_resource_info(FILE *fp)
+{
+ int x = central_events_enabled();
+
+ pthread_rwlock_rdlock(&resource_lock);
+ fprintf(fp, "=== Resource Agent Information ===\n");
+ dump_resource_rules(fp, &_rules);
+ fprintf(fp, "=== Defined Resources ===\n");
+ dump_resources(fp, &_resources);
+ fprintf(fp, "=== Failover Domains ===\n");
+ dump_domains(fp, &_domains);
+
+ if (x) {
+ fprintf(fp, "=== Events ===\n");
+ dump_events(fp, master_event_table);
+ }
+
+ fprintf(fp, "=== Resource Tree ===\n");
+ dump_resource_tree(fp, &_tree);
+ pthread_rwlock_unlock(&resource_lock);
+}
+
+
/**
Copy out the incarnations after doing CONDSTOPs
*/
@@ -1624,7 +1648,6 @@ static int
copy_incarnations(resource_t **leftres, resource_t **rightres)
{
resource_t *lc, *rc;
- int ret;
list_do(leftres, lc) {
rc = find_resource_by_ref(rightres, lc->r_rule->rr_type,
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index d795bab..7f12f08 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -692,6 +692,8 @@ void dump_threads(FILE *fp);
void dump_config_version(FILE *fp);
void dump_vf_states(FILE *fp);
void dump_cluster_ctx(FILE *fp);
+void dump_resource_info(FILE *fp);
+
void
dump_internal_state(int fd)
@@ -706,6 +708,7 @@ dump_internal_state(int fd)
dump_thread_states(fp);
#endif
dump_cluster_ctx(fp);
+ dump_resource_info(fp);
fclose(fp);
}
diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index 94e8c64..3796474 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -561,64 +561,83 @@ destroy_resources(resource_t **list)
@param res Resource to print.
*/
void
-print_resource(resource_t *res)
+print_resource(FILE *fp, resource_t *res)
{
int x;
- printf("Resource type: %s", res->r_rule->rr_type);
+ fprintf(fp, "Resource type: %s", res->r_rule->rr_type);
if (res->r_flags & RF_INLINE)
- printf(" [INLINE]");
+ fprintf(fp, " [INLINE]");
if (res->r_flags & RF_NEEDSTART)
- printf(" [NEEDSTART]");
+ fprintf(fp, " [NEEDSTART]");
if (res->r_flags & RF_NEEDSTOP)
- printf(" [NEEDSTOP]");
+ fprintf(fp, " [NEEDSTOP]");
if (res->r_flags & RF_COMMON)
- printf(" [COMMON]");
+ fprintf(fp, " [COMMON]");
if (res->r_flags & RF_RECONFIG)
- printf(" [RECONFIG]");
- printf("\n");
+ fprintf(fp, " [RECONFIG]");
+ fprintf(fp, "\n");
if (res->r_rule->rr_maxrefs)
- printf("Instances: %d/%d\n", res->r_refs,
- res->r_rule->rr_maxrefs);
+ fprintf(fp, "Instances: %d/%d\n", res->r_refs,
+ res->r_rule->rr_maxrefs);
if (res->r_rule->rr_agent)
- printf("Agent: %s\n", basename(res->r_rule->rr_agent));
+ fprintf(fp, "Agent: %s\n", basename(res->r_rule->rr_agent));
- printf("Attributes:\n");
+ fprintf(fp, "Attributes:\n");
if (!res->r_attrs) {
- printf(" - None -\n\n");
+ fprintf(fp, " - None -\n\n");
return;
}
for (x = 0; res->r_attrs[x].ra_name; x++) {
if (!(res->r_attrs[x].ra_flags & RA_INHERIT)) {
- printf(" %s = %s", res->r_attrs[x].ra_name,
- res->r_attrs[x].ra_value);
+ fprintf(fp, " %s = %s", res->r_attrs[x].ra_name,
+ res->r_attrs[x].ra_value);
} else {
- printf(" %s", res->r_attrs[x].ra_name);
+ fprintf(fp, " %s", res->r_attrs[x].ra_name);
}
if (!res->r_attrs[x].ra_flags) {
- printf("\n");
+ fprintf(fp, "\n");
continue;
}
- printf(" [");
+ fprintf(fp, " [");
if (res->r_attrs[x].ra_flags & RA_PRIMARY)
- printf(" primary");
+ fprintf(fp, " primary");
if (res->r_attrs[x].ra_flags & RA_UNIQUE)
- printf(" unique");
+ fprintf(fp, " unique");
if (res->r_attrs[x].ra_flags & RA_REQUIRED)
- printf(" required");
+ fprintf(fp, " required");
if (res->r_attrs[x].ra_flags & RA_RECONFIG)
- printf(" reconfig");
+ fprintf(fp, " reconfig");
if (res->r_attrs[x].ra_flags & RA_INHERIT)
- printf(" inherit(\"%s\")", res->r_attrs[x].ra_value);
- printf(" ]\n");
+ fprintf(fp, " inherit(\"%s\")", res->r_attrs[x].ra_value);
+ fprintf(fp, " ]\n");
}
- printf("\n");
+ fprintf(fp, "\n");
+}
+
+
+void
+dump_resources(FILE *fp, resource_t **resources)
+{
+ resource_t *curr;
+ int x;
+
+ list_for(resources, curr, x) {
+ print_resource(fp, curr);
+ }
+}
+
+
+void
+print_resources(resource_t **resources)
+{
+ dump_resources(stdout, resources);
}
diff --git a/rgmanager/src/daemons/resrules.c b/rgmanager/src/daemons/resrules.c
index 5e62335..97a09a1 100644
--- a/rgmanager/src/daemons/resrules.c
+++ b/rgmanager/src/daemons/resrules.c
@@ -562,120 +562,139 @@ store_childtype(resource_child_t **childp, char *name, int start, int stop,
@param rr Resource rule to print.
*/
void
-print_resource_rule(resource_rule_t *rr)
+print_resource_rule(FILE *fp, resource_rule_t *rr)
{
int x;
- printf("Resource Rules for \"%s\"\n", rr->rr_type);
+ fprintf(fp, "Resource Rules for \"%s\"\n", rr->rr_type);
if (rr->rr_version)
- printf("OCF API Version: %s\n", rr->rr_version);
+ fprintf(fp, "OCF API Version: %s\n", rr->rr_version);
if (rr->rr_maxrefs)
- printf("Max instances: %d\n", rr->rr_maxrefs);
+ fprintf(fp, "Max instances: %d\n", rr->rr_maxrefs);
if (rr->rr_agent)
- printf("Agent: %s\n", basename(rr->rr_agent));
+ fprintf(fp, "Agent: %s\n", basename(rr->rr_agent));
- printf("Flags: ");
+ fprintf(fp, "Flags: ");
if (rr->rr_flags) {
if (rr->rr_flags & RF_INIT)
- printf("init_on_add ");
+ fprintf(fp, "init_on_add ");
if (rr->rr_flags & RF_DESTROY)
- printf("destroy_on_delete ");
+ fprintf(fp, "destroy_on_delete ");
} else {
- printf("(none)");
+ fprintf(fp, "(none)");
}
- printf("\n");
+ fprintf(fp, "\n");
- printf("Attributes:\n");
+ fprintf(fp, "Attributes:\n");
if (!rr->rr_attrs) {
- printf(" - None -\n");
+ fprintf(fp, " - None -\n");
goto actions;
}
for (x = 0; rr->rr_attrs[x].ra_name; x++) {
- printf(" %s", rr->rr_attrs[x].ra_name);
+ fprintf(fp, " %s", rr->rr_attrs[x].ra_name);
if (!rr->rr_attrs[x].ra_flags && !rr->rr_attrs[x].ra_value) {
- printf("\n");
+ fprintf(fp, "\n");
continue;
}
if (rr->rr_attrs[x].ra_flags) {
- printf(" [");
+ fprintf(fp, " [");
if (rr->rr_attrs[x].ra_flags & RA_PRIMARY)
- printf(" primary");
+ fprintf(fp, " primary");
if (rr->rr_attrs[x].ra_flags & RA_UNIQUE)
- printf(" unique");
+ fprintf(fp, " unique");
if (rr->rr_attrs[x].ra_flags & RA_REQUIRED)
- printf(" required");
+ fprintf(fp, " required");
if (rr->rr_attrs[x].ra_flags & RA_INHERIT)
- printf(" inherit");
+ fprintf(fp, " inherit");
if (rr->rr_attrs[x].ra_flags & RA_RECONFIG)
- printf(" reconfig");
- printf(" ]");
+ fprintf(fp, " reconfig");
+ fprintf(fp, " ]");
}
if (rr->rr_attrs[x].ra_value)
- printf(" default=\"%s\"\n", rr->rr_attrs[x].ra_value);
+ fprintf(fp, " default=\"%s\"\n", rr->rr_attrs[x].ra_value);
else
- printf("\n");
+ fprintf(fp, "\n");
}
actions:
- printf("Actions:\n");
+ fprintf(fp, "Actions:\n");
if (!rr->rr_actions) {
- printf(" - None -\n");
+ fprintf(fp, " - None -\n");
goto children;
}
for (x = 0; rr->rr_actions[x].ra_name; x++) {
- printf(" %s\n", rr->rr_actions[x].ra_name);
+ fprintf(fp, " %s\n", rr->rr_actions[x].ra_name);
if (rr->rr_actions[x].ra_timeout)
- printf(" Timeout (hint): %d seconds\n",
+ fprintf(fp, " Timeout (hint): %d seconds\n",
(int)rr->rr_actions[x].ra_timeout);
if (rr->rr_actions[x].ra_depth)
- printf(" OCF Check Depth (status/monitor): "
+ fprintf(fp, " OCF Check Depth (status/monitor): "
"%d seconds\n",
(int)rr->rr_actions[x].ra_depth);
if (rr->rr_actions[x].ra_interval)
- printf(" Check Interval: %d seconds\n",
+ fprintf(fp, " Check Interval: %d seconds\n",
(int)rr->rr_actions[x].ra_interval);
}
children:
- printf("Explicitly defined child resource types:\n");
+ fprintf(fp, "Explicitly defined child resource types:\n");
if (!rr->rr_childtypes) {
- printf(" - None -\n\n");
+ fprintf(fp, " - None -\n\n");
return;
}
for (x = 0; rr->rr_childtypes[x].rc_name; x++) {
- printf(" %s", rr->rr_childtypes[x].rc_name);
+ fprintf(fp, " %s", rr->rr_childtypes[x].rc_name);
if (rr->rr_childtypes[x].rc_forbid) {
- printf(" (forbidden)\n");
+ fprintf(fp, " (forbidden)\n");
continue;
}
if (rr->rr_childtypes[x].rc_startlevel ||
rr->rr_childtypes[x].rc_stoplevel) {
- printf(" [");
+ fprintf(fp, " [");
if (rr->rr_childtypes[x].rc_startlevel) {
- printf(" startlevel = %d",
+ fprintf(fp, " startlevel = %d",
rr->rr_childtypes[x].rc_startlevel);
}
if (rr->rr_childtypes[x].rc_stoplevel) {
- printf(" stoplevel = %d",
+ fprintf(fp, " stoplevel = %d",
rr->rr_childtypes[x].rc_stoplevel);
}
- printf(" ] ");
+ fprintf(fp, " ] ");
}
- printf("\n");
+ fprintf(fp, "\n");
+ }
+
+ fprintf(fp, "\n");
+}
+
+
+void
+dump_resource_rules(FILE *fp, resource_rule_t **rules)
+{
+ resource_rule_t *curr;
+ int x;
+
+ list_for(rules, curr, x) {
+ print_resource_rule(fp, curr);
}
+}
+
- printf("\n");
+void
+print_resource_rules(resource_rule_t **rules)
+{
+ dump_resource_rules(stdout, rules);
}
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 900debe..c4634a5 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -915,48 +915,56 @@ destroy_resource_tree(resource_node_t **tree)
void
-_print_resource_tree(resource_node_t **tree, int level)
+_print_resource_tree(FILE *fp, resource_node_t **tree, int level)
{
resource_node_t *node;
int x, y;
list_do(tree, node) {
for (x = 0; x < level; x++)
- printf(" ");
+ fprintf(fp, " ");
- printf("%s", node->rn_resource->r_rule->rr_type);
+ fprintf(fp, "%s", node->rn_resource->r_rule->rr_type);
if (node->rn_flags) {
- printf(" [ ");
+ fprintf(fp, " [ ");
+ if (node->rn_flags & RF_INLINE)
+ fprintf(fp, "INLINE ");
if (node->rn_flags & RF_NEEDSTOP)
- printf("NEEDSTOP ");
+ fprintf(fp, "NEEDSTOP ");
if (node->rn_flags & RF_NEEDSTART)
- printf("NEEDSTART ");
+ fprintf(fp, "NEEDSTART ");
if (node->rn_flags & RF_COMMON)
- printf("COMMON ");
+ fprintf(fp, "COMMON ");
if (node->rn_flags & RF_INDEPENDENT)
- printf("INDEPENDENT ");
+ fprintf(fp, "INDEPENDENT ");
+ if (node->rn_flags & RF_RECONFIG)
+ fprintf(fp, "RECONFIG ");
+ if (node->rn_flags & RF_INIT)
+ fprintf(fp, "INIT ");
+ if (node->rn_flags & RF_DESTROY)
+ fprintf(fp, "DESTROY ");
if (node->rn_flags & RF_ENFORCE_TIMEOUTS)
- printf("ENFORCE-TIMEOUTS ");
- printf("]");
+ fprintf(fp, "ENFORCE-TIMEOUTS ");
+ fprintf(fp, "]");
}
- printf(" {\n");
+ fprintf(fp, " {\n");
for (x = 0; node->rn_resource->r_attrs &&
node->rn_resource->r_attrs[x].ra_value; x++) {
for (y = 0; y < level+1; y++)
- printf(" ");
- printf("%s = \"%s\";\n",
- node->rn_resource->r_attrs[x].ra_name,
- attr_value(node,
- node->rn_resource->r_attrs[x].ra_name)
- );
+ fprintf(fp, " ");
+ fprintf(fp, "%s = \"%s\";\n",
+ node->rn_resource->r_attrs[x].ra_name,
+ attr_value(node,
+ node->rn_resource->r_attrs[x].ra_name)
+ );
}
- _print_resource_tree(&node->rn_child, level + 1);
+ _print_resource_tree(fp, &node->rn_child, level + 1);
for (x = 0; x < level; x++)
- printf(" ");
- printf("}\n");
+ fprintf(fp, " ");
+ fprintf(fp, "}\n");
} while (!list_done(tree, node));
}
@@ -964,7 +972,14 @@ _print_resource_tree(resource_node_t **tree, int level)
void
print_resource_tree(resource_node_t **tree)
{
- _print_resource_tree(tree, 0);
+ _print_resource_tree(stdout, tree, 0);
+}
+
+
+void
+dump_resource_tree(FILE *fp, resource_node_t **tree)
+{
+ _print_resource_tree(fp, tree, 0);
}
diff --git a/rgmanager/src/daemons/test.c b/rgmanager/src/daemons/test.c
index 0fb9cf6..19e006e 100644
--- a/rgmanager/src/daemons/test.c
+++ b/rgmanager/src/daemons/test.c
@@ -113,9 +113,8 @@ rules_func(int __attribute__((unused)) argc,
} while (!list_done(&rulelist, currule));
fprintf(stderr, "Loaded %d resource rules\n",
rules);
- list_do(&rulelist, currule) {
- print_resource_rule(currule);
- } while (!list_done(&rulelist, currule));
+
+ print_resource_rules(&rulelist);
destroy_resource_rules(&rulelist);
@@ -166,9 +165,7 @@ test_func(int argc, char **argv)
if (reslist) {
printf("=== Resources List ===\n");
- list_do(&reslist, curres) {
- print_resource(curres);
- } while (!list_done(&reslist, curres));
+ print_resources(&reslist);
}
if (tree) {
14 years, 5 months
cluster: STABLE3 - config: Remove data type="string"
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: badaf4864f102fccb1705462d6aca415abef4cde
Parent: 282f383a6c69f13e2c0e36e576b53f130cdae11b
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Dec 14 14:21:21 2009 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 14:22:00 2009 -0500
config: Remove data type="string"
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
config/tools/xml/cluster.rng.in | 39 +++++++++++----------------------------
1 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in b/config/tools/xml/cluster.rng.in
index 2ad60e8..d78685b 100644
--- a/config/tools/xml/cluster.rng.in
+++ b/config/tools/xml/cluster.rng.in
@@ -40,7 +40,7 @@ To validate your cluster.conf against this schema, run:
than the current value." rha:sample="1" rha:default="1"/>
<optional>
<attribute name="alias" rha:description="Pretty name for cluster that
- is not parsed by cluster tag software; only the Conga and
+ is not parsed by cluster software; only the Conga and
system-config-cluster GUIs use this value."
rha:sample="My Cluster"/>
</optional>
@@ -396,49 +396,35 @@ To validate your cluster.conf against this schema, run:
cluster. Furthermore, the dom0 cluster is required to have fencing
if domU recovery is expected to be automatic.">
<optional>
- <attribute name="debug" rha:description="" rha:sample="">
+ <attribute name="debug" rha:description="" >
<data type="integer"/>
</attribute>
</optional>
<optional>
- <attribute name="port" rha:description="" rha:sample="">
+ <attribute name="port" rha:description="" >
<data type="integer"/>
</attribute>
</optional>
<optional>
- <attribute name="use_uuid" rha:description="" rha:sample="">
- <data type="boolean"/>
- </attribute>
+ <attribute name="use_uuid" rha:description="" />
</optional>
<optional>
- <attribute name="multicast_address" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="multicast_address" rha:description="" />
</optional>
<optional>
- <attribute name="auth" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="auth" rha:description="" />
</optional>
<optional>
- <attribute name="hash" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="hash" rha:description="" />
</optional>
<optional>
- <attribute name="uri" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="uri" rha:description="" />
</optional>
<optional>
- <attribute name="key_file" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="key_file" rha:description="" />
</optional>
<optional>
- <attribute name="multicast_interface" rha:description="" rha:sample="">
- <data type="string"/>
- </attribute>
+ <attribute name="multicast_interface" rha:description="" />
</optional>
</element>
</optional>
@@ -809,10 +795,7 @@ To validate your cluster.conf against this schema, run:
<optional>
<attribute name="log_facility" rha:description="The facility is one
of the following keywords: auth, authpriv, cron, daemon, kern,
- lpr, mail, news, syslog, user, uucp and local0 through local7"
- rha:sample="local4">
- <data type="string"/>
- </attribute>
+ lpr, mail, news, syslog, user, uucp and local0 through local7"/>
</optional>
<interleave>
<optional>
14 years, 5 months
cluster: STABLE3 - rgmanager: Move prototypes in to correct header
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 282f383a6c69f13e2c0e36e576b53f130cdae11b
Parent: 24e8a5d33b40ae6aa57949366497eda119ac81cc
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Dec 10 14:42:32 2009 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 14:22:00 2009 -0500
rgmanager: Move prototypes in to correct header
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/include/fo_domain.h | 1 +
rgmanager/include/reslist.h | 11 -----------
2 files changed, 1 insertions(+), 11 deletions(-)
diff --git a/rgmanager/include/fo_domain.h b/rgmanager/include/fo_domain.h
index 2cc654b..d8a7813 100644
--- a/rgmanager/include/fo_domain.h
+++ b/rgmanager/include/fo_domain.h
@@ -39,6 +39,7 @@ typedef struct _fod {
int construct_domains(int ccsfd, fod_t **domains);
void deconstruct_domains(fod_t **domains);
void print_domains(fod_t **domains);
+void dump_domains(FILE *fp, fod_t **domains);
int node_should_start(int nodeid, cluster_member_list_t *membership,
const char *rg_name, fod_t **domains);
int node_domain_set(fod_t **domains, char *name, int **ret,
diff --git a/rgmanager/include/reslist.h b/rgmanager/include/reslist.h
index 40b8297..119fbfc 100644
--- a/rgmanager/include/reslist.h
+++ b/rgmanager/include/reslist.h
@@ -168,17 +168,6 @@ void dump_resource_tree(FILE *fp, resource_node_t **tree);
void destroy_resource_tree(resource_node_t **tree);
void *act_dup(resource_act_t *acts);
-/*
- Construct/deconstruct failover domains
- */
-int construct_domains(int ccsfd, fod_t **domains);
-void deconstruct_domains(fod_t **domains);
-void print_domains(fod_t **domains);
-void dump_domains(FILE *fp, fod_t **domains);
-int node_should_start(int nodeid, cluster_member_list_t *membership,
- char *rg_name, fod_t **domains);
-int node_domain_set(fod_t **domains, char *name, int **ret, int *retlen, int *flags);
-int node_domain_set_safe(char *domainname, int **ret, int *retlen, int *flags);
/*
14 years, 5 months
cluster: STABLE3 - rgmanager: Add debug information to dumps
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 24e8a5d33b40ae6aa57949366497eda119ac81cc
Parent: d7330ff7d2e4a68ad0e1e92259d5cb00639938b6
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Dec 1 10:35:05 2009 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Dec 14 14:22:00 2009 -0500
rgmanager: Add debug information to dumps
Resolves: bz512052
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/include/event.h | 1 +
rgmanager/include/reslist.h | 19 +++++-
rgmanager/src/daemons/event_config.c | 31 ++++++----
rgmanager/src/daemons/fo_domain.c | 41 +++++++++----
rgmanager/src/daemons/groups.c | 24 +++++++
rgmanager/src/daemons/main.c | 3 +
rgmanager/src/daemons/reslist.c | 69 +++++++++++++--------
rgmanager/src/daemons/resrules.c | 97 ++++++++++++++++++------------
rgmanager/src/daemons/restree.c | 57 +++++++++++-------
rgmanager/src/daemons/test.c | 9 +--
rgmanager/src/daemons/tests/test012.conf | 2 +-
11 files changed, 235 insertions(+), 118 deletions(-)
diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h
index 84d384b..b0b1bee 100644
--- a/rgmanager/include/event.h
+++ b/rgmanager/include/event.h
@@ -93,6 +93,7 @@ typedef struct _event_table {
int construct_events(int ccsfd, event_table_t **);
void deconstruct_events(event_table_t **);
void print_events(event_table_t *);
+void dump_events(FILE *fp, event_table_t *);
/* Does the event match a configured event? */
int event_match(event_t *pattern, event_t *actual);
diff --git a/rgmanager/include/reslist.h b/rgmanager/include/reslist.h
index 88e148b..40b8297 100644
--- a/rgmanager/include/reslist.h
+++ b/rgmanager/include/reslist.h
@@ -146,14 +146,16 @@ int resource_tree_delta(resource_node_t **, resource_node_t **);
Load/kill resource rule sets
*/
int load_resource_rules(const char *rpath, resource_rule_t **rules);
-void print_resource_rule(resource_rule_t *rr);
+void print_resource_rules(resource_rule_t **rules);
+void dump_resource_rules(FILE *fp, resource_rule_t **rules);
void destroy_resource_rules(resource_rule_t **rules);
/*
Load/kill resource sets
*/
int load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist);
-void print_resource(resource_t *res);
+void print_resources(resource_t **reslist);
+void dump_resources(FILE *fp, resource_t **reslist);
void destroy_resources(resource_t **list);
/*
@@ -162,9 +164,22 @@ void destroy_resources(resource_t **list);
int build_resource_tree(int ccsfd, resource_node_t **tree,
resource_rule_t **rulelist, resource_t **reslist);
void print_resource_tree(resource_node_t **tree);
+void dump_resource_tree(FILE *fp, resource_node_t **tree);
void destroy_resource_tree(resource_node_t **tree);
void *act_dup(resource_act_t *acts);
+/*
+ Construct/deconstruct failover domains
+ */
+int construct_domains(int ccsfd, fod_t **domains);
+void deconstruct_domains(fod_t **domains);
+void print_domains(fod_t **domains);
+void dump_domains(FILE *fp, fod_t **domains);
+int node_should_start(int nodeid, cluster_member_list_t *membership,
+ char *rg_name, fod_t **domains);
+int node_domain_set(fod_t **domains, char *name, int **ret, int *retlen, int *flags);
+int node_domain_set_safe(char *domainname, int **ret, int *retlen, int *flags);
+
/*
Handy functions
diff --git a/rgmanager/src/daemons/event_config.c b/rgmanager/src/daemons/event_config.c
index 3523a6d..f99a980 100644
--- a/rgmanager/src/daemons/event_config.c
+++ b/rgmanager/src/daemons/event_config.c
@@ -22,7 +22,7 @@
"/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid"
void deconstruct_events(event_table_t **);
-void print_event(event_t *ev);
+void print_event(FILE *fp, event_t *ev);
//#define DEBUG
@@ -433,37 +433,37 @@ construct_events(int ccsfd, event_table_t **events)
void
-print_event(event_t *ev)
+print_event(FILE *fp, event_t *ev)
{
- printf(" Name: %s\n", ev->ev_name);
+ fprintf(fp, " Name: %s\n", ev->ev_name);
switch(ev->ev_type) {
case EVENT_NODE:
- printf(" Node %d State %d\n", ev->ev.node.ne_nodeid,
+ fprintf(fp, " Node %d State %d\n", ev->ev.node.ne_nodeid,
ev->ev.node.ne_state);
break;
case EVENT_RG:
- printf(" RG %s State %s\n", ev->ev.group.rg_name,
+ fprintf(fp, " RG %s State %s\n", ev->ev.group.rg_name,
rg_state_str(ev->ev.group.rg_state));
break;
case EVENT_CONFIG:
- printf(" Config change - unsupported\n");
+ fprintf(fp, " Config change - unsupported\n");
break;
default:
- printf(" (Any event)\n");
+ fprintf(fp, " (Any event)\n");
break;
}
if (ev->ev_script) {
- printf(" Inline script.\n");
+ fprintf(fp, " Inline script.\n");
} else {
- printf(" File: %s\n", ev->ev_script_file);
+ fprintf(fp, " File: %s\n", ev->ev_script_file);
}
}
void
-print_events(event_table_t *events)
+dump_events(FILE *fp, event_table_t *events)
{
int x, y;
event_t *ev;
@@ -471,15 +471,22 @@ print_events(event_table_t *events)
for (x = 0; x <= events->max_prio; x++) {
if (!events->entries[x])
continue;
- printf("Event Priority Level %d:\n", x);
+ fprintf(fp, "Event Priority Level %d:\n", x);
list_for(&(events->entries[x]), ev, y) {
- print_event(ev);
+ print_event(fp, ev);
}
}
}
void
+print_events(event_table_t *events)
+{
+ dump_events(stdout, events);
+}
+
+
+void
deconstruct_events(event_table_t **eventsp)
{
int x;
diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
index 08590d2..0448e0d 100644
--- a/rgmanager/src/daemons/fo_domain.c
+++ b/rgmanager/src/daemons/fo_domain.c
@@ -227,7 +227,7 @@ deconstruct_domains(fod_t **domains)
void
-print_domains(fod_t **domains)
+dump_domains(FILE *fp, fod_t **domains)
{
fod_t *fod;
fod_node_t *fodn = NULL;
@@ -238,30 +238,47 @@ print_domains(fod_t **domains)
*/
list_do(domains, fod) {
- printf("Failover domain: %s\n", fod->fd_name);
- printf("Flags: ");
+ fprintf(fp, "Failover domain: %s\n", fod->fd_name);
+ fprintf(fp, "Flags: ");
if (!fod->fd_flags) {
- printf("none\n");
+ fprintf(fp, "none\n");
} else {
if (fod->fd_flags & FOD_ORDERED)
- printf("Ordered ");
+ fprintf(fp, "Ordered ");
if (fod->fd_flags & FOD_RESTRICTED)
- printf("Restricted ");
+ fprintf(fp, "Restricted ");
if (fod->fd_flags & FOD_NOFAILBACK)
- printf("No Failback");
- printf("\n");
+ fprintf(fp, "No Failback");
+ fprintf(fp, "\n");
}
- list_do(&fod->fd_nodes, fodn) {
- printf(" Node %s (id %d, priority %d)\n",
+ list_do(&fod->fd_nodes, fodn) {
+ fprintf(fp, " Node %s (id %d, priority %d)\n",
fodn->fdn_name, fodn->fdn_nodeid,
fodn->fdn_prio);
- } while (!list_done(&fod->fd_nodes, fodn));
-
+ } while (!list_done(&fod->fd_nodes, fodn));
+
+ /*
+ node_domain_set(fod, &node_set, &node_set_len);
+ fprintf(fp, " Failover Order = {");
+ for (x = 0; x < node_set_len; x++) {
+ fprintf(fp, " %d ", node_set[x]);
+ }
+ free(node_set);
+ fprintf(fp, "}\n");
+ */
+
} while (!list_done(domains, fod));
}
+void
+print_domains(fod_t **domains)
+{
+ dump_domains(stdout, domains);
+}
+
+
/**
* Check to see if a given node is the current preferred node within a domain
* on which we should start the service...
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index e0d393e..369e555 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -1572,6 +1572,30 @@ dump_config_version(FILE *fp)
}
+void
+dump_resource_info(FILE *fp)
+{
+ int x = central_events_enabled();
+
+ pthread_rwlock_rdlock(&resource_lock);
+ fprintf(fp, "=== Resource Agent Information ===\n");
+ dump_resource_rules(fp, &_rules);
+ fprintf(fp, "=== Defined Resources ===\n");
+ dump_resources(fp, &_resources);
+ fprintf(fp, "=== Failover Domains ===\n");
+ dump_domains(fp, &_domains);
+
+ if (x) {
+ fprintf(fp, "=== Events ===\n");
+ dump_events(fp, master_event_table);
+ }
+
+ fprintf(fp, "=== Resource Tree ===\n");
+ dump_resource_tree(fp, &_tree);
+ pthread_rwlock_unlock(&resource_lock);
+}
+
+
/**
Copy out the incarnations after doing CONDSTOPs
*/
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 88970f1..5b2ad7b 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -612,6 +612,8 @@ void dump_threads(FILE *fp);
void dump_config_version(FILE *fp);
void dump_vf_states(FILE *fp);
void dump_cluster_ctx(FILE *fp);
+void dump_resource_info(FILE *fp);
+
static void
dump_internal_state(const char *loc)
@@ -625,6 +627,7 @@ dump_internal_state(const char *loc)
dump_thread_states(fp);
#endif
dump_cluster_ctx(fp);
+ dump_resource_info(fp);
fclose(fp);
}
diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index 7a2d69a..c908166 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -544,64 +544,83 @@ destroy_resources(resource_t **list)
@param res Resource to print.
*/
void
-print_resource(resource_t *res)
+print_resource(FILE *fp, resource_t *res)
{
int x;
- printf("Resource type: %s", res->r_rule->rr_type);
+ fprintf(fp, "Resource type: %s", res->r_rule->rr_type);
if (res->r_flags & RF_INLINE)
- printf(" [INLINE]");
+ fprintf(fp, " [INLINE]");
if (res->r_flags & RF_NEEDSTART)
- printf(" [NEEDSTART]");
+ fprintf(fp, " [NEEDSTART]");
if (res->r_flags & RF_NEEDSTOP)
- printf(" [NEEDSTOP]");
+ fprintf(fp, " [NEEDSTOP]");
if (res->r_flags & RF_COMMON)
- printf(" [COMMON]");
+ fprintf(fp, " [COMMON]");
if (res->r_flags & RF_RECONFIG)
- printf(" [RECONFIG]");
- printf("\n");
+ fprintf(fp, " [RECONFIG]");
+ fprintf(fp, "\n");
if (res->r_rule->rr_maxrefs)
- printf("Instances: %d/%d\n", res->r_refs,
- res->r_rule->rr_maxrefs);
+ fprintf(fp, "Instances: %d/%d\n", res->r_refs,
+ res->r_rule->rr_maxrefs);
if (res->r_rule->rr_agent)
- printf("Agent: %s\n", basename(res->r_rule->rr_agent));
+ fprintf(fp, "Agent: %s\n", basename(res->r_rule->rr_agent));
- printf("Attributes:\n");
+ fprintf(fp, "Attributes:\n");
if (!res->r_attrs) {
- printf(" - None -\n\n");
+ fprintf(fp, " - None -\n\n");
return;
}
for (x = 0; res->r_attrs[x].ra_name; x++) {
if (!(res->r_attrs[x].ra_flags & RA_INHERIT)) {
- printf(" %s = %s", res->r_attrs[x].ra_name,
- res->r_attrs[x].ra_value);
+ fprintf(fp, " %s = %s", res->r_attrs[x].ra_name,
+ res->r_attrs[x].ra_value);
} else {
- printf(" %s", res->r_attrs[x].ra_name);
+ fprintf(fp, " %s", res->r_attrs[x].ra_name);
}
if (!res->r_attrs[x].ra_flags) {
- printf("\n");
+ fprintf(fp, "\n");
continue;
}
- printf(" [");
+ fprintf(fp, " [");
if (res->r_attrs[x].ra_flags & RA_PRIMARY)
- printf(" primary");
+ fprintf(fp, " primary");
if (res->r_attrs[x].ra_flags & RA_UNIQUE)
- printf(" unique");
+ fprintf(fp, " unique");
if (res->r_attrs[x].ra_flags & RA_REQUIRED)
- printf(" required");
+ fprintf(fp, " required");
if (res->r_attrs[x].ra_flags & RA_RECONFIG)
- printf(" reconfig");
+ fprintf(fp, " reconfig");
if (res->r_attrs[x].ra_flags & RA_INHERIT)
- printf(" inherit(\"%s\")", res->r_attrs[x].ra_value);
- printf(" ]\n");
+ fprintf(fp, " inherit(\"%s\")", res->r_attrs[x].ra_value);
+ fprintf(fp, " ]\n");
}
- printf("\n");
+ fprintf(fp, "\n");
+}
+
+
+void
+dump_resources(FILE *fp, resource_t **resources)
+{
+ resource_t *curr;
+ int x;
+
+ list_for(resources, curr, x) {
+ print_resource(fp, curr);
+ }
+}
+
+
+void
+print_resources(resource_t **resources)
+{
+ dump_resources(stdout, resources);
}
diff --git a/rgmanager/src/daemons/resrules.c b/rgmanager/src/daemons/resrules.c
index 7c68ce0..576c349 100644
--- a/rgmanager/src/daemons/resrules.c
+++ b/rgmanager/src/daemons/resrules.c
@@ -556,120 +556,139 @@ store_childtype(resource_child_t **childp, char *name, int start,
@param rr Resource rule to print.
*/
void
-print_resource_rule(resource_rule_t *rr)
+print_resource_rule(FILE *fp, resource_rule_t *rr)
{
int x;
- printf("Resource Rules for \"%s\"\n", rr->rr_type);
+ fprintf(fp, "Resource Rules for \"%s\"\n", rr->rr_type);
if (rr->rr_version)
- printf("OCF API Version: %s\n", rr->rr_version);
+ fprintf(fp, "OCF API Version: %s\n", rr->rr_version);
if (rr->rr_maxrefs)
- printf("Max instances: %d\n", rr->rr_maxrefs);
+ fprintf(fp, "Max instances: %d\n", rr->rr_maxrefs);
if (rr->rr_agent)
- printf("Agent: %s\n", basename(rr->rr_agent));
+ fprintf(fp, "Agent: %s\n", basename(rr->rr_agent));
- printf("Flags: ");
+ fprintf(fp, "Flags: ");
if (rr->rr_flags) {
if (rr->rr_flags & RF_INIT)
- printf("init_on_add ");
+ fprintf(fp, "init_on_add ");
if (rr->rr_flags & RF_DESTROY)
- printf("destroy_on_delete ");
+ fprintf(fp, "destroy_on_delete ");
} else {
- printf("(none)");
+ fprintf(fp, "(none)");
}
- printf("\n");
+ fprintf(fp, "\n");
- printf("Attributes:\n");
+ fprintf(fp, "Attributes:\n");
if (!rr->rr_attrs) {
- printf(" - None -\n");
+ fprintf(fp, " - None -\n");
goto actions;
}
for (x = 0; rr->rr_attrs[x].ra_name; x++) {
- printf(" %s", rr->rr_attrs[x].ra_name);
+ fprintf(fp, " %s", rr->rr_attrs[x].ra_name);
if (!rr->rr_attrs[x].ra_flags && !rr->rr_attrs[x].ra_value) {
- printf("\n");
+ fprintf(fp, "\n");
continue;
}
if (rr->rr_attrs[x].ra_flags) {
- printf(" [");
+ fprintf(fp, " [");
if (rr->rr_attrs[x].ra_flags & RA_PRIMARY)
- printf(" primary");
+ fprintf(fp, " primary");
if (rr->rr_attrs[x].ra_flags & RA_UNIQUE)
- printf(" unique");
+ fprintf(fp, " unique");
if (rr->rr_attrs[x].ra_flags & RA_REQUIRED)
- printf(" required");
+ fprintf(fp, " required");
if (rr->rr_attrs[x].ra_flags & RA_INHERIT)
- printf(" inherit");
+ fprintf(fp, " inherit");
if (rr->rr_attrs[x].ra_flags & RA_RECONFIG)
- printf(" reconfig");
- printf(" ]");
+ fprintf(fp, " reconfig");
+ fprintf(fp, " ]");
}
if (rr->rr_attrs[x].ra_value)
- printf(" default=\"%s\"\n", rr->rr_attrs[x].ra_value);
+ fprintf(fp, " default=\"%s\"\n", rr->rr_attrs[x].ra_value);
else
- printf("\n");
+ fprintf(fp, "\n");
}
actions:
- printf("Actions:\n");
+ fprintf(fp, "Actions:\n");
if (!rr->rr_actions) {
- printf(" - None -\n");
+ fprintf(fp, " - None -\n");
goto children;
}
for (x = 0; rr->rr_actions[x].ra_name; x++) {
- printf(" %s\n", rr->rr_actions[x].ra_name);
+ fprintf(fp, " %s\n", rr->rr_actions[x].ra_name);
if (rr->rr_actions[x].ra_timeout)
- printf(" Timeout (hint): %d seconds\n",
+ fprintf(fp, " Timeout (hint): %d seconds\n",
(int)rr->rr_actions[x].ra_timeout);
if (rr->rr_actions[x].ra_depth)
- printf(" OCF Check Depth (status/monitor): "
+ fprintf(fp, " OCF Check Depth (status/monitor): "
"%d seconds\n",
(int)rr->rr_actions[x].ra_depth);
if (rr->rr_actions[x].ra_interval)
- printf(" Check Interval: %d seconds\n",
+ fprintf(fp, " Check Interval: %d seconds\n",
(int)rr->rr_actions[x].ra_interval);
}
children:
- printf("Explicitly defined child resource types:\n");
+ fprintf(fp, "Explicitly defined child resource types:\n");
if (!rr->rr_childtypes) {
- printf(" - None -\n\n");
+ fprintf(fp, " - None -\n\n");
return;
}
for (x = 0; rr->rr_childtypes[x].rc_name; x++) {
- printf(" %s", rr->rr_childtypes[x].rc_name);
+ fprintf(fp, " %s", rr->rr_childtypes[x].rc_name);
if (rr->rr_childtypes[x].rc_forbid) {
- printf(" (forbidden)\n");
+ fprintf(fp, " (forbidden)\n");
continue;
}
if (rr->rr_childtypes[x].rc_startlevel ||
rr->rr_childtypes[x].rc_stoplevel) {
- printf(" [");
+ fprintf(fp, " [");
if (rr->rr_childtypes[x].rc_startlevel) {
- printf(" startlevel = %d",
+ fprintf(fp, " startlevel = %d",
rr->rr_childtypes[x].rc_startlevel);
}
if (rr->rr_childtypes[x].rc_stoplevel) {
- printf(" stoplevel = %d",
+ fprintf(fp, " stoplevel = %d",
rr->rr_childtypes[x].rc_stoplevel);
}
- printf(" ] ");
+ fprintf(fp, " ] ");
}
- printf("\n");
+ fprintf(fp, "\n");
+ }
+
+ fprintf(fp, "\n");
+}
+
+
+void
+dump_resource_rules(FILE *fp, resource_rule_t **rules)
+{
+ resource_rule_t *curr;
+ int x;
+
+ list_for(rules, curr, x) {
+ print_resource_rule(fp, curr);
}
+}
+
- printf("\n");
+void
+print_resource_rules(resource_rule_t **rules)
+{
+ dump_resource_rules(stdout, rules);
}
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index a4d2926..f0e57d7 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -860,48 +860,56 @@ destroy_resource_tree(resource_node_t **tree)
static void
-_print_resource_tree(resource_node_t **tree, int level)
+_print_resource_tree(FILE *fp, resource_node_t **tree, int level)
{
resource_node_t *node;
int x, y;
list_do(tree, node) {
for (x = 0; x < level; x++)
- printf(" ");
+ fprintf(fp, " ");
- printf("%s", node->rn_resource->r_rule->rr_type);
+ fprintf(fp, "%s", node->rn_resource->r_rule->rr_type);
if (node->rn_flags) {
- printf(" [ ");
+ fprintf(fp, " [ ");
+ if (node->rn_flags & RF_INLINE)
+ fprintf(fp, "INLINE ");
if (node->rn_flags & RF_NEEDSTOP)
- printf("NEEDSTOP ");
+ fprintf(fp, "NEEDSTOP ");
if (node->rn_flags & RF_NEEDSTART)
- printf("NEEDSTART ");
+ fprintf(fp, "NEEDSTART ");
if (node->rn_flags & RF_COMMON)
- printf("COMMON ");
+ fprintf(fp, "COMMON ");
if (node->rn_flags & RF_INDEPENDENT)
- printf("INDEPENDENT ");
+ fprintf(fp, "INDEPENDENT ");
+ if (node->rn_flags & RF_RECONFIG)
+ fprintf(fp, "RECONFIG ");
+ if (node->rn_flags & RF_INIT)
+ fprintf(fp, "INIT ");
+ if (node->rn_flags & RF_DESTROY)
+ fprintf(fp, "DESTROY ");
if (node->rn_flags & RF_ENFORCE_TIMEOUTS)
- printf("ENFORCE-TIMEOUTS ");
- printf("]");
+ fprintf(fp, "ENFORCE-TIMEOUTS ");
+ fprintf(fp, "]");
}
- printf(" {\n");
+ fprintf(fp, " {\n");
for (x = 0; node->rn_resource->r_attrs &&
node->rn_resource->r_attrs[x].ra_value; x++) {
for (y = 0; y < level+1; y++)
- printf(" ");
- printf("%s = \"%s\";\n",
- node->rn_resource->r_attrs[x].ra_name,
- attr_value(node,
- node->rn_resource->r_attrs[x].ra_name)
- );
+ fprintf(fp, " ");
+ fprintf(fp, "%s = \"%s\";\n",
+ node->rn_resource->r_attrs[x].ra_name,
+ attr_value(node,
+ node->rn_resource->r_attrs[x].ra_name)
+ );
}
- _print_resource_tree(&node->rn_child, level + 1);
+ _print_resource_tree(fp, &node->rn_child, level + 1);
for (x = 0; x < level; x++)
- printf(" ");
- printf("}\n");
+ fprintf(fp, " ");
+ fprintf(fp, "}\n");
} while (!list_done(tree, node));
}
@@ -909,7 +917,14 @@ _print_resource_tree(resource_node_t **tree, int level)
void
print_resource_tree(resource_node_t **tree)
{
- _print_resource_tree(tree, 0);
+ _print_resource_tree(stdout, tree, 0);
+}
+
+
+void
+dump_resource_tree(FILE *fp, resource_node_t **tree)
+{
+ _print_resource_tree(fp, tree, 0);
}
diff --git a/rgmanager/src/daemons/test.c b/rgmanager/src/daemons/test.c
index 3c487c9..ad1384d 100644
--- a/rgmanager/src/daemons/test.c
+++ b/rgmanager/src/daemons/test.c
@@ -104,9 +104,8 @@ rules_func(int __attribute__((unused)) argc,
} while (!list_done(&rulelist, currule));
fprintf(stderr, "Loaded %d resource rules\n",
rules);
- list_do(&rulelist, currule) {
- print_resource_rule(currule);
- } while (!list_done(&rulelist, currule));
+
+ print_resource_rules(&rulelist);
destroy_resource_rules(&rulelist);
@@ -156,9 +155,7 @@ test_func(int argc, char **argv)
if (reslist) {
printf("=== Resources List ===\n");
- list_do(&reslist, curres) {
- print_resource(curres);
- } while (!list_done(&reslist, curres));
+ print_resources(&reslist);
}
if (tree) {
diff --git a/rgmanager/src/daemons/tests/test012.conf b/rgmanager/src/daemons/tests/test012.conf
index 939b455..a003ed3 100644
--- a/rgmanager/src/daemons/tests/test012.conf
+++ b/rgmanager/src/daemons/tests/test012.conf
@@ -23,7 +23,7 @@
<script ref="initscript"/>
<fs ref="mount1">
<nfsexport ref="Dummy Export">
- <nfsclient ref="Admin group"/>
+ <nfsclient ref="Admin group" __enforce_timeouts="1" />
<nfsclient ref="User group"/>
<nfsclient ref="red"/>
</nfsexport>
14 years, 5 months