]> sourceware.org Git - lvm2.git/commitdiff
lvresize: Allow approximation with +%FREE.
authorAlasdair G Kergon <agk@redhat.com>
Thu, 31 Jul 2014 23:35:43 +0000 (00:35 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 31 Jul 2014 23:35:43 +0000 (00:35 +0100)
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
lib/metadata/lv_manip.c

index 03cf668a5e4f9f3c3a2ac2d740f5f26857df247d..a1099fe22bf752da61789a6a99acffd38daf82a7 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
 
index 0d39166dc67daabb08bfea36d8552e4fda756c1e..3e1f9e98096e98b2d511a28048c71da288be46d5 100644 (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;
This page took 0.056991 seconds and 5 git commands to generate.