1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvcreate: do not silently accept '-m #' with raid4/5/6

If the user provides '-m #' (# > 0) with mappings
raid4/5/6, the command silently creates
'#mirrors * #stripes + #parity' image component pairs.

Patch rejects '-m #' altogether for those mappings
in order to avoid LV creation with unexpected layout.

- resolves bz#1209445
This commit is contained in:
Heinz Mauelshagen 2015-04-07 14:32:25 +02:00
parent 64353ff74b
commit 035276ab83

View File

@ -474,6 +474,14 @@ static int _read_raid_params(struct cmd_context *cmd,
return 0; return 0;
} }
if (arg_count(cmd, mirrors_ARG) && segtype_is_raid(lp->segtype) &&
strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID1) &&
strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) {
log_error("Mirror argument cannot be used with segment type, %s",
lp->segtype->name);
return 0;
}
/* Rates are recorded in kiB/sec/disk, not sectors/sec/disk */ /* Rates are recorded in kiB/sec/disk, not sectors/sec/disk */
lp->min_recovery_rate = arg_uint_value(cmd, minrecoveryrate_ARG, 0) / 2; lp->min_recovery_rate = arg_uint_value(cmd, minrecoveryrate_ARG, 0) / 2;
lp->max_recovery_rate = arg_uint_value(cmd, maxrecoveryrate_ARG, 0) / 2; lp->max_recovery_rate = arg_uint_value(cmd, maxrecoveryrate_ARG, 0) / 2;