gfs2-utils: master - mkfs.gfs2: Add options for stripe size and width
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=a3ab0821...
Commit: a3ab08213c87313ec899c114c23650d05268eef5
Parent: 457c8b6139c5c277db5a8b1a4a8d81aefeded05a
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Mar 1 15:56:58 2013 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Tue May 14 13:48:46 2013 +0100
mkfs.gfs2: Add options for stripe size and width
Add generic parsing of options passed in with -o and use it to accept
sunit and swidth options (names chosen to be the same as mkfs.xfs). We
don't do anything with these options yet.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 610a641..6471600 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -19,6 +19,7 @@
#include <sys/time.h>
#include <libintl.h>
#include <sys/ioctl.h>
+#include <limits.h>
#define _(String) gettext(String)
@@ -55,6 +56,7 @@ static void print_usage(const char *prog_name)
"-j", _("<number>"), _("Number of journals"),
"-K", NULL, _("Don't try to discard unused blocks"),
"-O", NULL, _("Don't ask for confirmation"),
+ "-o", _("<key>[=<value>][,...]"), _("Specify extended options"),
"-p", _("<name>"), _("Name of the locking protocol"),
"-q", NULL, _("Don't print anything"),
"-r", _("<size>"), _("Size of resource groups, in megabytes"),
@@ -73,7 +75,7 @@ static void print_usage(const char *prog_name)
option = options[i];
param = options[i+1];
desc = options[i+2];
- printf("%3s %-15s %s\n", option, param ? param : "", desc);
+ printf("%3s %-22s %s\n", option, param ? param : "", desc);
}
}
@@ -82,6 +84,8 @@ struct mkfs_opts {
unsigned qcsize;
unsigned jsize;
unsigned rgsize;
+ unsigned sunit;
+ unsigned swidth;
uint64_t fssize;
uint32_t journals;
const char *lockproto;
@@ -93,6 +97,8 @@ struct mkfs_opts {
unsigned got_qcsize:1;
unsigned got_jsize:1;
unsigned got_rgsize:1;
+ unsigned got_sunit:1;
+ unsigned got_swidth:1;
unsigned got_fssize:1;
unsigned got_journals:1;
unsigned got_lockproto:1;
@@ -145,11 +151,91 @@ static int discard_blocks(int fd, uint64_t len, int debug)
return 0;
}
+/**
+ * Convert a human-readable size string to a long long.
+ * Copied and adapted from xfs_mkfs.c.
+ */
+static long long cvtnum(unsigned int blocksize, unsigned int sectorsize, const char *s)
+{
+ long long i;
+ char *sp;
+
+ i = strtoll(s, &sp, 0);
+ if (i == 0 && sp == s)
+ return -1LL;
+ if (*sp == '\0')
+ return i;
+
+ *sp = tolower(*sp);
+ if (*sp == 'b' && sp[1] == '\0') {
+ if (blocksize)
+ return i * blocksize;
+ fprintf(stderr, _("Block size not available yet.\n"));
+ exit(1);
+ }
+ if (*sp == 's' && sp[1] == '\0') {
+ if (sectorsize)
+ return i * sectorsize;
+ return i * GFS2_BASIC_BLOCK;
+ }
+ if (*sp == 'k' && sp[1] == '\0')
+ return 1024LL * i;
+ if (*sp == 'm' && sp[1] == '\0')
+ return 1024LL * 1024LL * i;
+ if (*sp == 'g' && sp[1] == '\0')
+ return 1024LL * 1024LL * 1024LL * i;
+ if (*sp == 't' && sp[1] == '\0')
+ return 1024LL * 1024LL * 1024LL * 1024LL * i;
+ if (*sp == 'p' && sp[1] == '\0')
+ return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
+ if (*sp == 'e' && sp[1] == '\0')
+ return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
+ return -1LL;
+}
+
+static void parse_unsigned(struct mkfs_opts *opts, const char *key, const char *val, unsigned *n)
+{
+ long long l;
+ if (val == NULL || *val == '\0') {
+ fprintf(stderr, _("Missing argument to '%s'\n"), key);
+ exit(-1);
+ }
+ l = cvtnum(opts->bsize, 0, val);
+ if (l > UINT_MAX || l < 0) {
+ fprintf(stderr, _("Value of '%s' is invalid\n"), key);
+ exit(-1);
+ }
+ *n = (unsigned)l;
+}
+
+static void opt_parse_extended(char *str, struct mkfs_opts *opts)
+{
+ char *opt;
+ while ((opt = strsep(&str, ",")) != NULL) {
+ char *key = strsep(&opt, "=");
+ char *val = strsep(&opt, "=");
+ if (key == NULL || *key == '\0') {
+ fprintf(stderr, _("Missing argument to '-o' option\n"));
+ exit(-1);
+ }
+ if (strcmp("sunit", key) == 0) {
+ parse_unsigned(opts, "sunit", val, &opts->sunit);
+ opts->got_sunit = 1;
+ } else if (strcmp("swidth", key) == 0) {
+ parse_unsigned(opts, "swidth", val, &opts->swidth);
+ opts->got_swidth = 1;
+ } else {
+ fprintf(stderr, _("Invalid option '%s'\n"), key);
+ exit(-1);
+ }
+ }
+}
+
static void opts_get(int argc, char *argv[], struct mkfs_opts *opts)
{
int c;
while (1) {
- c = getopt(argc, argv, "-b:c:DhJ:j:KOp:qr:t:VX");
+ c = getopt(argc, argv, "-b:c:DhJ:j:KOo:p:qr:t:VX");
if (c == -1)
break;
@@ -197,6 +283,9 @@ static void opts_get(int argc, char *argv[], struct mkfs_opts *opts)
opts->rgsize = atoi(optarg);
opts->got_rgsize = 1;
break;
+ case 'o':
+ opt_parse_extended(optarg, opts);
+ break;
case 'V':
printf("mkfs.gfs2 %s (built %s %s)\n", VERSION,
__DATE__, __TIME__);
@@ -655,6 +744,8 @@ static void sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, struct lgfs2_
printf(" rgsize = %u\n", sdp->rgsize);
printf(" table = %s\n", sdp->locktable);
printf(" fssize = %"PRIu64"\n", opts->fssize);
+ printf(" sunit = %u\n", opts->sunit);
+ printf(" swidth = %u\n", opts->swidth);
}
}
@@ -673,6 +764,11 @@ void main_mkfs(int argc, char *argv[])
opts_init(&opts);
opts_get(argc, argv, &opts);
+ if (!opts.got_device) {
+ fprintf(stderr, _("No device specified. Use -h for help\n"));
+ exit(1);
+ }
+
fd = open(opts.device, O_RDWR | O_CLOEXEC);
if (fd < 0){
perror(opts.device);
10 years, 11 months
cluster: RHEL510 - fencing: Fix regression on fence_drac5
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=eaf31c53c82...
Commit: eaf31c53c822f73d31c4b4f2f586b27277ba9b10
Parent: be4ffa1bed23328a36b182b69c1c355abb7e16af
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon May 13 14:44:54 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon May 13 14:46:40 2013 +0200
fencing: Fix regression on fence_drac5
Autodetect of EOL was not working properly if --ssh/-x was used.
Resolves: rhbz#904195
---
configure | 8 ++++----
fence/agents/Makefile | 6 +++---
fence/agents/drac/fence_drac5.py | 8 ++++++++
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/configure b/configure
index 05fc58e..0bcbcc2 100755
--- a/configure
+++ b/configure
@@ -33,8 +33,8 @@ echo "configure gnbd"
echo "configure rgmanager"
(cd rgmanager; ./configure $@)
-echo "configure cmirror"
-(cd cmirror; ./configure $@)
+#echo "configure cmirror"
+#(cd cmirror; ./configure $@)
-echo "configure cmirror-kernel"
-(cd cmirror-kernel; ./configure $@)
+#echo "configure cmirror-kernel"
+#(cd cmirror-kernel; ./configure $@)
diff --git a/fence/agents/Makefile b/fence/agents/Makefile
index 669e291..e1d7eb4 100644
--- a/fence/agents/Makefile
+++ b/fence/agents/Makefile
@@ -33,7 +33,7 @@ all:
${MAKE} -C ipdu all
${MAKE} -C ipmilan all
${MAKE} -C lpar all
- ${MAKE} -C manual all
+# ${MAKE} -C manual all
${MAKE} -C mcdata all
# ${MAKE} -C rackswitch all
${MAKE} -C rhevm all
@@ -69,7 +69,7 @@ install: all
${MAKE} -C ipdu install
${MAKE} -C ipmilan install
${MAKE} -C lpar install
- ${MAKE} -C manual install
+# ${MAKE} -C manual install
${MAKE} -C mcdata install
# ${MAKE} -C rackswitch install
${MAKE} -C rhevm install
@@ -105,7 +105,7 @@ clean:
${MAKE} -C ipdu clean
${MAKE} -C ipmilan clean
${MAKE} -C lpar clean
- ${MAKE} -C manual clean
+# ${MAKE} -C manual clean
${MAKE} -C mcdata clean
# ${MAKE} -C rackswitch clean
${MAKE} -C rhevm clean
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index 298339f..7cc099a 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -52,7 +52,15 @@ def set_power_status(conn, options):
conn.send_eol("racadm serveraction " + action + " -m " + options["-m"])
elif options["model"] == "DRAC 5":
conn.send_eol("racadm serveraction " + action)
+
+ ## Fix issue with double-enter [CR/LF]
+ ## We need to read two additional command prompts (one from get + one from set command)
conn.log_expect(options, options["-c"], int(options["-g"]))
+ if len(conn.before.strip()) == 0:
+ options["eol"] = options["eol"][:-1]
+ conn.log_expect(options, options["-c"], int(options["-g"]))
+ conn.log_expect(options, options["-c"], int(options["-g"]))
+
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT:
10 years, 11 months
cluster: RHEL510 - fencing: Add support for APC with firmware 5.x
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=be4ffa1bed2...
Commit: be4ffa1bed23328a36b182b69c1c355abb7e16af
Parent: d45ceaa6e243733f801ce6aa8519d741a1801e34
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon May 13 14:35:30 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon May 13 14:35:30 2013 +0200
fencing: Add support for APC with firmware 5.x
Patch is based on a commit https://git.fedorahosted.org/cgit/fence-agents.git/commit/?id=dfff684d59a...
Resolves: rhbz#886612
---
fence/agents/apc/fence_apc.py | 53 +++++++++++++++++++++++++++++++++++++---
fence/agents/lib/fencing.py.py | 15 ++++++++++-
2 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 4125d39..a3a8f01 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -69,7 +69,7 @@ def get_power_status(conn, options):
conn.send_eol(options["-s"])
while True:
- exp_result = conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"]))
+ exp_result = conn.log_expect(options, options["-c"] + ["Press <ENTER>" ], int(options["-Y"]))
lines = conn.before.split("\n");
show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
@@ -152,7 +152,7 @@ def set_power_status(conn, options):
else:
conn.send_eol(options["-s"])
- while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"])):
+ while 1 == conn.log_expect(options, options["-c"] + [ "Press <ENTER>" ], int(options["-Y"])):
conn.send_eol("")
conn.send_eol(options["-n"]+"")
conn.log_expect(options, options["-c"], int(options["-Y"]))
@@ -182,6 +182,40 @@ def set_power_status(conn, options):
except pexpect.TIMEOUT:
fail(EC_TIMED_OUT)
+def get_power_status5(conn, options):
+ exp_result = 0
+ outlets = {}
+
+ conn.send_eol("olStatus all")
+
+ exp_result = conn.log_expect(options, options["-c"], int(options["-Y"]))
+ lines = conn.before.split("\n")
+
+ show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
+
+ for x in lines:
+ res = show_re.search(x)
+ if (res != None):
+ outlets[res.group(1)] = (res.group(2), res.group(3))
+
+ if ["list", "monitor"].count(options["-o"]) == 1:
+ return outlets
+ else:
+ try:
+ (_, status) = outlets[options["-n"]]
+ return status.lower().strip()
+ except KeyError:
+ fail(EC_STATUS)
+
+def set_power_status5(conn, options):
+ action = {
+ 'on' : "olOn",
+ 'off': "olOff"
+ }[options["--action"]]
+
+ conn.send_eol(action + " " + options["-n"])
+ conn.log_expect(options, options["-c"], int(options["-g"]))
+
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
@@ -199,7 +233,9 @@ def main():
options["ssh_options"] = "-1 -c blowfish"
if 0 == options.has_key("-c"):
- options["-c"] = "\n>"
+ options["-c"] = [ "\n>", "\napc" ]
+ else:
+ options["-c"] = [ options["-c"] ]
docs = { }
docs["shortdesc"] = "Fence agent for APC over telnet/ssh"
@@ -221,7 +257,16 @@ will block any necessary fencing actions."
## Operate the fencing device
####
conn = fence_login(options)
- result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
+
+ ## Detect firmware version (ASCII menu vs command-line interface)
+ ## and continue with proper action
+ ####
+ result = -1
+ firmware_version = re.compile('\s*v(\d)*\.').search(conn.before)
+ if (firmware_version != None) and (firmware_version.group(1) == "5"):
+ result = fence_action(conn, options, set_power_status5, get_power_status5, get_power_status5)
+ else:
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
##
## Logout from system
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 25a0f7e..d1e43da 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -870,7 +870,8 @@ def fence_login(options):
time.sleep(int(options["-f"]))
try:
- re_login = re.compile("(login\s*: )|(Login Name: )|(username: )|(User Name :)", re.IGNORECASE)
+ re_login_string = "(login\s*: )|(Login Name: )|(username: )|(User Name :)"
+ re_login = re.compile(re_login_string, re.IGNORECASE)
re_pass = re.compile("password", re.IGNORECASE)
if options.has_key("-z"):
@@ -957,7 +958,17 @@ def fence_login(options):
try:
conn.send_eol(options["-p"])
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+
+ valid_password = conn.log_expect(options, [ re_login_string ] + options["-c"], int(options["-Y"]))
+ if valid_password == 0:
+ ## password is invalid or we have to change EOL separator
+ options["eol"] = "\r"
+ conn.send_eol("")
+ conn.send_eol("")
+ conn.send_eol(options["-l"])
+ conn.log_expect(options, re_pass, int(options["-y"]))
+ conn.send_eol(options["-p"])
+ conn.log_expect(options, options["-c"], int(options["-y"]))
except KeyError:
fail(EC_PASSWORD_MISSING)
except pexpect.EOF:
10 years, 11 months
cluster: RHEL6 - fenced/dlm_controld/gfs_controld: use cluster_dead for corosync connections
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=62a5ab04868...
Commit: 62a5ab048683b4ce77f0eeaba81d3330da574d41
Parent: 8b67fbb6e5e95510fcecbdd5cd5a91aa88f97750
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jan 4 11:44:13 2013 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 10 09:41:41 2013 -0500
fenced/dlm_controld/gfs_controld: use cluster_dead for corosync connections
corosync connections are supposed to use the
cluster_dead() function, not the client_dead()
function. The client_dead() function closes
the fd directly, which in the case of corosync
connections, fouls up the ipc, because the ipc
is still expecting to use that fd, which the
daemon has reused for something else. The next
time the daemon calls into corosync ipc, it gets
stuck in a poll/futex loop as the lib attempts
to use the fd that fenced has wrongly closed.
bz 888857
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/cpg.c | 2 +-
group/dlm_controld/cpg.c | 2 +-
group/gfs_controld/cpg-new.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 6634f8c..a5a4208 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -1748,7 +1748,7 @@ int fd_join(struct fd *fd)
cpg_fd_get(cpg_handle_domain, &cpg_fd_domain);
- ci = client_add(cpg_fd_domain, process_cpg_domain, NULL);
+ ci = client_add(cpg_fd_domain, process_cpg_domain, cluster_dead);
list_add(&fd->list, &domains);
fd->cpg_handle = cpg_handle_domain;
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index 4463f4d..6a4023b 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1822,7 +1822,7 @@ int dlm_join_lockspace(struct lockspace *ls)
cpg_fd_get(h, &fd);
- ci = client_add(fd, process_cpg_lockspace, NULL);
+ ci = client_add(fd, process_cpg_lockspace, cluster_dead);
list_add(&ls->list, &lockspaces);
diff --git a/group/gfs_controld/cpg-new.c b/group/gfs_controld/cpg-new.c
index 0cdfaae..537624d 100644
--- a/group/gfs_controld/cpg-new.c
+++ b/group/gfs_controld/cpg-new.c
@@ -2773,7 +2773,7 @@ int gfs_join_mountgroup(struct mountgroup *mg)
cpg_fd_get(h, &fd);
- ci = client_add(fd, process_cpg_mountgroup, NULL);
+ ci = client_add(fd, process_cpg_mountgroup, cluster_dead);
mg->cpg_handle = h;
mg->cpg_client = ci;
10 years, 11 months
cluster: RHEL6 - gfs_controld: avoid mismatching messages with old cgs
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=8b67fbb6e5e...
Commit: 8b67fbb6e5e95510fcecbdd5cd5a91aa88f97750
Parent: f50e499e44e5c7f1920e93c9b26b61c8c8468d48
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 3 13:35:54 2013 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 9 10:13:16 2013 -0500
gfs_controld: avoid mismatching messages with old cgs
Only match start messages with cg's that are newer than
previously matched cg's for the node.
bz 889564
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/gfs_controld/cpg-new.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/group/gfs_controld/cpg-new.c b/group/gfs_controld/cpg-new.c
index fd20250..0cdfaae 100644
--- a/group/gfs_controld/cpg-new.c
+++ b/group/gfs_controld/cpg-new.c
@@ -121,6 +121,7 @@ struct node {
int failed_reason;
uint32_t added_seq;
uint32_t removed_seq;
+ uint32_t last_match_seq;
uint64_t add_time;
int withdraw;
@@ -1001,6 +1002,15 @@ static int match_change(struct mountgroup *mg, struct change *cg,
return 0;
}
+ /* if we matched the last start message from this node against our
+ cg N, then don't match this stsart message against an earlier cg */
+
+ if (node->last_match_seq > cg->seq) {
+ log_debug("match_change %d:%u skip cg %u last matched cg %u",
+ hd->nodeid, seq, cg->seq, node->last_match_seq);
+ return 0;
+ }
+
/* verify this is the right change by matching the counts
and the nodeids of the current members */
@@ -1035,6 +1045,8 @@ static int match_change(struct mountgroup *mg, struct change *cg,
if (members_mismatch)
return 0;
+ node->last_match_seq = cg->seq;
+
log_group(mg, "match_change %d:%u matches cg %u", hd->nodeid, seq,
cg->seq);
return 1;
10 years, 11 months