gfs2-utils: master - libgfs2: Push down die() into the utils and remove it
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 00f85a57f9de022ea75eeaa33fd9f022d0f43afe
Parent: e714cbd97363be03365cc4ea26e4cb58ac3a333e
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Dec 14 16:09:37 2011 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Dec 14 16:16:50 2011 +0000
libgfs2: Push down die() into the utils and remove it
This patch removes the definition of die() from libgfs2.h and pushes it
down into the utils which still require it. In the case of gfs2_convert,
which only had a few die() calls, it was dropped altogether.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 18 ++++++++++++------
gfs2/edit/hexedit.h | 12 ++++++++++++
gfs2/fsck/util.c | 1 +
gfs2/libgfs2/libgfs2.h | 12 ------------
gfs2/mkfs/gfs2_mkfs.h | 13 +++++++++++++
gfs2/quota/gfs2_quota.h | 13 +++++++++++++
gfs2/tool/gfs2_tool.h | 13 +++++++++++++
7 files changed, 64 insertions(+), 18 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 09a689c..ff5f50f 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1847,8 +1847,10 @@ static void update_inode_file(struct gfs2_sbd *sdp)
buf = cpu_to_be64(sdp->md.next_inum);
count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("update_inode_file\n");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "update_inode_file\n");
+ exit(1);
+ }
log_debug(_("\nNext Inum: %llu\n"), (unsigned long long)sdp->md.next_inum);
}/* update_inode_file */
@@ -1869,8 +1871,10 @@ static void write_statfs_file(struct gfs2_sbd *sdp)
gfs2_statfs_change_out(&sc, buf);
count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
- if (count != sizeof(struct gfs2_statfs_change))
- die("do_init (2)\n");
+ if (count != sizeof(struct gfs2_statfs_change)) {
+ fprintf(stderr, "do_init (2)\n");
+ exit(1);
+ }
}/* write_statfs_file */
/* ------------------------------------------------------------------------- */
@@ -2043,8 +2047,10 @@ static void copy_quotas(struct gfs2_sbd *sdp)
int err;
err = gfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
- if (err)
- die(_("Couldn't lookup new quota file: %d\n"), err);
+ if (err) {
+ fprintf(stderr, _("Couldn't lookup new quota file: %d\n"), err);
+ exit(1);
+ }
gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_quota_di);
oq_ip = inode_read(sdp, inum.no_addr);
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 27950b0..b05b5c0 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -124,6 +124,18 @@ static inline int block_is_rgtree(void)
#define SCREEN_HEIGHT (16)
#define SCREEN_WIDTH (16)
+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
/* Memory macros */
#define type_alloc(ptr, type, count) \
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index d912920..f37fe7d 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <stdio.h>
+#include <stdarg.h>
#include <termios.h>
#include <libintl.h>
#include <ctype.h>
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c356bbf..0e521fb 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -3,7 +3,6 @@
#include <features.h>
#include <inttypes.h>
-#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
@@ -86,17 +85,6 @@ struct lgfs2_dev_info {
uint64_t size;
};
-static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
-void die(const char *fmt, ...)
-{
- va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- exit(-1);
-}
-
struct device {
uint64_t length;
};
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index 6f0ac2b..d7d7da7 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_MKFS_DOT_H__
#define __GFS2_MKFS_DOT_H__
+#include <stdarg.h>
#include <linux/gfs2_ondisk.h>
#include "osi_list.h"
#include "copyright.cf"
@@ -18,6 +19,18 @@ extern void main_mkfs(int argc, char *argv[]);
/* main_shrink */
extern void main_shrink(int argc, char *argv[]);
+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
/*
* The following inode IOCTL macros and inode flags
* are copied from linux/fs.h, because we have duplicate
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 80c0d3f..744f02b 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_QUOTA_DOT_H__
#define __GFS2_QUOTA_DOT_H__
+#include <stdarg.h>
#include "libgfs2.h"
#include <linux/gfs2_ondisk.h>
@@ -79,4 +80,16 @@ void do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline);
uint32_t name_to_id(int user, char *name, int numbers);
char *id_to_name(int user, uint32_t id, int numbers);
+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
#endif /* __GFS2_QUOTA_DOT_H__ */
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
index 884856f..3a181ff 100644
--- a/gfs2/tool/gfs2_tool.h
+++ b/gfs2/tool/gfs2_tool.h
@@ -1,6 +1,7 @@
#ifndef __GFS2_TOOL_DOT_H__
#define __GFS2_TOOL_DOT_H__
+#include <stdarg.h>
#define OUTPUT_BLOCKS 0
#define OUTPUT_K 1
@@ -48,4 +49,16 @@ void do_sb(int argc, char **argv);
void get_tune(int argc, char **argv);
void set_tune(int argc, char **argv);
+/* die() used to be in libgfs2.h */
+static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
+void die(const char *fmt, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", __FILE__);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(-1);
+}
+
#endif /* __GFS2_TOOL_DOT_H__ */
12 years, 3 months
gfs2-utils: master - libgfs2: Expand out calls to die()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: e714cbd97363be03365cc4ea26e4cb58ac3a333e
Parent: 6dc017bb81e97b4beaf9402207ba4f945990e35f
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Dec 14 15:10:36 2011 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Dec 14 15:16:35 2011 +0000
libgfs2: Expand out calls to die()
Expand out the calls to die() to prepare for the removal of the function
from libgfs2.h
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/fs_ops.c | 67 ++++++++++++++++++++++++++++++++-----------------
gfs2/libgfs2/gfs1.c | 12 ++++++---
2 files changed, 52 insertions(+), 27 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index e2e64d6..befa25a 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -136,8 +136,10 @@ static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
break;
}
- if (n == NULL)
- die("out of space\n");
+ if (n == NULL) {
+ fprintf(stderr, "out of space\n");
+ exit(1);
+ }
ri = &rl->ri;
rg = &rl->rg;
@@ -155,15 +157,18 @@ static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
}
}
- die("allocation is broken (1): %"PRIu64" %u\n",
+ fprintf(stderr, "allocation is broken (1): %"PRIu64" %u\n",
(uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
+ exit(1);
found:
- if (bn >= ri->ri_bitbytes * GFS2_NBBY)
- die("allocation is broken (2): bn: %u %u rgrp: %"PRIu64
+ if (bn >= ri->ri_bitbytes * GFS2_NBBY) {
+ fprintf(stderr, "allocation is broken (2): bn: %u %u rgrp: %"PRIu64
" (0x%" PRIx64 ") Free:%u\n",
bn, ri->ri_bitbytes * GFS2_NBBY, (uint64_t)rl->ri.ri_addr,
(uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
+ exit(1);
+ }
switch (type) {
case DATA:
@@ -175,7 +180,8 @@ found:
rg->rg_dinodes++;
break;
default:
- die("bad state\n");
+ fprintf(stderr, "bad state\n");
+ exit(1);
}
bh->b_data[x] &= ~(0x03 << (GFS2_BIT_SIZE * y));
@@ -684,8 +690,10 @@ struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
unstuff_dinode(ip);
block_map(ip, lbn, &new, &dbn, NULL, prealloc);
- if (!dbn)
- die("get_file_buf\n");
+ if (!dbn) {
+ fprintf(stderr, "get_file_buf\n");
+ exit(1);
+ }
if (!prealloc && new &&
ip->i_di.di_size < (lbn + 1) << sdp->sd_sb.sb_bsize_shift) {
@@ -841,8 +849,10 @@ void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
return gfs_get_leaf_nr(dip, lindex, leaf_out);
count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("gfs2_get_leaf_nr: Bad internal read.\n");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "gfs2_get_leaf_nr: Bad internal read.\n");
+ exit(1);
+ }
*leaf_out = be64_to_cpu(leaf_no);
}
@@ -859,8 +869,10 @@ void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
leaf_no = cpu_to_be64(leaf_out);
count = gfs2_writei(dip, (char *)&leaf_no, inx * sizeof(uint64_t),
sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("gfs2_put_leaf_nr: Bad internal write.\n");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "gfs2_put_leaf_nr: Bad internal write.\n");
+ exit(1);
+ }
}
static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
@@ -912,8 +924,10 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
else
count = gfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
half_len * sizeof(uint64_t));
- if (count != half_len * sizeof(uint64_t))
- die("dir_split_leaf (2)\n");
+ if (count != half_len * sizeof(uint64_t)) {
+ fprintf(stderr, "dir_split_leaf (2)\n");
+ exit(1);
+ }
free(lp);
@@ -930,8 +944,10 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
be32_to_cpu(dent->de_hash) < divider) {
name_len = be16_to_cpu(dent->de_name_len);
- if (dirent_alloc(dip, nbh, name_len, &new))
- die("dir_split_leaf (3)\n");
+ if (dirent_alloc(dip, nbh, name_len, &new)) {
+ fprintf(stderr, "dir_split_leaf (3)\n");
+ exit(1);
+ }
new->de_inum = dent->de_inum;
new->de_hash = dent->de_hash;
@@ -954,8 +970,10 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
} while (dent);
if (!moved) {
- if (dirent_alloc(dip, nbh, 0, &new))
- die("dir_split_leaf (4)\n");
+ if (dirent_alloc(dip, nbh, 0, &new)) {
+ fprintf(stderr, "dir_split_leaf (4)\n");
+ exit(1);
+ }
new->de_inum.no_formal_ino = 0;
/* Don't count the sentinel dirent as an entry */
dip->i_di.di_entries--;
@@ -993,8 +1011,10 @@ static void dir_double_exhash(struct gfs2_inode *dip)
count = gfs2_readi(dip, (char *)buf,
block * sdp->sd_hash_bsize,
sdp->sd_hash_bsize);
- if (count != sdp->sd_hash_bsize)
- die("dir_double_exhash (1)\n");
+ if (count != sdp->sd_hash_bsize) {
+ fprintf(stderr, "dir_double_exhash (1)\n");
+ exit(1);
+ }
from = buf;
to = (uint64_t *)((char *)buf + sdp->sd_hash_bsize);
@@ -1012,9 +1032,10 @@ static void dir_double_exhash(struct gfs2_inode *dip)
count = gfs2_writei(dip, (char *)buf +
sdp->sd_hash_bsize,
block * sdp->bsize, sdp->bsize);
- if (count != sdp->bsize)
- die("dir_double_exhash (2)\n");
-
+ if (count != sdp->bsize) {
+ fprintf(stderr, "dir_double_exhash (2)\n");
+ exit(1);
+ }
}
free(buf);
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 4549959..8e3fc93 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -403,8 +403,10 @@ void gfs_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("gfs_get_leaf_nr: Bad internal read.\n");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "gfs_get_leaf_nr: Bad internal read.\n");
+ exit(1);
+ }
*leaf_out = be64_to_cpu(leaf_no);
}
@@ -417,6 +419,8 @@ void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
leaf_no = cpu_to_be64(leaf_out);
count = gfs1_writei(dip, (char *)&leaf_no, inx * sizeof(uint64_t),
sizeof(uint64_t));
- if (count != sizeof(uint64_t))
- die("gfs_put_leaf_nr: Bad internal write.\n");
+ if (count != sizeof(uint64_t)) {
+ fprintf(stderr, "gfs_put_leaf_nr: Bad internal write.\n");
+ exit(1);
+ }
}
12 years, 3 months
gfs2-utils: the annotated tag 3.1.3 has been created
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 6b376842d713f0cbc6fe9536ec77c70fbb92df04
Parent: 0000000000000000000000000000000000000000
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 2011-12-13 15:44 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: 2011-12-13 15:44 +0000
annotated tag: 3.1.3 has been created
at 6b376842d713f0cbc6fe9536ec77c70fbb92df04 (tag)
tagging 6dc017bb81e97b4beaf9402207ba4f945990e35f (commit)
replaces 3.1.2
Version 3.1.3
Abhi Das (2):
Revert "mount.gfs2 - gfs2 mounts doubled up in mtab"
mount.gfs2 - gfs2 mounts doubled up in mtab
Abhijith Das (1):
mount.gfs2 - gfs2 mounts doubled up in mtab
Andrew Price (16):
mkfs: Handle gfs2 creation on regular files
gfs2-utils: Update .gitignore for i18n files
tunegfs2: Add some malloc error checking
gfs2_edit: Initialize metafds fully in savemetaopen
libgfs2: clean up some dead code in gfs2_writei
libgfs2: Remove dead code from gfs2_get_leaf
gfs_controld: Remove dead code from loop()
gfs2_edit: Fix segfault in find by resource group
libgfs2: Fix null pointer dereference in linked_leaf_search
gfs2_edit: Fix zeroing the memory for indirect
gfs_controld: Fix if-statement in shutdown_callback
libgfs2: Fix pointer arithmetic in gfs2_quota_change_*
libgfs2: Don't count sentinel dirent as an entry
mkfs.gfs2: Some minor cleanups
libgfs2: Improve rgblocks2bitblocks()
gfs2-utils: Add gfs2-cluster systemd unit
Bob Peterson (68):
fsck.gfs2: Make functions use sdp rather than sbp
fsck.gfs2: Change "if(" to "if ("
libgfs1: Add gfs1 variable to superblock structure
libgfs2: Make check_sb and read_sb operate on gfs1
libgfs2: move gfs1 structures to libgfs2
fsck.gfs2: Check for blocks wrongly inside resource groups
fsck.gfs2: Rename check_leaf to check_ealeaf_block
fsck.gfs2: fsck.gfs2: Delete vestigial buffer_head in check_leaf
fsck.gfs2: fsck.gfs2: Rename nlink functions to be intuitive
fsck.gfs2: fsck.gfs2: Sync di_nlink adding links for lost+found
fsck.gfs2: fsck.gfs2: Make dir entry count 32 bits
fsck.gfs2: get rid of triple negative logic
dirent_repair needs to mark the buffer as modified
fsck.gfs2: fsck.gfs2: Ask to reclaim unlinked meta per-rgrp only
fsck.gfs2: fsck.gfs2: Refactor add_dotdot function in lost+found
libgfs2: libgfs2: Use __FUNCTION__ rather than __FILE__
fsck.gfs2: fsck.gfs2: Don't stop invalidating blocks on invalid
fsck.gfs2: fsck.gfs2: Find and clear duplicate leaf blocks refs
fsck.gfs2: fsck.gfs2: Move check_num_ptrs from metawalk to pass1
fsck.gfs2: fsck.gfs2: Duplicate ref processing for leaf blocks
fsck.gfs2: fsck.gfs2: split check_leaf_blks to be more readable
fsck.gfs2: Shorten output
fsck.gfs2: Make output messages more sensible
fsck.gfs pass2: Refactor function set_dotdor_dir
fsck.gfs2 pass2: Delete extended attributes with inode
fsck.gfs2 pass2: Don't delete invalid inode metadata
fsck.gfs2 pass3: Refactor mark_and_return_parent
fsck.gfs2: misc cosmetic changes
fsck.gfs2: Don't use old_leaf if it was a duplicate
fsck.gfs2: Add find_remove_dup, free_block_if_notdup
fsck.gfs2: don't free prev rgrp list repairing rgrps
libgfs2: eliminate gfs1_readi in favor of gfs2_readi
libgfs2: Mark buffer modified adding a new GFS1 block
libgfs2: Use dinode buffer to map gfs1 dinode blocks
libgfs2: move block_map functions to fsck.gfs2
libgfs2: eliminate gfs1_rindex_read
libgfs2: combine ri_update and gfs1_ri_update
libgfs2: combine gfs_inode_read and gfs_inode_get
libgfs2: move gfs1 functions from edit to libgfs2
gfs2_edit savemeta: save_inode_data backward for gfs1
libgfs2: expand capabilities to operate on gfs1
fsck.gfs2: Combine block and char device inode types
fsck.gfs2: four-step duplicate elimination process
fsck.gfs2: Add ability to check gfs1 file systems
fsck.gfs2: Remove bad inodes from duplicate tree
fsck.gfs2: Handle duplicate reference to dinode blocks
fsck.gfs2: Bad extended attributes not deleted
libgfs2: Make rebuild functions not re-read ip
fsck.gfs2: Shorten debug output
fsck.gfs2: Increment link count reporting wrong dinode
fsck.gfs2: system dinodes take priority over user dinodes
fsck.gfs2: Recognize partially gfs2-converted dinodes
fsck.gfs2: Print step 2 duplicate debug msg first
fsck.gfs2: pass1c counts percentage backward
fsck.gfs2: Speed up rangecheck functions
libgfs2: Make in-core rgrps use rbtree
fsck.gfs2: Fix memory leaks
gfs2_edit: Fix memory leaks
Change man pages and gfs2_convert messages to include GFS
fsck.gfs2: Journals not properly checked
fsck.gfs2: Rearrange block types to group all inode types
fsck.gfs2: Fix initialization error return codes
fsck.gfs2: Don't use strerror for libgfs2 errors
fsck.gfs2: Fix memory leak in initialize.c
fsck.gfs2: Add return code checks and initializations
gfs2_edit: Fix segfault jumping within rindex
libgfs2: Fix off-by-one error in rgrp searching
gfs2-utils: gfs2_grow fails to grow a filesystem with less than 3 RGs
Carlos Maiolino (10):
libgfs2: Add new RGSIZE macros
mkfs: Change hardcoded numbers by new macro definitions
i18n: strings review
mkfs: Use rpmatch() to yes/no questions
mkfs: Remove unneeded open/close fd test from are_you_sure()
mkfs: remove duplicated code to ask yes/no question
mkfs: fix error handling
gfs2_grow: fix error handling, i18n strings
gfs2_jadd: Fix error handlers
fsck: Merge strings
David Teigland (2):
gfs_controld: track membership changes
gfs_controld: don't ignore dlmc_fs_register error
Steven Whitehouse (12):
tunegfs2: Fix usage and ensure we don't try to open a null device
tunegfs2: Fix label/locktable setting code
libgfs2: Move generic_interrupt() into utils
libgfs2: Move gfs2_getch into utils
libgfs2: Prepare to remove log_xxx() macros from library
libgfs2: Move some debug messages out into mkfs/fsck
libgfs2: Clean up sb read/check functions
libgfs2: Remove some more log_xxx calls
libgfs2: Clean up device geometry code
libgfs2: More unused bits (re)moved
libgfs2: Remove more unused macros/functions
gfs2_edit: Fix signal handling and window resize
12 years, 3 months
gfs2-utils: master - gfs2_edit: Fix signal handling and window resize
by Steven Whitehouse
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 6dc017bb81e97b4beaf9402207ba4f945990e35f
Parent: 72f66b2798c5f8edffba3bcb0722e2a85e0807f0
Author: Steven Whitehouse <swhiteho(a)redhat.com>
AuthorDate: Tue Dec 6 18:00:54 2011 +0000
Committer: Steven Whitehouse <swhiteho(a)redhat.com>
CommitterDate: Tue Dec 13 15:03:49 2011 +0000
gfs2_edit: Fix signal handling and window resize
This started out as a patch to remove the signal() call from this
bit of code, but when I started looking in more detail, I
spotted several other things which were wrong, so I fixed
those instead.
Firstly ncurses has its own SIGWINCH handler these days, so
we should not be overriding it, but instead, getting the info
about resize at getch() time.
Secondly, the function for erasing the screen was using the
supposed number of columns to index an array which was only 256
in length, so although unlikely to happen in real life, this
could cause an out of bounds access.
The simple solution seems to be to use ncurses own functions.
I noted some comments about them not working correctly, but
with the additional setting of the background attributes,
that seemed to work ok to me, unless I'm missing something.
I've played around resizing the window and the like and it
all seems to still be working correctly.
Signed-off-by: Steven Whitehouse <swhiteho(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 1 -
gfs2/edit/hexedit.c | 54 ++++++++++----------------------------------------
gfs2/edit/hexedit.h | 1 -
3 files changed, 11 insertions(+), 45 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 5616122..41630f9 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -56,7 +56,6 @@ int start_row[DMODES], end_row[DMODES], lines_per_row[DMODES];
struct gfs_sb *sbd1;
int gfs2_struct_type;
unsigned int offset;
-int termcols = 80;
struct indirect_info masterdir;
struct gfs2_inum gfs1_quota_di;
int print_entry_ndx;
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 267e8ca..052be4c 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -42,6 +42,7 @@ struct gfs2_log_descriptor *lld;
int pgnum;
int details = 0;
long int gziplevel = 9;
+static int termcols;
int display(int identify_only);
@@ -742,50 +743,14 @@ static int gfs2_qc_assignval(struct gfs2_quota_change *qc,
return -1;
}
-/* ------------------------------------------------------------------------ */
-/* UpdateSize - screen size changed, so update it */
-/* ------------------------------------------------------------------------ */
-static void UpdateSize(int sig)
-{
- static char term_buffer[2048];
- int rc;
-
- termlines = 30;
- termtype = getenv("TERM");
- if (termtype == NULL)
- return;
- rc=tgetent(term_buffer,termtype);
- if (rc>=0) {
- termlines = tgetnum((char *)"li");
- if (termlines < 10)
- termlines = 30;
- termcols = tgetnum((char *)"co");
- if (termcols < 80)
- termcols = 80;
- }
- else
- perror("Error: tgetent failed.");
- termlines--; /* last line is number of lines -1 */
- display(FALSE);
- signal(SIGWINCH, UpdateSize);
-}
-
/* ------------------------------------------------------------------------- */
/* erase - clear the screen */
/* ------------------------------------------------------------------------- */
static void Erase(void)
{
- int i;
- char spaces[256];
-
- memset(spaces, ' ', sizeof(spaces));
- spaces[termcols] = '\0';
- for (i = 0; i < termlines; i++) {
- move(i, 0);
- printw(spaces);
- }
- /*clear(); doesn't set background correctly */
- /*erase();*/
+ bkgd(A_NORMAL|COLOR_PAIR(COLOR_NORMAL));
+ /* clear();*/ /* doesn't set background correctly */
+ erase();
/*bkgd(bg);*/
}
@@ -2708,10 +2673,9 @@ static void interactive_mode(void)
eol(0);
exit(-1);
}
-
+ getmaxyx(stdscr, termlines, termcols);
+ termlines--;
/* Do our initial screen stuff: */
- signal(SIGWINCH, UpdateSize); /* handle the terminal resize signal */
- UpdateSize(0); /* update screen size based on terminal settings */
clear(); /* don't use Erase */
start_color();
noecho();
@@ -2934,11 +2898,15 @@ static void interactive_mode(void)
/* --------------------------------------------------------- */
/* enter key - change a value */
/* --------------------------------------------------------- */
- case(KEY_ENTER):
+ case KEY_ENTER:
case('\n'):
case('\r'):
editing = !editing;
break;
+ case KEY_RESIZE:
+ getmaxyx(stdscr, termlines, termcols);
+ termlines--;
+ break;
default:
move(termlines - 1, 0);
printw("Keystroke not understood: 0x%03x",ch);
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 02281cf..27950b0 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -38,7 +38,6 @@ extern uint64_t dev_offset;
extern uint64_t max_block;
extern struct gfs2_buffer_head *bh;
extern int termlines;
-extern int termcols;
extern int insert;
extern const char *termtype;
extern int line;
12 years, 3 months
gfs2-utils: master - libgfs2: Remove more unused macros/functions
by Steven Whitehouse
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 72f66b2798c5f8edffba3bcb0722e2a85e0807f0
Parent: 4761a8a1bd6435c24f13a10202a3f77f820abfab
Author: Steven Whitehouse <swhiteho(a)redhat.com>
AuthorDate: Tue Dec 13 14:58:07 2011 +0000
Committer: Steven Whitehouse <swhiteho(a)redhat.com>
CommitterDate: Tue Dec 13 14:58:07 2011 +0000
libgfs2: Remove more unused macros/functions
Two macros in lingfs2.h, bsync and bcommit referred to functions
which no longer exist, so this removes them.
The __bget_generic function was exported, but only ever used
internally to libgfs2, so that is unexported and split
between the two functions which called it, since both had
differing requirements, anyway. This also means that we
can remove the bget wrapper for __bget since this part made
no use of the passed in function name and line number
anyway.
There should be no resulting change in function after this
patch, but another 20 lines of unused code has been removed.
Signed-off-by: Steven Whitehouse <swhiteho(a)redhat.com>
---
gfs2/libgfs2/buf.c | 48 ++++++++++++++++++++----------------------------
gfs2/libgfs2/libgfs2.h | 13 +------------
2 files changed, 21 insertions(+), 40 deletions(-)
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index 9f074ad..445b0ba 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -14,9 +14,7 @@
#include "libgfs2.h"
-struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp, uint64_t num,
- int read_disk,
- int line, const char *caller)
+struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num)
{
struct gfs2_buffer_head *bh;
@@ -27,37 +25,31 @@ struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp, uint64_t num,
bh->b_blocknr = num;
bh->sdp = sdp;
bh->b_data = (char *)bh + sizeof(struct gfs2_buffer_head);
- if (read_disk) {
- if (lseek(sdp->device_fd, num * sdp->bsize, SEEK_SET) !=
- num * sdp->bsize) {
- fprintf(stderr, "bad seek: %s from %s:%d: block "
- "%llu (0x%llx)\n", strerror(errno),
- caller, line, (unsigned long long)num,
- (unsigned long long)num);
- exit(-1);
- }
- if (read(sdp->device_fd, bh->b_data, sdp->bsize) < 0) {
- fprintf(stderr, "bad read: %s from %s:%d: block "
- "%llu (0x%llx)\n", strerror(errno),
- caller, line, (unsigned long long)num,
- (unsigned long long)num);
- exit(-1);
- }
- }
-
return bh;
}
-struct gfs2_buffer_head *__bget(struct gfs2_sbd *sdp, uint64_t num, int line,
- const char *caller)
-{
- return __bget_generic(sdp, num, FALSE, line, caller);
-}
-
struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num, int line,
const char *caller)
{
- return __bget_generic(sdp, num, TRUE, line, caller);
+ struct gfs2_buffer_head *bh = bget(sdp, num);
+ if (bh == NULL)
+ return bh;
+ if (lseek(sdp->device_fd, num * sdp->bsize, SEEK_SET) !=
+ num * sdp->bsize) {
+ fprintf(stderr, "bad seek: %s from %s:%d: block "
+ "%llu (0x%llx)\n", strerror(errno),
+ caller, line, (unsigned long long)num,
+ (unsigned long long)num);
+ exit(-1);
+ }
+ if (read(sdp->device_fd, bh->b_data, sdp->bsize) < 0) {
+ fprintf(stderr, "bad read: %s from %s:%d: block "
+ "%llu (0x%llx)\n", strerror(errno),
+ caller, line, (unsigned long long)num,
+ (unsigned long long)num);
+ exit(-1);
+ }
+ return bh;
}
int bwrite(struct gfs2_buffer_head *bh)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ef11221..c356bbf 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -285,12 +285,7 @@ extern void gfs2_special_clear(struct special_blocks *blocklist,
uint64_t block);
/* buf.c */
-extern struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp,
- uint64_t num,
- int read_disk, int line,
- const char *caller);
-extern struct gfs2_buffer_head *__bget(struct gfs2_sbd *sdp, uint64_t num,
- int line, const char *caller);
+extern struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num);
extern struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num,
int line, const char *caller);
extern int bwrite(struct gfs2_buffer_head *bh);
@@ -298,13 +293,7 @@ extern int brelse(struct gfs2_buffer_head *bh);
#define bmodified(bh) do { bh->b_modified = 1; } while(0)
-#define bget_generic(bl, num, find, read) __bget_generic(bl, num, find, read, \
- __LINE__, \
- __FUNCTION__)
-#define bget(bl, num) __bget(bl, num, __LINE__, __FUNCTION__)
#define bread(bl, num) __bread(bl, num, __LINE__, __FUNCTION__)
-#define bsync(bl) do { __bsync(bl, __LINE__, __FUNCTION__); } while(0)
-#define bcommit(bl) do { __bcommit(bl, __LINE__, __FUNCTION__); } while(0)
/* device_geometry.c */
extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);
12 years, 3 months
gfs2-utils: master - gfs2-utils: Add gfs2-cluster systemd unit
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 4761a8a1bd6435c24f13a10202a3f77f820abfab
Parent: 91f331d094994cd33abcdca84e7e2989f44170fe
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Dec 13 13:58:49 2011 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Tue Dec 13 14:19:23 2011 +0000
gfs2-utils: Add gfs2-cluster systemd unit
Adds a systemd unit file to start gfs_controld at the correct point in
the boot sequence. I've tested this as much as I can on Fedora 16 but it
may require some more tweaking once the init scripts for cman, clvmd,
etc. have been migrated. The gfs2 init script has not been migrated as
systemd should now handle mounting of gfs2 file systems specially, after
remote-fs-pre.target.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/system/gfs2-cluster.service | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/gfs2/system/gfs2-cluster.service b/gfs2/system/gfs2-cluster.service
new file mode 100644
index 0000000..d6bc0ca
--- /dev/null
+++ b/gfs2/system/gfs2-cluster.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=GFS2 Control Daemon
+After=syslog.target network.target cman.service
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/gfs_controld $OPTIONS
+
+[Install]
+WantedBy=multi-user.target
12 years, 3 months
fence-agents: the annotated tag v3.1.7 has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 7c05c17ada1c7441e315a3013c0e6c8034c7a04a
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2011-12-12 12:14 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2011-12-12 12:14 +0000
annotated tag: v3.1.7 has been created
at 7c05c17ada1c7441e315a3013c0e6c8034c7a04a (tag)
tagging 9df455796b3a1298ec2f47935847d6e195b51058 (commit)
replaces v3.1.6
v3.1.7 release
Marek 'marx' Grac (5):
fencing-agents: Add metadata output for fence agents in perl
fence_rsb: Fence agent ported to fencing library
fence_vmware_soap: Support for alias names as ports
fence_rackswitch: Add metadata output for fence_rackswitch agent
fence_rackswitch: Add metadata generation for C-based fence agents
12 years, 3 months
fence-agents: master - fence_rackswitch: Add metadata generation for C-based fence agents
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 9df455796b3a1298ec2f47935847d6e195b51058
Parent: 68fad86de38494cd0927174da0a62732e89be1ff
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Dec 9 10:05:31 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Dec 9 10:05:31 2011 +0100
fence_rackswitch: Add metadata generation for C-based fence agents
This should be part of previous patch: fence_rackswitch: Add metadata output for fence_rackswitch agent
Resolves: rhbz#714841 (partial)
---
fence/agents/ipmilan/Makefile.am | 15 +++++++--------
fence/agents/rackswitch/Makefile.am | 9 +++------
make/fencemanc.mk | 2 +-
3 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/fence/agents/ipmilan/Makefile.am b/fence/agents/ipmilan/Makefile.am
index 4868dc6..f237f92 100644
--- a/fence/agents/ipmilan/Makefile.am
+++ b/fence/agents/ipmilan/Makefile.am
@@ -1,17 +1,16 @@
MAINTAINERCLEANFILES = Makefile.in
-sbin_PROGRAMS = fence_ipmilan
+TARGET = fence_ipmilan
+
+sbin_PROGRAMS = $(TARGET)
noinst_HEADERS = expect.h
fence_ipmilan_SOURCES = expect.c ipmilan.c
-man_MANS = fence_ipmilan.8
+dist_man_MANS = $(TARGET).8
-fence_ipmilan.8: fence_ipmilan $(top_srcdir)/fence/agents/lib/fence2man.xsl
- set -e && \
- ./$^ -o metadata > .$@.tmp && \
- xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
+include $(top_srcdir)/make/fencemanc.mk
-clean-local:
- rm -f *.8 .*.8.tmp
+clean-local: clean-man
+ rm -f $(TARGET)
diff --git a/fence/agents/rackswitch/Makefile.am b/fence/agents/rackswitch/Makefile.am
index b6369e4..d2c9e1f 100644
--- a/fence/agents/rackswitch/Makefile.am
+++ b/fence/agents/rackswitch/Makefile.am
@@ -10,10 +10,7 @@ fence_rackswitch_SOURCES = do_rack.c
dist_man_MANS = $(TARGET).8
-fence_rackswitch.8: fence_rackswitch $(top_srcdir)/fence/agents/lib/fence2man.xsl
- set -e && \
- ./$^ -o metadata > .$@.tmp && \
- xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
+include $(top_srcdir)/make/fencemanc.mk
-clean-local:
- rm -f *.8 .*.8.tmp
\ No newline at end of file
+clean-local: clean-man
+ rm -f $(TARGET)
\ No newline at end of file
diff --git a/make/fencemanc.mk b/make/fencemanc.mk
index 70ee773..9c904b6 100644
--- a/make/fencemanc.mk
+++ b/make/fencemanc.mk
@@ -1,6 +1,6 @@
%.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
set -e && \
- ./$(TARGET) -o metadata > .$@.tmp && \
+ ./$^ -o metadata > .$@.tmp && \
xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
clean-man:
12 years, 3 months
fence-agents: master - fence_rackswitch: Add metadata output for fence_rackswitch agent
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 68fad86de38494cd0927174da0a62732e89be1ff
Parent: db314d3957b2c17b6e3bcc035f2738b771631bdd
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Dec 9 10:01:18 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Dec 9 10:01:18 2011 +0100
fence_rackswitch: Add metadata output for fence_rackswitch agent
Adding this feature allow us to generate manual pages directly from XML,
so both GUI tools and manual pages can see same feature.
Makefile for fence_ipmilan is modified because it can reuse same snippets
Resolves: rhbz#714841 (partial)
---
fence/agents/rackswitch/Makefile.am | 8 +++
fence/agents/rackswitch/do_rack.c | 46 ++++++++++++++++++-
fence/agents/rackswitch/fence_rackswitch.8 | 70 ----------------------------
make/fencemanc.mk | 7 +++
4 files changed, 60 insertions(+), 71 deletions(-)
diff --git a/fence/agents/rackswitch/Makefile.am b/fence/agents/rackswitch/Makefile.am
index 29cbef8..b6369e4 100644
--- a/fence/agents/rackswitch/Makefile.am
+++ b/fence/agents/rackswitch/Makefile.am
@@ -9,3 +9,11 @@ noinst_HEADERS = do_rack.h
fence_rackswitch_SOURCES = do_rack.c
dist_man_MANS = $(TARGET).8
+
+fence_rackswitch.8: fence_rackswitch $(top_srcdir)/fence/agents/lib/fence2man.xsl
+ set -e && \
+ ./$^ -o metadata > .$@.tmp && \
+ xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
+
+clean-local:
+ rm -f *.8 .*.8.tmp
\ No newline at end of file
diff --git a/fence/agents/rackswitch/do_rack.c b/fence/agents/rackswitch/do_rack.c
index 854b475..67d24a2 100644
--- a/fence/agents/rackswitch/do_rack.c
+++ b/fence/agents/rackswitch/do_rack.c
@@ -158,6 +158,40 @@ static void print_usage(void)
+static void print_metadata(void)
+{
+ printf("<?xml version=\"1.0\" ?>\n"
+ "<resource-agent name=\"fence_rackswitch\" shortdesc=\"fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch\" >\n"
+ "<longdesc>fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver RackSwitch. It logs into the RackSwitch and boots a specified plug. Using the http interface to the RackSwitch should be avoided while a GFS cluster is running because the connection may interfere with the operation of this agent.</longdesc>\n"
+ "<vendor-url>http://www.bladenetwork.net</vendor-url>\n"
+ "<parameters>\n"
+ "<parameter name=\"ipaddr\" unique=\"1\" required=\"1\">\n"
+ "\t<getopt mixed=\"-a <ip>\" />\n"
+ "\t<content type=\"string\" />\n"
+ "\t<shortdesc lang=\"en\">IP Address or Hostname</shortdesc>\n"
+ "</parameter>\n"
+ "<parameter name=\"login\" unique=\"1\" required=\"1\">\n"
+ "\t<getopt mixed=\"-l <name>\" />\n"
+ "\t<content type=\"string\" />\n"
+ "\t<shortdesc lang=\"en\">Login Name</shortdesc>\n"
+ "</parameter>\n"
+ "<parameter name=\"passwd\" unique=\"1\" required=\"0\">\n"
+ "\t<getopt mixed=\"-p <password>\" />\n"
+ "\t<content type=\"string\" />\n"
+ "\t<shortdesc lang=\"en\">Login password or passphrase</shortdesc>\n"
+ "</parameter>\n"
+ "<parameter name=\"passwd_script\" unique=\"1\" required=\"0\">\n"
+ "\t<getopt mixed=\"-S <script>\" />\n"
+ "\t<content type=\"string\" />\n"
+ "\t<shortdesc lang=\"en\">Script to retrieve password</shortdesc>\n"
+ "</parameter>\n"
+ "</parameters>\n"
+ "<actions>\n"
+ "\t<action name=\"metadata\" />\n"
+ "</actions>\n"
+ "</resource-agent>\n");
+}
+
static void get_options(int argc, char **argv)
{
int c;
@@ -167,7 +201,7 @@ static void get_options(int argc, char **argv)
/*
* Command line input
*/
- while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVd")) != -1)
+ while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVdo:")) != -1)
{
switch(c)
{
@@ -220,6 +254,16 @@ static void get_options(int argc, char **argv)
fprintf(stderr, "Please use '-h' for usage.\n");
exit(DID_FAILURE);
break;
+
+ case 'o':
+ if (strncasecmp(optarg, "metadata", 254) == 0) {
+ print_metadata();
+ exit(DID_SUCCESS);
+ } else {
+ fprintf(stderr, "Only 'metadata' option is aviable for this fence agent\n");
+ exit(DID_FAILURE);
+ }
+ break;
default:
fprintf(stderr, "Bad programmer! You forgot to catch the %c flag\n", c);
diff --git a/fence/agents/rackswitch/fence_rackswitch.8 b/fence/agents/rackswitch/fence_rackswitch.8
deleted file mode 100644
index fc64a79..0000000
--- a/fence/agents/rackswitch/fence_rackswitch.8
+++ /dev/null
@@ -1,70 +0,0 @@
-.TH fence_rackswitch 8
-
-.SH NAME
-fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch
-
-.SH SYNOPSIS
-.B
-fence_rackswitch
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver
-RackSwitch. It logs into the RackSwitch and boots a specified plug.
-Using the http interface to the RackSwitch should be avoided while a GFS cluster is
-running because the connection may interfere with the operation of this agent.
-
-fence_rackswitch accepts options on the command line as well as from stdin.
-fenced sends the options through stdin when it execs the agent. fence_rackswitch
-can be run by itself with command line options which is useful for testing.
-
-Vendor URL: http://www.bladenetwork.net
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-n\fP \fIplug\fP
-The plug number to power cycle.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-l\fP \fIusername\fP
-Username for login.
-.TP
-\fB-q\fP
-Quiet operation. Only print out error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_rackswitch.
-.TP
-\fIipaddr = < ip >\fR
-IP address of the switch.
-.TP
-\fIusername = < param >\fR
-Username for login.
-.TP
-\fIpassword = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port (outlet) number to act upon.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/make/fencemanc.mk b/make/fencemanc.mk
new file mode 100644
index 0000000..70ee773
--- /dev/null
+++ b/make/fencemanc.mk
@@ -0,0 +1,7 @@
+%.8: $(TARGET) $(top_srcdir)/fence/agents/lib/fence2man.xsl
+ set -e && \
+ ./$(TARGET) -o metadata > .$@.tmp && \
+ xsltproc $(top_srcdir)/fence/agents/lib/fence2man.xsl .$@.tmp > $@
+
+clean-man:
+ rm -f *.8 .*.8.tmp
12 years, 3 months
fence-agents: master - fence_vmware_soap: Support for alias names as ports
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: db314d3957b2c17b6e3bcc035f2738b771631bdd
Parent: 6f27315c0737a98395b7d905dc289ef3c344630b
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Dec 9 09:30:12 2011 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Dec 9 09:44:47 2011 +0100
fence_vmware_soap: Support for alias names as ports
Extending fence agent to support (-n / port) can use alias names of VM.
They can be obtained using 'list' action. This feature won't work correctly
if you have several VM with same name, in that case you should use either
full path or UUID.
Resolves: rhbz#715107
---
fence/agents/vmware_soap/fence_vmware_soap.py | 35 ++++++++++++++++--------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 2718560..f9344ff 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -94,18 +94,28 @@ def get_power_status(conn, options):
return machines
else:
if options.has_key("-U") == False:
- ## Transform InventoryPath to UUID
- mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
- mo_SearchIndex._type = "SearchIndex"
+ if options["-n"].startswith('/'):
+ ## Transform InventoryPath to UUID
+ mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
+ mo_SearchIndex._type = "SearchIndex"
- vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["-n"])
+ vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["-n"])
- try:
- options["-U"] = mappingToUUID[vm.value]
- except KeyError, ex:
- fail(EC_STATUS)
- except AttributeError, ex:
- fail(EC_STATUS)
+ try:
+ options["-U"] = mappingToUUID[vm.value]
+ except KeyError, ex:
+ fail(EC_STATUS)
+ except AttributeError, ex:
+ fail(EC_STATUS)
+ else:
+ ## Name of virtual machine instead of path
+ ## warning: if you have same names of machines this won't work correctly
+ try:
+ (options["-U"], _) = machines[options["-n"]]
+ except KeyError, ex:
+ fail(EC_STATUS)
+ except AttributeError, ex:
+ fail(EC_STATUS)
try:
if uuid[options["-U"]] == "poweredOn":
@@ -149,8 +159,9 @@ which can be used with the virtual machines managed by VMWare products \
that have SOAP API v4.1+. \
\n.P\n\
Name of virtual machine (-n / port) has to be used in inventory path \
-format (e.g. /datacenter/vm/Discovered virtual machine/myMachine). Alternatively \
-you can use UUID (-U / uuid) to access virtual machine."
+format (e.g. /datacenter/vm/Discovered virtual machine/myMachine). \
+In the cases when name of yours VM is unique you can use it instead. \
+Alternatively you can always use UUID (-U / uuid) to access virtual machine."
docs["vendorurl"] = "http://www.vmware.com"
show_docs(options, docs)
12 years, 3 months