All of lore.kernel.org
 help / color / mirror / Atom feed
* master - lvconvert: Fix --stripes handling.
@ 2016-06-22 21:12 Alasdair Kergon
  0 siblings, 0 replies; only message in thread
From: Alasdair Kergon @ 2016-06-22 21:12 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6513a7a44950ded037e1fb3e974a089b8e5690df
Commit:        6513a7a44950ded037e1fb3e974a089b8e5690df
Parent:        ebd2758dab39bb70fd63d0d77314971f8bc9cbfd
Author:        Alasdair G Kergon <agk@redhat.com>
AuthorDate:    Wed Jun 22 22:10:42 2016 +0100
Committer:     Alasdair G Kergon <agk@redhat.com>
CommitterDate: Wed Jun 22 22:10:42 2016 +0100

lvconvert: Fix --stripes handling.

Only treat --stripes as meaning --type striped if no other type was
first detected.  If a segtype got selected, don't override it later.
---
 tools/lvconvert.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 9c7f9c2..f99291a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -554,10 +554,9 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
 		lp->replace = 1;
 
 	/* If no other case was identified, then use of --stripes means --type striped */
-	if (!arg_is_set(cmd, type_ARG) && !lp->merge && !lp->splitsnapshot &&
+	if (!arg_is_set(cmd, type_ARG) && !*lp->type_str && !lp->merge && !lp->splitsnapshot &&
 	    !lp->splitcache && !lp->split && !lp->snapshot && !lp->uncache && !lp->cache && !lp->thin &&
-	    !lp->replace && !_mirror_or_raid_type_requested(cmd, lp->type_str) &&
-	    !lp->repair && !lp->mirrorlog && !lp->corelog &&
+	    !lp->replace && !lp->repair && !lp->mirrorlog && !lp->corelog &&
 	    (arg_is_set(cmd, stripes_long_ARG) || arg_is_set(cmd, stripesize_ARG)))
 		lp->type_str = "striped";
 
@@ -750,7 +749,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
 			/* changing mirror type? */
 			if (!(lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL)))))
 				return_0;
-		} /* else segtype will default to current type */
+		} 
 	} else if (_raid0_type_requested(cmd, lp->type_str) || _striped_type_requested(cmd, lp->type_str)) { /* striped or raid0 */
 		if (arg_from_list_is_set(cmd, "cannot be used with --type raid0 or --type striped",
 					 chunksize_ARG, corelog_ARG, mirrors_ARG, mirrorlog_ARG, regionsize_ARG, zero_ARG,
@@ -762,7 +761,7 @@ static int _read_params(struct cmd_context *cmd, int argc, char **argv,
 
 		if (!(lp->segtype = get_segtype_from_string(cmd, lp->type_str)))
 			return_0;
-	}
+	} /* else segtype will default to current type */
 
 	lp->force = arg_count(cmd, force_ARG);
 	lp->yes = arg_count(cmd, yes_ARG);
@@ -1790,7 +1789,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
 	struct lv_segment *seg = first_seg(lv);
 	dm_percent_t sync_percent;
 
-	if (!arg_is_set(cmd, type_ARG))
+	if (!lp->segtype)
 		lp->segtype = seg->segtype;
 
 	/* Can only change image count for raid1 and linear */



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-22 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22 21:12 master - lvconvert: Fix --stripes handling Alasdair Kergon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.