summaryrefslogtreecommitdiffstats
path: root/tools/lvcreate.c
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2010-01-08 22:32:35 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2010-01-08 22:32:35 +0000
commit77dd1c0e5f9ba2dfd516c3d9df8092303f2df381 (patch)
tree0b7d3cac11095b85e562476d7f31cef864131f67 /tools/lvcreate.c
parentf070e0d9e88496eb4f9671f11e1ec6d817540a3f (diff)
downloadlvm2-77dd1c0e5f9ba2dfd516c3d9df8092303f2df381.tar.gz
lvm2-77dd1c0e5f9ba2dfd516c3d9df8092303f2df381.tar.xz
lvm2-77dd1c0e5f9ba2dfd516c3d9df8092303f2df381.zip
Add the new mirror log type "redundant". The options are now:
--mirrorlog core: in-memory log --mirrorlog disk: persistent log --mirrorlog redundant: redundant persistent log Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r--tools/lvcreate.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 06f34789..fa524303 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -323,21 +323,29 @@ static int _read_mirror_params(struct lvcreate_params *lp,
int region_size;
const char *mirrorlog;
+ /*
+ * This param used to be 'corelog' and was initialized to '0'.
+ * We initially set to '1' here so as not to screw the logic.
+ */
+ lp->log_count = 1;
if (arg_count(cmd, corelog_ARG))
- lp->corelog = 1;
+ lp->log_count = 0;
mirrorlog = arg_str_value(cmd, mirrorlog_ARG,
- lp->corelog ? "core" : DEFAULT_MIRRORLOG);
+ !lp->log_count ? "core" : DEFAULT_MIRRORLOG);
- if (!strcmp("disk", mirrorlog)) {
- if (lp->corelog) {
- log_error("--mirrorlog disk and --corelog "
- "are incompatible");
- return 0;
- }
- lp->corelog = 0;
- } else if (!strcmp("core", mirrorlog))
- lp->corelog = 1;
+ if (strcmp("core", mirrorlog) && !lp->log_count) {
+ log_error("--mirrorlog disk and --corelog "
+ "are incompatible");
+ return 0;
+ }
+
+ if (!strcmp("redundant", mirrorlog))
+ lp->log_count = 2;
+ else if (!strcmp("disk", mirrorlog))
+ lp->log_count = 1;
+ else if (!strcmp("core", mirrorlog))
+ lp->log_count = 0;
else {
log_error("Unknown mirrorlog type: %s", mirrorlog);
return 0;