mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Fix lvcreate processing of %PVS argument.
- fix missing unlocking of VG lvcreate -l 100%PVS -n lv1 vg_test Please specify physical volume(s) with %PVS Internal error: Volume Group vg_test was not unlocked - if no PVS specified, use all available Fix segfault if %PVS in lvresize without PVs list.
This commit is contained in:
parent
3dc1945b44
commit
16d385ac6a
@ -1,5 +1,6 @@
|
||||
Version 2.02.55 -
|
||||
===================================
|
||||
Fix lvcreate and lvresize processing of %PVS argument.
|
||||
Tidy some uses of arg_count and introduce arg_is_set.
|
||||
Export outnl and indent functions for modules.
|
||||
Flush stdout after yes/no prompt.
|
||||
|
@ -160,13 +160,12 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
lp->extents = lp->extents * vg->free_count / 100;
|
||||
break;
|
||||
case PERCENT_PVS:
|
||||
if (!lcp->pv_count) {
|
||||
log_error("Please specify physical volume(s) "
|
||||
"with %%PVS");
|
||||
return 0;
|
||||
if (!lcp->pv_count)
|
||||
lp->extents = lp->extents * vg->extent_count / 100;
|
||||
else {
|
||||
pv_extent_count = pv_list_extents_free(lp->pvh);
|
||||
lp->extents = lp->extents * pv_extent_count / 100;
|
||||
}
|
||||
pv_extent_count = pv_list_extents_free(lp->pvh);
|
||||
lp->extents = lp->extents * pv_extent_count / 100;
|
||||
break;
|
||||
case PERCENT_LV:
|
||||
log_error("Please express size as %%VG, %%PVS, or "
|
||||
@ -584,15 +583,15 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!_update_extents_params(vg, &lp, &lcp)) {
|
||||
stack;
|
||||
return ECMD_FAILED;
|
||||
r = ECMD_FAILED;
|
||||
goto_out;
|
||||
}
|
||||
|
||||
if (!lv_create_single(vg, &lp)) {
|
||||
stack;
|
||||
r = ECMD_FAILED;
|
||||
}
|
||||
|
||||
out:
|
||||
unlock_and_release_vg(cmd, vg, lp.vg_name);
|
||||
return r;
|
||||
}
|
||||
|
@ -367,8 +367,11 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
|
||||
lp->extents = lp->extents * lv->le_count / 100;
|
||||
break;
|
||||
case PERCENT_PVS:
|
||||
pv_extent_count = pv_list_extents_free(pvh);
|
||||
lp->extents = lp->extents * pv_extent_count / 100;
|
||||
if (lp->argc) {
|
||||
pv_extent_count = pv_list_extents_free(pvh);
|
||||
lp->extents = lp->extents * pv_extent_count / 100;
|
||||
} else
|
||||
lp->extents = lp->extents * vg->extent_count / 100;
|
||||
break;
|
||||
case PERCENT_NONE:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user