-
Notifications
You must be signed in to change notification settings - Fork 1
fix(e2e): resolve DRBD devices via drbdadm sh-dev in remaining cli-matrix cells #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,7 +50,7 @@ | |||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||
| # 2. IO during INACTIVE: | ||||||||||||||||||||||||||||||||||||
| # - Promote N1 to Primary if not already | ||||||||||||||||||||||||||||||||||||
| # - Write ~64 MiB random pattern to /dev/drbd/by-res/<RD>/0 | ||||||||||||||||||||||||||||||||||||
| # - Write ~64 MiB random pattern to the RD's /dev/drbdN device | ||||||||||||||||||||||||||||||||||||
| # - Must complete without quorum block (single-replica quorum | ||||||||||||||||||||||||||||||||||||
| # override). Capture md5 of pattern. | ||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||
|
|
@@ -153,9 +153,14 @@ wait_role "$RD" "$N1" "Primary" 30 \ | |||||||||||||||||||||||||||||||||||
| # written BEFORE the first deactivate so both replicas hold the | ||||||||||||||||||||||||||||||||||||
| # same bytes and the GI baseline is established. | ||||||||||||||||||||||||||||||||||||
| echo ">> seed initial ${IO_MIB} MiB pattern on $N1 (will be the md5 anchor)" | ||||||||||||||||||||||||||||||||||||
| # Resolve via `drbdadm sh-dev` (lib.sh resolve_drbd_device): the | ||||||||||||||||||||||||||||||||||||
| # /dev/drbd/by-res symlink is not reliably present in the satellite | ||||||||||||||||||||||||||||||||||||
| # mount namespace, so readlink-based resolution aborts on the stand. | ||||||||||||||||||||||||||||||||||||
| # Last-resort minor enumeration kept for stands where sh-dev fails. | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/${RD}/0 2>/dev/null || true) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
|
@@ -289,9 +294,11 @@ for cycle in 1 2 3; do | |||||||||||||||||||||||||||||||||||
| # the sole voter and DRBD's single-replica quorum override must | ||||||||||||||||||||||||||||||||||||
| # let writes through. A failure here = quorum frame is wrong on | ||||||||||||||||||||||||||||||||||||
| # INACTIVE peers. | ||||||||||||||||||||||||||||||||||||
| # Same portable resolver as the seeding step (sh-dev, not by-res). | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| io_out=$(on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/${RD}/0 2>/dev/null || true) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
299
to
304
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved, the
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -317,8 +324,9 @@ for cycle in 1 2 3; do | |||||||||||||||||||||||||||||||||||
| # — the deactivate path must not have corrupted it. (md5 of the | ||||||||||||||||||||||||||||||||||||
| # FIRST ${IO_MIB} MiB of the device, since the seed lives at | ||||||||||||||||||||||||||||||||||||
| # offset 0 and the new write was at offset ${IO_MIB} MiB.) | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| seed_md5_now=$(on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/${RD}/0 2>/dev/null || true) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
328
to
332
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved,
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -424,8 +432,9 @@ for cycle in 1 2 3; do | |||||||||||||||||||||||||||||||||||
| # the pre-deact pattern. The partial-sync handshake must not | ||||||||||||||||||||||||||||||||||||
| # have written stale bytes onto the surviving replica's data. | ||||||||||||||||||||||||||||||||||||
| echo ">> md5 of seed on $N1 still matches pre-deact pattern" | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| seed_md5_after=$(on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/${RD}/0 2>/dev/null || true) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
436
to
440
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved,
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,9 +91,14 @@ on_node "$N1" drbdadm primary --force "$RD" 2>/dev/null || true | |||||||||||||||||||||||||||||||||||
| # capture (one snap took data at byte N, the other at byte N+delta) | ||||||||||||||||||||||||||||||||||||
| # yields visibly different md5. | ||||||||||||||||||||||||||||||||||||
| echo ">> seed deterministic 256 MiB pattern on $N1's DRBD device" | ||||||||||||||||||||||||||||||||||||
| # Resolve via `drbdadm sh-dev` (lib.sh resolve_drbd_device): the | ||||||||||||||||||||||||||||||||||||
| # /dev/drbd/by-res symlink is not reliably present in the satellite | ||||||||||||||||||||||||||||||||||||
| # mount namespace, so readlink-based resolution aborts on the stand. | ||||||||||||||||||||||||||||||||||||
| # Last-resort minor enumeration kept for stands where sh-dev fails. | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/$RD/0 2>/dev/null || true) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
99
to
104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved, the script will proceed to run
Suggested change
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -111,8 +116,10 @@ wait_uptodate "$RD" "$N1" "$N2" | |||||||||||||||||||||||||||||||||||
| # AFTER replica $N1 already finished its snapshot — and the two | ||||||||||||||||||||||||||||||||||||
| # resulting snapshots reflect that delta. | ||||||||||||||||||||||||||||||||||||
| echo ">> start continuous writer on $N1 (urandom → DRBD device)" | ||||||||||||||||||||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||||||||||||||||||||
| on_node "$N1" bash -c " | ||||||||||||||||||||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/$RD/0 2>/dev/null || ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
| dev='$dev' | ||||||||||||||||||||||||||||||||||||
| [ -n \"\$dev\" ] || dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
120
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved, the background writer
Suggested change
|
||||||||||||||||||||||||||||||||||||
| while true; do | ||||||||||||||||||||||||||||||||||||
| dd if=/dev/urandom of=\$dev bs=4K count=128 oflag=direct status=none 2>/dev/null || break | ||||||||||||||||||||||||||||||||||||
| done >/tmp/cli-matrix-snap-writer.log 2>&1 & | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -115,9 +115,14 @@ on_node "$N1" drbdadm primary --force "$RD" 2>/dev/null || true | |||||||||||||||||
| # We therefore read the device's actual byte size and feed dd via | ||||||||||||||||||
| # count_bytes so the write stops exactly at the DRBD boundary. | ||||||||||||||||||
| echo ">> Phase 2: seed deterministic random pattern on $N1 (DRBD-fit bytes), then start writer" | ||||||||||||||||||
| # Resolve via `drbdadm sh-dev` (lib.sh resolve_drbd_device): the | ||||||||||||||||||
| # /dev/drbd/by-res symlink is not reliably present in the satellite | ||||||||||||||||||
| # mount namespace, so readlink-based resolution aborts on the stand. | ||||||||||||||||||
| # Last-resort minor enumeration kept for stands where sh-dev fails. | ||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||
| seed_out=$(on_node "$N1" bash -c " | ||||||||||||||||||
| set -e | ||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/$RD/0 2>/dev/null || true) | ||||||||||||||||||
| dev='$dev' | ||||||||||||||||||
| if [ -z \"\$dev\" ]; then | ||||||||||||||||||
| dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
@@ -136,8 +141,10 @@ echo "$seed_out" | |||||||||||||||||
| wait_uptodate "$RD" "$N1" "$N2" | ||||||||||||||||||
|
|
||||||||||||||||||
| echo ">> Phase 2: start continuous writer on $N1" | ||||||||||||||||||
| dev=$(resolve_drbd_device "$N1" "$RD" 0 2>/dev/null) || dev="" | ||||||||||||||||||
| on_node "$N1" bash -c " | ||||||||||||||||||
| dev=\$(readlink -f /dev/drbd/by-res/$RD/0 2>/dev/null || ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||
| dev='$dev' | ||||||||||||||||||
| [ -n \"\$dev\" ] || dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1) | ||||||||||||||||||
|
Comment on lines
145
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the DRBD device cannot be resolved, the background writer
Suggested change
|
||||||||||||||||||
| while true; do | ||||||||||||||||||
| dd if=/dev/urandom of=\$dev bs=4K count=128 oflag=direct status=none 2>/dev/null || break | ||||||||||||||||||
| done >/tmp/cli-matrix-snap-lifecycle-writer.log 2>&1 & | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the DRBD device cannot be resolved (both
resolve_drbd_deviceand the fallbacklsreturn empty), the script will proceed to runddwith an emptyof=parameter, causing a syntax error. Adding an explicit check ensures the script fails early with a clear error message.