diff options
| author | Zdenek Kabelac <zkabelac@redhat.com> | 2025-10-08 16:34:43 +0200 |
|---|---|---|
| committer | Zdenek Kabelac <zkabelac@redhat.com> | 2025-10-13 12:51:40 +0200 |
| commit | ddcc6f0c4f5d19421ccdcfc9991a6f43ad31d881 (patch) | |
| tree | 8e073140d8ddac3aa537575924e2eaeb36056209 | |
| parent | pvmove: segment large moves (diff) | |
test: pvmove segmentationzkabelac-pvmove-segmentation
| -rw-r--r-- | test/shell/pvmove-segment-size-limit.sh | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/test/shell/pvmove-segment-size-limit.sh b/test/shell/pvmove-segment-size-limit.sh new file mode 100644 index 000000000..cb3045d5a --- /dev/null +++ b/test/shell/pvmove-segment-size-limit.sh | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | # Copyright (C) 2025 Red Hat, Inc. All rights reserved. | ||
| 4 | # | ||
| 5 | # This copyrighted material is made available to anyone wishing to use, | ||
| 6 | # modify, copy, or redistribute it subject to the terms and conditions | ||
| 7 | # of the GNU General Public License v.2. | ||
| 8 | # | ||
| 9 | # You should have received a copy of the GNU General Public License | ||
| 10 | # along with this program; if not, write to the Free Software Foundation, | ||
| 11 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 12 | |||
| 13 | test_description="test pvmove with pvmove_max_segment_size_mb limit" | ||
| 14 | |||
| 15 | . lib/inittest | ||
| 16 | |||
| 17 | # Test pvmove segment chunking with small sizes to avoid copying too much data | ||
| 18 | # We use 4MiB max segment size and 32MiB total volume size | ||
| 19 | |||
| 20 | aux prepare_pvs 4 | ||
| 21 | |||
| 22 | get_devs | ||
| 23 | |||
| 24 | # Create VG with 4MiB extent size | ||
| 25 | vgcreate -s 4M "$vg" "${DEVICES[@]}" | ||
| 26 | |||
| 27 | # Create a 36MiB striped LV on dev1+2+3 | ||
| 28 | # With 4MiB extent size, this is 3*9 extents | ||
| 29 | lvcreate -aey -L 36M -i3 -n "$lv" "$vg" | ||
| 30 | |||
| 31 | # Verify LV is on dev1+2+3 | ||
| 32 | check lv_on "$vg" "$lv" "$dev1" "$dev2" "$dev3" | ||
| 33 | |||
| 34 | # Show initial segment layout | ||
| 35 | lvs -a -o name,size,seg_pe_ranges "$vg" | ||
| 36 | |||
| 37 | # Configure pvmove_max_segment_size to 4MiB | ||
| 38 | # This should split the 36MiB LV into 3 chunks of 12MiB (3 extent) each | ||
| 39 | aux lvmconf "allocation/pvmove_max_segment_size_mb = 4" | ||
| 40 | |||
| 41 | # Run pvmove with verbose logging to see the splitting | ||
| 42 | pvmove -i0 -vvv "$dev1" "$dev4" 2>&1 | tee pvmove.log | ||
| 43 | |||
| 44 | # Check that the splitting occurred | ||
| 45 | # We expect to see "Splitting" messages in the log | ||
| 46 | grep -q "Splitting" pvmove.log || die "Expected to see segment splitting in pvmove log" | ||
| 47 | |||
| 48 | # Count how many split operations occurred | ||
| 49 | # With 36MiB LV and 4MiB->12MiB limit, we expect 3 splits (to create 3 segments) | ||
| 50 | split_count=$(grep -c "Split segment.* at LE" pvmove.log || true) | ||
| 51 | echo "Number of splits: $split_count" | ||
| 52 | |||
| 53 | lvs -ao+seg_size,seg_pe_ranges $vg | ||
| 54 | |||
| 55 | # We should see 2 splits as from 4MiB we get 12MiB as stripe aligned chunks | ||
| 56 | test "$split_count" -eq 2 || die "Expected 2 splits, got $split_count" | ||
| 57 | |||
| 58 | # Verify that the max segment size message appears | ||
| 59 | grep -q "Pvmove max segment size.*4.* extent" pvmove.log || \ | ||
| 60 | die "Expected to see max segment size configuration in log" | ||
| 61 | |||
| 62 | # Verify LV is now on dev2+3+4 | ||
| 63 | check lv_on "$vg" "$lv" "$dev2" "$dev3" "$dev4" | ||
| 64 | |||
| 65 | # Verify no pvmove LVs remain | ||
| 66 | get lv_field "$vg" name -a > out | ||
| 67 | not grep "^\[pvmove" out || die "pvmove LV still exists" | ||
| 68 | |||
| 69 | # Verify data integrity (LV should still be accessible) | ||
| 70 | lvchange -ay "$vg/$lv" | ||
| 71 | check lv_field "$vg/$lv" lv_active "active" | ||
| 72 | |||
| 73 | # Test with larger limit (no splitting expected) | ||
| 74 | |||
| 75 | # Configure with 64MiB limit (larger than our LV) | ||
| 76 | aux lvmconf "allocation/pvmove_max_segment_size_mb = 64" | ||
| 77 | |||
| 78 | # Run pvmove again | ||
| 79 | pvmove -i0 -vvv "$dev4" "$dev1" 2>&1 | tee pvmove-nosplit.log | ||
| 80 | |||
| 81 | # This time we should NOT see splitting | ||
| 82 | grep -q "within limit" pvmove-nosplit.log || \ | ||
| 83 | die "Expected to see 'within limit' message with large segment size" | ||
| 84 | |||
| 85 | # Should see zero splits | ||
| 86 | split_count_nosplit=$(grep -c "Split segment.* at LE" pvmove-nosplit.log || true) | ||
| 87 | echo "Number of splits with large limit: $split_count_nosplit" | ||
| 88 | test "$split_count_nosplit" -eq 0 || \ | ||
| 89 | die "Expected 0 splits with large limit, got $split_count_nosplit" | ||
| 90 | |||
| 91 | # Verify LV is on dev1+2+3 | ||
| 92 | check lv_on "$vg" "$lv" "$dev1" "$dev2" "$dev3" | ||
| 93 | |||
| 94 | # Test with limit disabled (0 = unlimited) | ||
| 95 | aux lvmconf "allocation/pvmove_max_segment_size_mb = 0" | ||
| 96 | |||
| 97 | pvmove -i0 -vvv "$dev1" "$dev4" 2>&1 | tee pvmove-unlimited.log | ||
| 98 | |||
| 99 | # Should not see any splitting messages | ||
| 100 | not grep -q "Splitting" pvmove-unlimited.log | ||
| 101 | |||
| 102 | # Verify final state dev2+3+4 | ||
| 103 | check lv_on "$vg" "$lv" "$dev2" "$dev3" "$dev4" | ||
| 104 | |||
| 105 | # Cleanup | ||
| 106 | vgremove -ff "$vg" | ||
