diff options
author | Milan Broz <mbroz@redhat.com> | 2009-11-04 14:47:27 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2009-11-04 14:47:27 +0000 |
commit | ba3851fda658d509525d7cdd2cd54abe3a49f606 (patch) | |
tree | 68b72d6061ef6ee89a7570abde64132270326382 /tools/lvcreate.c | |
parent | d2e3654f88369e2e1deb38eb90c6ff239f519713 (diff) | |
download | lvm2-ba3851fda658d509525d7cdd2cd54abe3a49f606.tar.gz lvm2-ba3851fda658d509525d7cdd2cd54abe3a49f606.tar.xz lvm2-ba3851fda658d509525d7cdd2cd54abe3a49f606.zip |
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.
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index c677d6bb..f250f371 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -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; } |