]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: add command to change region size of a raid LV
authorDavid Teigland <teigland@redhat.com>
Tue, 7 Feb 2017 17:52:13 +0000 (11:52 -0600)
committerDavid Teigland <teigland@redhat.com>
Mon, 13 Feb 2017 14:21:58 +0000 (08:21 -0600)
lib/metadata/metadata-exported.h
lib/metadata/raid_manip.c
test/shell/lvconvert-raid-regionsize.sh
tools/command-lines.in
tools/lvconvert.c
tools/lvmcmdline.c
tools/tools.h

index 420893c00df7527d4737c5e8446add3b4acdac4c..573c09d9079ad7f8697ed89509e2779cd0a6300e 100644 (file)
@@ -1230,6 +1230,8 @@ uint32_t raid_rmeta_extents_delta(struct cmd_context *cmd,
 uint32_t raid_rimage_extents(const struct segment_type *segtype,
                             uint32_t extents, uint32_t stripes, uint32_t data_copies);
 uint32_t raid_ensure_min_region_size(const struct logical_volume *lv, uint64_t raid_size, uint32_t region_size);
+int lv_raid_change_region_size(struct logical_volume *lv,
+                               int yes, int force, uint32_t new_region_size);
 /* --  metadata/raid_manip.c */
 
 /* ++  metadata/cache_manip.c */
index eaafd650d3281d8bd15267a6db1b43310a24e2cc..cdd7af8d6739ae4326bc539e7d86cb64ce12f74c 100644 (file)
@@ -4338,6 +4338,12 @@ int lv_raid_convert(struct logical_volume *lv,
                           region_size, allocate_pvs);
 }
 
+int lv_raid_change_region_size(struct logical_volume *lv,
+                   int yes, int force, uint32_t new_region_size)
+{
+       return _region_size_change_requested(lv, yes, new_region_size);
+}
+
 static int _remove_partial_multi_segment_image(struct logical_volume *lv,
                                               struct dm_list *remove_pvs)
 {
index 7a6c7f0b2b1474f621e6c7cf7ad3854a6b03a6af..9baa99a95309957301e26c1db07ab81e4eb57cd0 100644 (file)
@@ -27,7 +27,7 @@ function _test_regionsize
        local vg=$4
        local lv=$5
 
-       lvconvert --type $type --yes -R $regionsize $vg/$lv
+       lvconvert --yes -R $regionsize $vg/$lv
        [ $? -ne 0 ] && return 1
        check lv_field $vg/$lv regionsize "$regionsize_str"
        fsck -fn "$DM_DEV_DIR/$vg/$lv"
index ca5259feb9765a930936570c0c45b3f691a3eac3..6743b798944fa07299e9c3c4f9ce77740b07d16b 100644 (file)
@@ -364,6 +364,13 @@ ID: lvconvert_raid_types
 DESC: Convert LV to raid1 or mirror, or change number of mirror images.
 RULE: all not lv_is_locked lv_is_pvmove
 
+lvconvert --regionsize SizeMB LV_raid
+OO: OO_LVCONVERT
+ID: lvconvert_change_region_size
+DESC: Change the region size of an LV.
+RULE: all not lv_is_locked lv_is_pvmove
+RULE: all not LV_raid0
+
 ---
 
 # lvconvert raid-related utilities
index 75bdcb97eb651365927cb520292b3c96ae5bfa59..4e86698f4ed3871077aa0bc56b35cafbe839cc21 100644 (file)
@@ -4397,6 +4397,21 @@ out:
        return ret;
 }
 
+static int _lvconvert_change_region_size_single(struct cmd_context *cmd, struct logical_volume *lv,
+                            struct processing_handle *handle)
+{
+       if (!lv_raid_change_region_size(lv, arg_is_set(cmd, yes_ARG), arg_count(cmd, force_ARG),
+                                       arg_int_value(cmd, regionsize_ARG, 0)))
+               return ECMD_FAILED;
+       return ECMD_PROCESSED;
+}
+
+int lvconvert_change_region_size_cmd(struct cmd_context * cmd, int argc, char **argv)
+{
+       return process_each_lv(cmd, 1, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
+                             NULL, &_lvconvert_visible_check, &_lvconvert_change_region_size_single);
+}
+
 /*
  * split mirror images
  */
index 121a9dd434f32c4785d9a8518cb39171e7ca88d9..4fda356061cb3e6f5ef19245dc68999531ecb83d 100644 (file)
@@ -152,6 +152,7 @@ struct command_function command_functions[CMD_COUNT] = {
        { lvconvert_split_mirror_images_CMD,            lvconvert_split_mirror_images_cmd},
        { lvconvert_change_mirrorlog_CMD,               lvconvert_change_mirrorlog_cmd },
        { lvconvert_merge_mirror_images_CMD,            lvconvert_merge_mirror_images_cmd },
+       { lvconvert_change_region_size_CMD,             lvconvert_change_region_size_cmd },
 
        /* redirected to merge_snapshot/merge_thin/merge_mirrors */
        { lvconvert_merge_CMD, lvconvert_merge_cmd },
index 4e1d87f01d713c3fe8f3380f753479f0603532ca..00476d106dcd8ee02618ed36fa245783e80ef763 100644 (file)
@@ -284,6 +284,7 @@ int lvconvert_raid_types_cmd(struct cmd_context * cmd, int argc, char **argv);
 int lvconvert_split_mirror_images_cmd(struct cmd_context * cmd, int argc, char **argv);
 int lvconvert_merge_mirror_images_cmd(struct cmd_context *cmd, int argc, char **argv);
 int lvconvert_change_mirrorlog_cmd(struct cmd_context * cmd, int argc, char **argv);
+int lvconvert_change_region_size_cmd(struct cmd_context * cmd, int argc, char **argv);
 
 int lvconvert_merge_cmd(struct cmd_context *cmd, int argc, char **argv);
 
This page took 0.057539 seconds and 5 git commands to generate.