diff options
author | Milan Broz <mbroz@redhat.com> | 2009-05-13 21:29:10 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2009-05-13 21:29:10 +0000 |
commit | 970f241c5230554f4e43e292a3bf283d7b6169bd (patch) | |
tree | 612fc088d692886ccbb1cd51797a237a53c434a7 /tools/lvcreate.c | |
parent | 82cf92609485cc8cf6ec684f1cf5efa66843d65d (diff) | |
download | lvm2-970f241c5230554f4e43e292a3bf283d7b6169bd.tar.gz lvm2-970f241c5230554f4e43e292a3bf283d7b6169bd.tar.xz lvm2-970f241c5230554f4e43e292a3bf283d7b6169bd.zip |
Check max_lv on only place and force the check only for new volume.
We can temporarily violate max_lv during mirror conversion etc.
(If the operation fails, orphan mirror images are visible to administrator
for manual remove for example. Not that this should ever happen:-)
Force limit only for lvcreate (and vg merge) command.
Patch also adds simple max_lv tests into testsuite
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 1d06c4bb..ed298559 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -613,6 +613,12 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg, return 0; } + if (vg_max_lv_reached(vg)) { + log_error("Maximum number of logical volumes (%u) reached " + "in volume group %s", vg->max_lv, vg->name); + return 0; + } + if (lp->mirrors > 1 && !(vg->fid->fmt->features & FMT_SEGMENTS)) { log_error("Metadata does not support mirroring."); return 0; |