master - lvresize: Allow approximation with +%FREE.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c7b9f0ab424136b686cd08ff7416078e7c3728c3 Commit: c7b9f0ab424136b686cd08ff7416078e7c3728c3 Parent: 0dc3684b872fa1f225e06deeb0136d1ef66d4c1e Author: Alasdair G Kergon <[email protected]> AuthorDate: Fri Aug 1 00:35:43 2014 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Fri Aug 1 00:35:43 2014 +0100
lvresize: Allow approximation with +%FREE.
Make lvresize -l+%FREE support approximate allocation.
Move existing "Reducing/Extending' message to verbose level and change it to say 'up to' if approximate allocation is being used.
Replace it with a new message that gives the actual old and new size or says 'unchanged'.
--- WHATS_NEW | 2 ++ lib/metadata/lv_manip.c | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-)
WHATS_NEW +2 -0
@@ -1,5 +1,7 @@ Version 2.02.109 - ================================= + Display actual size changed when resizing LV. + Allow approximate allocation with +%FREE in lvextend. Remove possible spurious "not found" message on PV create before wiping. Handle upgrade from 2.02.105 when an LV now gaining a uuid suffix is active.
lib/metadata/lv_manip.c +18 -4
@@ -4155,6 +4155,8 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_voluif (lp->sign ==SIGN_NONE && (lp->percent !=PERCENT_LV && lp->percent !=PERCENT_ORIGIN )) lp->approx_alloc =1 ;/* FIXME Adjust for parallel areas here before processing relative allocations */ +if (lp->sign ==SIGN_PLUS && lp->percent ==PERCENT_FREE ) + lp->approx_alloc =1 ; }if (lp->sign ==SIGN_PLUS ) {
@@ -4456,6 +4458,7 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,struct volume_group *vg = lv->vg;struct logical_volume *lock_lv =NULL ;struct lv_segment *seg =NULL ; +uint32_t old_extents;int status;alloc_policy_t alloc;
@@ -4500,10 +4503,11 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,if (!archive (vg)) return_NULL; -log_print_unless_silent ("%sing logical volume %s to %s" , - (lp->resize ==LV_REDUCE ) ?"Reduc" :"Extend" , - lv->name, -display_size (cmd, (uint64_t ) lp->extents * vg->extent_size)); + old_extents = lv->le_count; +log_verbose ("%sing logical volume %s to %s%s" , + (lp->resize ==LV_REDUCE ) ?"Reduc" :"Extend" , +display_lvname (lv), lp->approx_alloc ?"up to " :"" , +display_size (cmd, (uint64_t ) lp->extents * vg->extent_size));if (lp->resize ==LV_REDUCE ) {if (!lv_reduce (lv, lv->le_count - lp->extents))
@@ -4516,6 +4520,16 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd, pvh, alloc, lp->approx_alloc)) return_NULL; +if (old_extents == lv->le_count) +log_print_unless_silent ("Size of logical volume %s unchanged from %s." , +display_lvname (lv), +display_size (cmd, (uint64_t ) old_extents * vg->extent_size)); +else +log_print_unless_silent ("Size of logical volume %s changed from %s to %s." , +display_lvname (lv), +display_size (cmd, (uint64_t ) old_extents * vg->extent_size), +display_size (cmd, (uint64_t ) lv->le_count * vg->extent_size)); +if (lock_lv) {/* Update thin pool segment from the layered LV */ seg->area_len = lv->le_count;