1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Mirror/RAID1: When up|down-converting default to segtype of current LV

If there is no RAID support in the kernel but the default mirror
segtype is "raid1", converting legacy mirrors can be problematic.
For example, changing the log type or converting a mirror to a linear
LV does not require the RAID modules to be present.  However, because
lp->segtype is set to be RAID1 by the configuration file, the command
fails.

We should only be setting lp->segtype when converting mirrors if it is
going to change (e.g. to linear or between mirror types).
This commit is contained in:
Jonathan Brassow 2013-08-07 16:01:45 -05:00
parent ea4c0ea34f
commit b15278c3dc
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.100 -
================================
When converting mirrors, default segtype should be the same unless specified.
Make "raid1" the default mirror segment type.
Fix clogd descriptor leak when daemonizing.
Fix clvmd descriptor leak on restart.

View File

@ -518,10 +518,16 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size))
return_0;
lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG,
find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL)));
if (!lp->segtype)
return_0;
if (arg_count(cmd, mirrors_ARG) && !lp->mirrors) {
/* down-converting to linear/stripe? */
if (!(lp->segtype =
get_segtype_from_string(cmd, "striped")))
return_0;
} else if (arg_count(cmd, type_ARG)) {
/* 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 */
}
/* TODO: default in lvm.conf ? */