summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-07-06 16:44:18 -0500
committerDavid Teigland <teigland@redhat.com>2016-07-06 16:44:18 -0500
commit13cd3ff5a0dd1652cf20697dbb0d768c6b5115f1 (patch)
tree49ce06d60e40dcee9ee17f9b1ead464e8144ce91
parent37d1b7b7454332b8223cbbbae6375566af89da5a (diff)
downloadlvm2-13cd3ff5a0dd1652cf20697dbb0d768c6b5115f1.tar.gz
lvconvert: allow converting type raid1 to type linear
The code could perform this conversion but ironically did not recognize the standard command form, only the the unpreferred "implication-based" command form. "lvconvert --type linear VG/RaidLV" would fail, but "lvconvert --mirrors 0 VG/RaidLV" would succeed.
-rw-r--r--tools/lvconvert.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d0aa7337f..ce858ae1d 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1823,6 +1823,7 @@ static void _lvconvert_raid_repair_ask(struct cmd_context *cmd,
static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *lp)
{
+ const char *new_type;
int replace = 0, image_count = 0;
struct dm_list *failed_pvs;
struct cmd_context *cmd = lv->vg->cmd;
@@ -1832,6 +1833,16 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
if (!lp->segtype)
lp->segtype = seg->segtype;
+ if ((new_type = arg_str_value(cmd, type_ARG, NULL)) &&
+ !strcmp(new_type, SEG_TYPE_NAME_LINEAR)) {
+ if (arg_is_set(cmd, mirrors_ARG) && (arg_uint_value(cmd, mirrors_ARG, 0) != 0)) {
+ log_error("Cannot specify mirrors with linear type.");
+ return 0;
+ }
+ lp->mirrors_supplied = 1;
+ lp->mirrors = 0;
+ }
+
/* Can only change image count for raid1 and linear */
if (lp->mirrors_supplied && !seg_is_mirrored(seg) && !seg_is_linear(seg)) {
log_error("'--mirrors/-m' is not compatible with %s",