summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2016-08-16 13:39:40 +0200
committerHeinz Mauelshagen <heinzm@redhat.com>2016-08-16 13:39:40 +0200
commit73df2aedf9788dcf2dbf09f20f8783c6d2108e75 (patch)
treec383d7430526e6ee9ac58e80f675f25040bc4109
parent114db6f745a229e1c3bf2dc95cc45c020cbcfca8 (diff)
downloadlvm2-73df2aedf9788dcf2dbf09f20f8783c6d2108e75.tar.gz
lvcreate: better error message creating RAID LV on < 4 KiB VG extent size
Creating a RaidLV in VGs with very small extent sizes caused late failure in the kernel giving a not very informative error message. Catch the attempt early and display failure message 'Unable to create RAID LV: requires minimum VG extent size 4.00 KiB'. - resoves rhbz1179970
-rw-r--r--tools/lvcreate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index ccd07f054..a389d7952 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -1255,10 +1255,17 @@ static int _check_raid_parameters(struct volume_group *vg,
struct lvcreate_cmdline_params *lcp)
{
unsigned devs = lcp->pv_count ? : dm_list_size(&vg->pvs);
+ uint64_t page_sectors = lvm_getpagesize() >> SECTOR_SHIFT;
struct cmd_context *cmd = vg->cmd;
int old_stripes = !arg_is_set(cmd, stripes_ARG) &&
find_config_tree_bool(cmd, allocation_raid_stripe_all_devices_CFG, NULL);
+ if (vg->extent_size < page_sectors) {
+ log_error("Unable to create RAID LV: requires minimum VG extent size %s",
+ display_size(vg->cmd, page_sectors));
+ return 0;
+ }
+
/*
* If we requested the previous behaviour by setting
* "allocation/raid_stripe_all_devices = 1" and the