1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-28 02:50:41 +03:00

lvconvert: add command to change region size of a raid LV

This commit is contained in:
David Teigland 2017-02-07 11:52:13 -06:00
parent 8152e4a99e
commit 46abc28a48
7 changed files with 33 additions and 1 deletions

View 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 */

View 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)
{

View 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"

View 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

View 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
*/

View 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 },

View 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);