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

lvcreate: allow raidintegrity option with implicit raid type

Allow "lvcreate -m1 --raidintegrity y" when raid1 is used, but
not explicit on the command line.
This commit is contained in:
David Teigland 2024-04-17 13:40:33 -05:00
parent 77ff83f784
commit f4911177da
2 changed files with 14 additions and 12 deletions

View File

@ -956,7 +956,8 @@ FLAGS: SECONDARY_SYNTAX
# R14 (just --mirrors)
# alternate form of lvcreate --type raid1|mirror
lvcreate --mirrors PNumber --size SizeMB VG
OO: --stripesize SizeKB, --mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
OO: --stripesize SizeKB, --mirrorlog MirrorLog, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB,
--raidintegrity Bool, --raidintegritymode String, --raidintegrityblocksize Number, OO_LVCREATE
OP: PV ...
IO: --stripes 1
ID: lvcreate_mirror_or_raid1
@ -977,7 +978,8 @@ DESC: Create a raid LV (a specific raid level must be used, e.g. raid1).
# FIXME: --mirrors N --stripes 1 is raid1|mirror and should only
# match the cmd def above for raid1|mirror with IO: --stripes 1
lvcreate --mirrors PNumber --stripes Number --size SizeMB VG
OO: --stripesize SizeKB, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB, OO_LVCREATE
OO: --stripesize SizeKB, --regionsize RegionSize, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB,
--raidintegrity Bool, --raidintegritymode String, --raidintegrityblocksize Number, OO_LVCREATE
OP: PV ...
ID: lvcreate_raid_any
DESC: Create a raid10 LV.

View File

@ -607,6 +607,16 @@ static int _read_raid_params(struct cmd_context *cmd,
}
}
if (arg_int_value(cmd, raidintegrity_ARG, 0)) {
lp->raidintegrity = 1;
if (arg_is_set(cmd, raidintegrityblocksize_ARG))
lp->integrity_settings.block_size = arg_int_value(cmd, raidintegrityblocksize_ARG, 0);
if (arg_is_set(cmd, raidintegritymode_ARG)) {
if (!integrity_mode_set(arg_str_value(cmd, raidintegritymode_ARG, NULL), &lp->integrity_settings))
return_0;
}
}
return 1;
}
@ -1286,16 +1296,6 @@ static int _lvcreate_params(struct cmd_context *cmd,
}
}
if (seg_is_raid(lp) && arg_int_value(cmd, raidintegrity_ARG, 0)) {
lp->raidintegrity = 1;
if (arg_is_set(cmd, raidintegrityblocksize_ARG))
lp->integrity_settings.block_size = arg_int_value(cmd, raidintegrityblocksize_ARG, 0);
if (arg_is_set(cmd, raidintegritymode_ARG)) {
if (!integrity_mode_set(arg_str_value(cmd, raidintegritymode_ARG, NULL), &lp->integrity_settings))
return_0;
}
}
lcp->pv_count = argc;
lcp->pvs = argv;