]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: allow regionsize on upconvert from linear
authorHeinz Mauelshagen <heinzm@redhat.com>
Fri, 24 Feb 2017 04:00:55 +0000 (05:00 +0100)
committerHeinz Mauelshagen <heinzm@redhat.com>
Fri, 24 Feb 2017 04:20:58 +0000 (05:20 +0100)
Allow to provide regionsize with "lvconvert -m1 -R N " on
upconverts from linear and on N -> M raid1 leg conversions.

Resolves: rhbz1394427

lib/metadata/metadata-exported.h
lib/metadata/raid_manip.c
tools/lvconvert.c

index 11fb247016df0b44a421a0d94d5afc823024a6bd..376fee9d34d57cf53688addb344ef6f19bf18691 100644 (file)
@@ -1213,6 +1213,7 @@ int lv_is_raid_with_tracking(const struct logical_volume *lv);
 uint32_t lv_raid_image_count(const struct logical_volume *lv);
 int lv_raid_change_image_count(struct logical_volume *lv,
                               uint32_t new_count,
+                              uint32_t new_region_size,
                               struct dm_list *allocate_pvs);
 int lv_raid_split(struct logical_volume *lv, const char *split_name,
                  uint32_t new_count, struct dm_list *splittable_pvs);
index e21e6cc10546c6d3f2121a6471af4d904e6c4ddd..ab0bfab3d22e03d76d2d962ed5576e64ecdbcb7e 100644 (file)
@@ -2866,11 +2866,11 @@ static int _raid_extract_images(struct logical_volume *lv,
                                          display_lvname(lv),
                                          display_lvname(seg_lv(seg, s)));
 
-                               log_error("Try removing the PV list and rerun"
+                               log_error("Try removing the PV list and rerun."
                                          " the command.");
                                return 0;
                        }
-                       log_debug("LVs with error segments to be removed: %s %s.",
+                       log_debug("LVs with error segments to be removed: %s %s",
                                  display_lvname(seg_metalv(seg, s)),
                                  display_lvname(seg_lv(seg, s)));
                } else {
@@ -3013,8 +3013,15 @@ static int _lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_c
 }
 
 int lv_raid_change_image_count(struct logical_volume *lv, uint32_t new_count,
-                              struct dm_list *allocate_pvs)
+                              const uint32_t new_region_size, struct dm_list *allocate_pvs)
 {
+       struct lv_segment *seg = first_seg(lv);
+
+       if (new_region_size) {
+               seg->region_size = new_region_size;
+               _check_and_adjust_region_size(lv);
+       }
+
        return _lv_raid_change_image_count(lv, new_count, allocate_pvs, NULL, 1, 0);
 }
 
index abec04a7e3eea5663ccd5c84690c8a9f30bd38b4..0db10cbd91b85583668a71b065654cb654048129 100644 (file)
@@ -1359,7 +1359,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
                                          DEFAULT_RAID1_MAX_IMAGES, lp->segtype->name, display_lvname(lv));
                                return 0;
                        }
-                       if (!lv_raid_change_image_count(lv, image_count, /* lp->region_size, */ lp->pvh))
+                       if (!lv_raid_change_image_count(lv, image_count, lp->region_size, lp->pvh))
                                return_0;
 
                        log_print_unless_silent("Logical volume %s successfully converted.",
This page took 0.050587 seconds and 5 git commands to generate.