[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] handle transient errors in lvconvert --repair



Hi again,

Takahiro Yasui <tyasui redhat com> writes:
> 3. run 'lvconvert --repair'
>
> # lvconvert --config devices{ignore_suspended_devices=1} --repair --use-policies vg00/lv00
>   Mirrored transient status: "2 253:1 253:2 24/24 1 AA 3 disk 253:0 D"
>   Mirror log status: 1 of 1 images failed - switching to core
>   WARNING: Failed to replace 1 of 1 logs in volume lv00
>
> 4. check logical volumes
>
> # lvs
>   LV        VG   Attr   LSize  Origin Snap%  Move Log Copy%  Convert
>   lv00      vg00 mwi-a- 12.00M                        100.00
>   lv00_mlog vg00 -wi---  4.00M

I have tracked the problem down to a silly branching bug in
lvconvert.c. The LV was only being written to disk if mirrors changed,
or log re-allocation was attempted. I have fixed that, and also added
both mine and your testcases to the suite.

The attached patch is on top of the previous one -- it should apply
cleanly on top of current CVS + the lvconvert-repair-transient.diff I
have sent previously. It also fixes a bug in messages, where it would
claim that it failed to replace things even if it never tried to in the
first place.

Please test and let me know if you run into any other issues.

Thanks,
   Petr.

diff -ru upstream/test/test-utils.sh cvs-upstream/test/test-utils.sh
--- upstream/test/test-utils.sh	2010-05-12 17:00:07.000000000 +0200
+++ cvs-upstream/test/test-utils.sh	2010-05-19 20:07:19.000000000 +0200
@@ -373,6 +373,7 @@
     level = 9
     file = "$TESTDIR/debug.log"
     overwrite = 1
+    activation = 1
   }
   backup {
     backup = 0
Только в upstream/test: test-utils.sh~
Только в cvs-upstream/test: test-utils.sh.~1.43.~
Только в cvs-upstream/test: .#t-lvconvert-mirror-various.sh
Только в cvs-upstream/test: #t-lvconvert-mirror-various.sh#
Только в upstream/test: t-lvconvert-repair-dmeventd.sh~
diff -ru upstream/test/t-lvconvert-repair-policy.sh cvs-upstream/test/t-lvconvert-repair-policy.sh
--- upstream/test/t-lvconvert-repair-policy.sh	2010-04-13 15:17:23.000000000 +0200
+++ cvs-upstream/test/t-lvconvert-repair-policy.sh	2010-05-19 20:19:18.000000000 +0200
@@ -32,40 +32,49 @@
 lvchange -a n $vg/mirror
 
 # Fail a leg of a mirror.
-disable_dev $dev1
+aux disable_dev $dev1
 lvchange --partial -a y $vg/mirror
 repair 'activation { mirror_image_fault_policy = "remove" }'
 check linear $vg mirror
-cleanup $dev1
+aux cleanup $dev1
 
 # Fail a leg of a mirror.
 # Expected result: Mirror (leg replaced)
-disable_dev $dev1
+aux disable_dev $dev1
 repair 'activation { mirror_image_fault_policy = "replace" }'
 check mirror $vg mirror
 lvs | grep mirror_mlog
-cleanup $dev1
+aux cleanup $dev1
 
 # Fail a leg of a mirror (use old name for policy specification)
 # Expected result: Mirror (leg replaced)
-disable_dev $dev1
+aux disable_dev $dev1
 repair 'activation { mirror_device_fault_policy = "replace" }'
 check mirror $vg mirror
 lvs | grep mirror_mlog
-cleanup $dev1
+aux cleanup $dev1
 
 # Fail a leg of a mirror w/ no available spare
 # Expected result: 2-way with corelog
-disable_dev $dev2 $dev4
+aux disable_dev $dev2 $dev4
 repair 'activation { mirror_image_fault_policy = "replace" }'
 check mirror $vg mirror
 lvs | not grep mirror_mlog
-cleanup $dev2 $dev4
+aux cleanup $dev2 $dev4
 
 # Fail the log device of a mirror w/ no available spare
 # Expected result: mirror w/ corelog
-disable_dev $dev3 $dev4
-lvconvert --repair --use-policies --config 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror
+aux disable_dev $dev3 $dev4
+repair 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror
 check mirror $vg mirror
 lvs | not grep mirror_mlog
+aux cleanup $dev3 $dev4
+
+# Fail the log device with a remove policy
+# Expected result: mirror w/ corelog
+lvchange -a y $vg/mirror
+aux disable_dev $dev3 $dev4
+repair 'activation { mirror_log_fault_policy = "remove" }'
+check mirror $vg mirror core
+lvs | not grep mirror_mlog
 cleanup $dev3 $dev4
diff -ru upstream/test/t-lvconvert-repair.sh cvs-upstream/test/t-lvconvert-repair.sh
--- upstream/test/t-lvconvert-repair.sh	2010-05-06 19:25:45.000000000 +0200
+++ cvs-upstream/test/t-lvconvert-repair.sh	2010-05-19 13:58:14.000000000 +0200
@@ -11,38 +11,69 @@
 
 . ./test-utils.sh
 
-prepare_vg 5
 
 # fail multiple devices
 
-lvcreate -m 3 --ig -L 1 -n 4way $vg
+aux prepare_vg 5
+lvcreate -m 3 --ig -L 1 -n 4way $vg $dev1 $dev2 $dev3 $dev4 $dev5:0
 disable_dev $dev2 $dev4
 echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out
 lvs -a -o +devices | not grep unknown
 vgreduce --removemissing $vg
 enable_dev $dev2 $dev4
-check mirror $vg 4way
-lvchange -a n $vg/4way
-
-vgremove -ff $vg
-vgcreate -c n $vg $dev1 $dev2 $dev3 $dev4
+check mirror $vg 4way $dev5
 
+aux prepare_vg 5
 lvcreate -m 2 --ig -L 1 -n 3way $vg
 disable_dev $dev1 $dev2
 echo n | lvconvert --repair $vg/3way
+check linear $vg 3way
 lvs -a -o +devices | not grep unknown
+lvs -a -o +devices | not grep mlog
+dmsetup ls | not grep mlog
 vgreduce --removemissing $vg
 enable_dev $dev1 $dev2
 check linear $vg 3way
-lvchange -a n $vg/3way
+
+# fail just log and get it removed
+
+aux prepare_vg 5
+lvcreate -m 2 --ig -L 1 -n 3way $vg $dev1 $dev2 $dev3 $dev4:0
+disable_dev $dev4
+echo n | lvconvert --repair $vg/3way
+check mirror $vg 3way core
+lvs -a -o +devices | not grep unknown
+lvs -a -o +devices | not grep mlog
+dmsetup ls | not grep mlog
+vgreduce --removemissing $vg
+enable_dev $dev4
+
+aux prepare_vg 5
+lvcreate -m 1 --ig -L 1 -n 2way $vg $dev1 $dev2 $dev3:0
+disable_dev $dev3
+echo n | lvconvert --repair $vg/2way
+
+lvs -a
+dmsetup ls | grep LVMTEST
+exit 1
+
+check mirror $vg 2way core
+lvs -a -o +devices | not grep unknown
+lvs -a -o +devices | not grep mlog
+
+lvs -a
+dmsetup ls | grep LVMTEST
+exit 1
+
+vgreduce --removemissing $vg
+enable_dev $dev3
 
 # fail single devices
 
-vgremove -ff $vg
-vgcreate -c n $vg $dev1 $dev2 $dev3
+aux prepare_vg 5
+vgreduce $vg $dev4
 
 lvcreate -m 1 --ig -L 1 -n mirror $vg
-
 lvchange -a n $vg/mirror
 vgextend $vg $dev4
 disable_dev $dev1
diff -ru upstream/tools/lvconvert.c cvs-upstream/tools/lvconvert.c
--- upstream/tools/lvconvert.c	2010-05-19 17:06:46.000000000 +0200
+++ cvs-upstream/tools/lvconvert.c	2010-05-19 20:18:40.000000000 +0200
@@ -1225,11 +1225,11 @@
 		if (!lv_remove_mirrors(cmd, lv, failed_mirrors, new_log_count,
 				       _is_partial_lv, NULL, 0))
 			return 0;
-
-		if (!_reload_lv(cmd, lv))
-			return 0;
 	}
 
+	if (!_reload_lv(cmd, lv))
+		return 0;
+
 	/*
 	 * Second phase - replace faulty devices
 	 */
@@ -1254,10 +1254,10 @@
 		}
 	}
 
-	if (lp->mirrors != old_mimage_count)
+	if (replace_mirrors && lp->mirrors != old_mimage_count)
 		log_warn("WARNING: Failed to replace %d of %d images in volume %s",
 			 old_mimage_count - lp->mirrors, old_mimage_count, lv->name);
-	if (log_count != old_log_count)
+	if (replace_log && log_count != old_log_count)
 		log_warn("WARNING: Failed to replace %d of %d logs in volume %s",
 			 old_log_count - log_count, old_log_count, lv->name);
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]