1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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'.
This commit is contained in:
Alasdair G Kergon 2014-08-01 00:35:43 +01:00
parent 0dc3684b87
commit c7b9f0ab42
2 changed files with 20 additions and 4 deletions

View File

@ -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.

View File

@ -4155,6 +4155,8 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
if (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;