lvm-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: integrity-caching: ensure raid redundancy
Date: Wed, 17 May 2023 19:17:55 +0000 (GMT)	[thread overview]
Message-ID: <20230517191755.95A5A3882642@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=24e4b6df1182d0d41763176c175e98e5fa6153ab
Commit:        24e4b6df1182d0d41763176c175e98e5fa6153ab
Parent:        3a757047560d75a28d7e4c7d9a5253a72d786544
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Wed May 17 14:15:25 2023 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Wed May 17 14:15:25 2023 -0500

tests: integrity-caching: ensure raid redundancy

The recent fix 05c2b10c5d0a9 ensures that raid LV images are not
using the same devices.  This was happening in the lvextend commands
used by this test, so fix the test to use more devices to ensue
redundancy.
---
 lib/metadata/lv_manip.c         |  5 ++++-
 test/shell/integrity-caching.sh | 23 ++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9a9e547be..fa3661739 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4471,8 +4471,11 @@ static int _lv_raid_redundant(struct logical_volume *lv,
 		for (s = 0; s < seg->area_count; s++) {
 			struct logical_volume *slv = meta ? seg_metalv(seg, s) : seg_lv(seg, s);
 
-			if (slv && lv_is_on_pv(slv, pvl->pv) && nlvs++)
+			if (slv && lv_is_on_pv(slv, pvl->pv) && nlvs++) {
+				log_error("LV %s using PV %s is not redundant.",
+					  display_lvname(slv), dev_name(pvl->pv->dev));
 				return 0;
+			}
 		}
 	}
 
diff --git a/test/shell/integrity-caching.sh b/test/shell/integrity-caching.sh
index 838bbded0..72fb4af4a 100644
--- a/test/shell/integrity-caching.sh
+++ b/test/shell/integrity-caching.sh
@@ -23,7 +23,7 @@ aux kernel_at_least  5 10 || export LVM_TEST_PREFER_BRD=0
 mnt="mnt"
 mkdir -p $mnt
 
-aux prepare_devs 6 80
+aux prepare_devs 9 80
 
 # Use awk instead of anoyingly long log out from printf
 #printf "%0.sA" {1..16384} >> fileA
@@ -276,7 +276,7 @@ vgremove -ff $vg
 # Test lvextend while inactive
 
 _prepare_vg
-lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg
+lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg "$dev1" "$dev2"
 aux wait_recalc $vg/${lv1}_rimage_0
 aux wait_recalc $vg/${lv1}_rimage_1
 aux wait_recalc $vg/$lv1
@@ -286,7 +286,11 @@ lvs -a -o name,size,segtype,devices,sync_percent $vg
 _add_new_data_to_mnt
 umount $mnt
 lvchange -an $vg/$lv1
-lvextend -l 16 $vg/$lv1
+# use two new devs for raid extend to ensure redundancy
+vgextend $vg "$dev7" "$dev8"
+lvs -a -o name,segtype,devices $vg
+lvextend -l 16 $vg/$lv1 "$dev7" "$dev8"
+lvs -a -o name,segtype,devices $vg
 lvchange -ay $vg/$lv1
 mount "$DM_DEV_DIR/$vg/$lv1" $mnt
 resize2fs "$DM_DEV_DIR/$vg/$lv1"
@@ -303,15 +307,18 @@ vgremove -ff $vg
 # Test lvextend while active
 
 _prepare_vg
-lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg
+lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg "$dev1" "$dev2"
 aux wait_recalc $vg/${lv1}_rimage_0
 aux wait_recalc $vg/${lv1}_rimage_1
 aux wait_recalc $vg/$lv1
 lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6"
 lvconvert -y --type $convert_type $convert_option fast $vg/$lv1
+# use two new devs for raid extend to ensure redundancy
+vgextend $vg "$dev7" "$dev8"
 lvs -a -o name,size,segtype,devices,sync_percent $vg
 _add_new_data_to_mnt
-lvextend -l 16 $vg/$lv1
+lvextend -l 16 $vg/$lv1 "$dev7" "$dev8"
+lvs -a -o name,size,segtype,devices,sync_percent $vg
 resize2fs "$DM_DEV_DIR/$vg/$lv1"
 aux wait_recalc $vg/${lv1}_${suffix}_rimage_0
 aux wait_recalc $vg/${lv1}_${suffix}_rimage_1
@@ -324,16 +331,18 @@ lvremove $vg/$lv1
 vgremove -ff $vg
 
 _prepare_vg
-lvcreate --type raid5 --raidintegrity y -n $lv1 -I4 -l 8 $vg
+lvcreate --type raid5 --raidintegrity y -n $lv1 -I4 -l 8 $vg "$dev1" "$dev2" "$dev3"
 aux wait_recalc $vg/${lv1}_rimage_0
 aux wait_recalc $vg/${lv1}_rimage_1
 aux wait_recalc $vg/${lv1}_rimage_2
 aux wait_recalc $vg/$lv1
 lvcreate --type $create_type -n fast -l 4 -an $vg "$dev6"
 lvconvert -y --type $convert_type $convert_option fast $vg/$lv1
+vgextend $vg "$dev7" "$dev8" "$dev9"
 lvs -a -o name,size,segtype,devices,sync_percent $vg
 _add_new_data_to_mnt
-lvextend -l 16 $vg/$lv1
+lvextend -l 16 $vg/$lv1 "$dev7" "$dev8" "$dev9"
+lvs -a -o name,size,segtype,devices,sync_percent $vg
 resize2fs "$DM_DEV_DIR/$vg/$lv1"
 aux wait_recalc $vg/${lv1}_${suffix}_rimage_0
 aux wait_recalc $vg/${lv1}_${suffix}_rimage_1


                 reply	other threads:[~2023-05-17 19:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517191755.95A5A3882642@sourceware.org \
    --to=teigland@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).