master - lvconvert: snapshot: use command definitions
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa2a728a395639a32707bb75e6bb4197b02769de Commit: fa2a728a395639a32707bb75e6bb4197b02769de Parent: 254bffb95d6330662632eda472991b2fc0008d94 Author: David Teigland <[email protected]> AuthorDate: Fri Nov 18 13:16:04 2016 -0600 Committer: David Teigland <[email protected]> CommitterDate: Mon Feb 13 08:20:10 2017 -0600
lvconvert: snapshot: use command definitions
Lift all the snapshot utilities (merge, split, combine) out of the monolithic lvconvert implementation, using the command definitions. The old code associated with these commands is now unused and will be removed separately.
--- test/shell/lvconvert-cache-snapshot.sh | 2 +- .../shell/lvmetad-pvscan-autoactivation-polling.sh | 2 +- test/shell/snapshot-merge-stack.sh | 2 +- test/shell/snapshot-merge.sh | 16 +- test/shell/thin-merge.sh | 2 +- tools/args.h | 1 + tools/command-lines.in | 64 +++-- tools/lvconvert.c | 313 +++++++++++++------- tools/lvmcmdline.c | 11 +- tools/tools.h | 4 + 10 files changed, 277 insertions(+), 140 deletions(-)
test/shell/lvconvert-cache-snapshot.sh +1 -1
@@ -33,7 +33,7 @@ lvcreate -L3 -n cow $vg not lvconvert -s cow $vg/$lv1 # Use cached LV with 'striped' cow volume -lvconvert -y -s $vg/$lv1 cow +lvconvert -y -s $vg/$lv1 $vg/cow check lv_field $vg/cow segtype linear check lv_field $vg/$lv1 segtype cache
test/shell/lvmetad-pvscan-autoactivation-polling.sh +1 -1
@@ -54,7 +54,7 @@ mkdir test_mnt setup_merge_ $vg1 $lv1 mount "$(lvdev_ $vg1 $lv1)" test_mnt -lvconvert --merge $vg1/$(snap_lv_name_ $lv1) +lvconvert --mergesnapshot $vg1/$(snap_lv_name_ $lv1) umount test_mnt vgchange -an $vg1
test/shell/snapshot-merge-stack.sh +1 -1
@@ -32,7 +32,7 @@ snap_and_merge() { SLEEP_PID=$(aux hold_device_open $vg $lv1 20) # initiate background merge - lvconvert -b --merge $vg/$lv2 + lvconvert -b --mergesnapshot $vg/$lv2 lvs -a -o+lv_merging,lv_merge_failed $vg get lv_field $vg/$lv1 lv_attr | grep "Owi-ao"
test/shell/snapshot-merge.sh +8 -8
@@ -51,15 +51,15 @@ mkdir test_mnt # test full merge of a single LV setup_merge_ $vg $lv1 -# make sure lvconvert --merge requires explicit LV listing -not lvconvert --merge -lvconvert --merge $vg/$(snap_lv_name_ $lv1) +# make sure lvconvert --mergesnapshot requires explicit LV listing +not lvconvert --mergesnapshot +lvconvert --mergesnapshot $vg/$(snap_lv_name_ $lv1) lvremove -f $vg/$lv1 # test that an actively merging snapshot may not be removed setup_merge_ $vg $lv1 -lvconvert -i+100 --merge --background $vg/$(snap_lv_name_ $lv1) +lvconvert -i+100 --mergesnapshot --background $vg/$(snap_lv_name_ $lv1) not lvremove -f $vg/$(snap_lv_name_ $lv1) lvremove -f $vg/$lv1
@@ -67,7 +67,7 @@ lvremove -f $vg/$lv1 # "onactivate merge" test setup_merge_ $vg $lv1 mount "$(lvdev_ $vg $lv1)" test_mnt -lvconvert --merge $vg/$(snap_lv_name_ $lv1) +lvconvert --mergesnapshot $vg/$(snap_lv_name_ $lv1) # -- refresh LV while FS is still mounted (merge must not start), # verify 'snapshot-origin' target is still being used lvchange --refresh $vg/$lv1
@@ -88,7 +88,7 @@ lvremove -f $vg/$lv1 # to make sure preload of origin's metadata is _not_ performed setup_merge_ $vg $lv1 mount "$(lvdev_ $vg $lv1)" test_mnt -lvconvert --merge $vg/$(snap_lv_name_ $lv1) +lvconvert --mergesnapshot $vg/$(snap_lv_name_ $lv1) # -- refresh LV while FS is still mounted (merge must not start), # verify 'snapshot-origin' target is still being used lvchange --refresh $vg/$lv1
@@ -99,7 +99,7 @@ lvremove -f $vg/$lv1 # test multiple snapshot merge; tests copy out that is driven by merge setup_merge_ $vg $lv1 1 -lvconvert --merge $vg/$(snap_lv_name_ $lv1) +lvconvert --mergesnapshot $vg/$(snap_lv_name_ $lv1) lvremove -f $vg/$lv1
@@ -108,7 +108,7 @@ setup_merge_ $vg $lv1 setup_merge_ $vg $lv2 lvchange --addtag this_is_a_test $vg/$(snap_lv_name_ $lv1) lvchange --addtag this_is_a_test $vg/$(snap_lv_name_ $lv2) -lvconvert --merge @this_is_a_test +lvconvert --mergesnapshot @this_is_a_test lvs $vg | tee out not grep $(snap_lv_name_ $lv1) out not grep $(snap_lv_name_ $lv2) out
test/shell/thin-merge.sh +1 -1
@@ -102,7 +102,7 @@ lvcreate -s -n snap $vg/$lv1 lvcreate -s -L10 -n oldsnapof_${lv1} $vg/$lv1 not lvconvert --merge $vg/snap $MKFS "$DM_DEV_DIR/$vg/oldsnapof_${lv1}" -lvconvert --merge $vg/oldsnapof_${lv1} +lvconvert --mergesnapshot $vg/oldsnapof_${lv1} fsck -n "$DM_DEV_DIR/$vg/$lv1" check lv_not_exists $vg oldsnapof_${lv1} # Add old snapshot to thin snapshot
tools/args.h +1 -0
@@ -60,6 +60,7 @@ arg(locktype_ARG, '\0', "locktype", locktype_VAL, 0, 0) arg(logonly_ARG, '\0', "logonly", 0, 0, 0) arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", sizekb_VAL, 0, 0) arg(merge_ARG, '\0', "merge", 0, 0, 0) +arg(mergesnapshot_ARG, '\0', "mergesnapshot", 0, 0, 0) arg(mergedconfig_ARG, '\0', "mergedconfig", 0, 0, 0) arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_VAL, 0, 0)arg (metadataignore_ARG,'\0' ,"metadataignore" , bool_VAL,0 ,0 )
tools/command-lines.in +43 -21
102 lines not on this page · raw message
tools/lvconvert.c +210 -103
444 lines not on this page · raw message
tools/lvmcmdline.c +7 -4
@@ -123,9 +123,14 @@ struct command_function command_functions[COMMAND_ID_COUNT] = { { lvchange_poll_CMD, lvchange_monitor_poll_cmd }, { lvchange_persistent_CMD, lvchange_persistent_cmd }, -/* lvconvert utilities related to snapshots and repair. */ +/* lvconvert utilities related to repair. */ { lvconvert_repair_pvs_or_thinpool_CMD, lvconvert_repair_pvs_or_thinpool_cmd }, { lvconvert_replace_pv_CMD, lvconvert_replace_pv_cmd }, + +/* lvconvert utilities related to snapshots. */ + { lvconvert_split_cow_snapshot_CMD, lvconvert_split_snapshot_cmd }, + { lvconvert_merge_snapshot_CMD, lvconvert_merge_snapshot_cmd }, + { lvconvert_combine_split_snapshot_CMD, lvconvert_combine_split_snapshot_cmd }, };#if 0 /* all raid-related type conversions */
@@ -147,11 +152,9 @@ struct command_function command_functions[COMMAND_ID_COUNT] = { { lvconvert_split_and_delete_cachepool_CMD, lvconvert_split_and_delete_cachepool_fn }, { lvconvert_swap_pool_metadata_CMD, lvconvert_swap_pool_metadata_fn }, - /* utilities related to snapshots and repair. */ + /* other misc. */ { lvconvert_merge_CMD, lvconvert_merge_fn }, - { lvconvert_combine_split_snapshot_CMD, lvconvert_combine_split_snapshot_fn }, - { lvconvert_split_cow_snapshot_CMD, lvconvert_split_cow_snapshot_fn }, { lvconvert_poll_start_CMD, lvconvert_poll_start_fn }, #endif
tools/tools.h +4 -0
@@ -254,4 +254,8 @@ int lvchange_persistent_cmd(struct cmd_context *cmd, int argc, char **argv);int lvconvert_repair_pvs_or_thinpool_cmd (struct cmd_context *cmd,int argc,char **argv);int lvconvert_replace_pv_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvconvert_merge_snapshot_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvconvert_split_snapshot_cmd (struct cmd_context *cmd,int argc,char **argv); +int lvconvert_combine_split_snapshot_cmd (struct cmd_context *cmd,int argc,char **argv); +#endif