summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2016-08-08 18:43:54 +0100
committerAlasdair G Kergon <agk@redhat.com>2016-08-08 18:43:54 +0100
commit175e0905d5e18fe0f3c6f00cdd0eefcefe8eaa3a (patch)
tree994c5d52b5ab6eb6b19667601f3587fc0257acfd
parentfc93085c7a7716671c3567d367dd2c75544a058b (diff)
downloadlvm2-175e0905d5e18fe0f3c6f00cdd0eefcefe8eaa3a.tar.gz
test: Drop --mirrorlog when not a mirror.
-rw-r--r--test/shell/lvconvert-mirror-basic.sh10
-rw-r--r--tools/lvconvert.c6
2 files changed, 12 insertions, 4 deletions
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh
index 530e6dd83..81fb0c658 100644
--- a/test/shell/lvconvert-mirror-basic.sh
+++ b/test/shell/lvconvert-mirror-basic.sh
@@ -97,7 +97,15 @@ test_lvconvert() {
alloc="--alloc anywhere"
fi
- lvconvert --type mirror -m $finish_count --mirrorlog $finish_log_type \
+ # --mirrorlog is invalid with -m0
+ if [ "$finish_count" -eq 0 ]; then
+ mirrorlog=""
+ finish_log_type=""
+ else
+ mirrorlog="--mirrorlog"
+ fi
+
+ lvconvert --type mirror -m $finish_count $mirrorlog $finish_log_type \
$vg/$lv1 $alloc
test $active || lvchange -aey $vg/$lv1
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 8dc9f6ddb..7c014e0ee 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1700,8 +1700,8 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
uint32_t new_mimage_count;
uint32_t new_log_count;
- if (*lp->type_str && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
- log_error("--corelog and --mirrorlog is only compatible with --type mirror");
+ if ((lp->corelog || lp->mirrorlog) && *lp->type_str && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
+ log_error("--corelog and --mirrorlog are only compatible with mirror devices");
return 0;
}
@@ -1894,7 +1894,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
}
if ((lp->corelog || lp->mirrorlog) && strcmp(lp->type_str, SEG_TYPE_NAME_MIRROR)) {
- log_error("--corelog and --mirrorlog is only compatible with --type mirror");
+ log_error("--corelog and --mirrorlog are only compatible with mirror devices");
return 0;
}