LVM2 man/lvconvert.8.in test/t-snapshot-merge. ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: snitzer at sourceware.org 2010-02-05 22:44:38
Modified files:
man : lvconvert.8.in test : t-snapshot-merge.sh tools : lvconvert.c
Log message:
lvconvert --merge @tag support
Switch lvconvert's --merge code over to using process_each_lv(). Doing so adds support for a single 'lvconvert --merge' to start merging multiple LVs (which includes @tag expansion).
Add 'lvconvert --merge @tag' testing to test/t-snapshot-merge.sh
Adjust man/lvconvert.8.in to reflect these expanded capabilities.
The lvconvert.c implementation requires rereading the VG each iteration of process_each_lv(). Otherwise a stale VG instance associated with the LV passed to lvconvert_single_merge() would result in stale VG metadata being written back out to disk. This overwrote new metadata that was written when a previous snapshot LV finished merging (via lvconvert_poll). This is only an issue when merging multiple LVs that share the same VG (a single VG is typical for most LVM configurations on system disks).
In the end this new support is very useful for performing a "system rollback" that requires multiple snapshot LVs be merged to their respective origin LV.
The yum-utils 'fs-snapshot' plugin tags all snapshot LVs that it creates with a common 'snapshot_tag' that is unique to the yum transaction. Rolling back a yum transaction, that created LVM snapshots with the tag 'yum_20100129133223', is as simple as:
lvconvert --merge @yum_20100129133223
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-snapshot-merge.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118
man/lvconvert.8.in +12 -2
@@ -39,7 +39,7 @@ [\-h|\-?|\-\-help] [\-v|\-\-verbose] [\-\-version] -SnapshotLogicalVolume[Path] +SnapshotLogicalVolume[Path]... .br .br
@@ -141,7 +141,9 @@ When merging starts, the resulting logical volume will have the origin's name, minor number and UUID. While the merge is in progress, reads or writes to the origin appear as they were directed to the snapshot being merged. When the -merge finishes, the merged snapshot is removed. +merge finishes, the merged snapshot is removed. Multiple snapshots may +be specified on the commandline or a @tag may be used to specify +multiple snapshots be merged to their respective origin. .br
@@ -199,6 +201,14 @@ .br merges "vg00/lvol1_snap" into its origin. +.br +"lvconvert --merge @some_tag" +.br +If vg00/lvol1, vg00/lvol2, and vg00/lvol3 are all tagged with "some_tag" +each snapshot logical volume will be merged serially, e.g.: vg00/lvol1, +then vg00/lvol2, then vg00/lvol3. If --background were used it would start +all snapshot logical volume merges in parallel. + .SH SEE ALSO .BR lvm (8), .BR vgcreate (8),
test/t-snapshot-merge.sh +11 -0
@@ -77,6 +77,17 @@ lvconvert --merge $vg/$(snap_lv_name_ $lv1) lvremove -f $vg/$lv1 +# test merging multiple snapshots that share the same tag +setup_merge $vg $lv1 +setup_merge $vg $lv2 +lvs -a +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 +lvs | not grep $(snap_lv_name_ $lv1) +lvs | not grep $(snap_lv_name_ $lv2) +lvremove -f $vg/$lv1 +lvremove -f $vg/$lv2 # FIXME following tests would need to poll merge progress, via periodic lvs? # Background processes don't lend themselves to lvm testsuite...
tools/lvconvert.c +129 -32
211 lines not on this page · raw message