Commit de66e80
committed
tmt: Fix stale loop partition state in multi-device ESP test
The three-devices-partial-ESP scenario fails with "No device found for
/dev/loop1p1" because the dual-ESP test's cleanup leaves stale kernel
partition nodes and LVM device registrations.
The prior cleanup called `pvremove -f $loop` on the loop device itself
(e.g. /dev/loop0) instead of on the partitions where PVs actually live
(e.g. /dev/loop0p2), making it a no-op. After `losetup -d`, the
kernel retained busy partition nodes. When the next test reused the
loop device with a different partition layout, `partx -u` tried to
atomically reconcile old and new partitions — but could not remove the
busy stale partition #2, so it aborted entirely without adding the new
partition #1.
Fix both cleanup and setup:
Cleanup:
- pvremove on actual partition devices (p1/p2/p3), not the loop device
- wipefs -a on each partition to clear signatures holding references
- udevadm settle to let udev finish processing
- partx -d to remove kernel partition entries before losetup -d
- Remove /etc/lvm/devices/system.devices to clear stale device IDs
Setup (setup_disk_with_partitions, setup_disk_with_root):
- Replace `partx -u` with `partx -d` (ignore errors) then `partx -a`,
so a stuck stale partition does not block adding new ones
- Replace `sleep 1sec` with `udevadm settle` for reliable synchronization
Co-Authored-By: Claude Opus 4.6
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>1 parent 2789485 commit de66e80
1 file changed
Lines changed: 23 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| |||
101 | 113 | | |
102 | 114 | | |
103 | 115 | | |
104 | | - | |
105 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
106 | 119 | | |
107 | 120 | | |
108 | 121 | | |
| |||
0 commit comments