Skip to content

fix(e2e): resolve DRBD devices via drbdadm sh-dev in remaining cli-matrix cells#141

Merged
Andrei Kvapil (kvaps) merged 2 commits into
mainfrom
fix/cells-sh-dev-resolver
Jun 12, 2026
Merged

fix(e2e): resolve DRBD devices via drbdadm sh-dev in remaining cli-matrix cells#141
Andrei Kvapil (kvaps) merged 2 commits into
mainfrom
fix/cells-sh-dev-resolver

Conversation

@kvaps

Copy link
Copy Markdown
Member

What

Migrates the 9 remaining cli-matrix cells that still resolved DRBD devices through the /dev/drbd/by-res symlink (either readlink -f or a direct dd against the symlink path) to the shared resolve_drbd_device helper in tests/e2e/cli-matrix/lib.sh, following the same pattern as the already-fixed snap-restore-snapshotless-node-rejected.sh cell.

Cells migrated:

  • snap-full-lifecycle.sh — seed write + continuous writer
  • snap-create-multiple-lifecycle.sh — 3-RD correlated writer
  • snap-cross-node-consistency.sh — seed write + continuous writer
  • snap-create-multiple-group-consistency.sh — 2-RD correlated writer
  • snap-r-rst-stamps-resources.sh — marker seed + restored-replica marker read
  • snap-suspend-resume-isolation-u138-u52.shwrite_survives post-snapshot write probe
  • r-activate-deactivate-lifecycle.sh — seed write + per-cycle INACTIVE write and two md5 anchor reads
  • r-d-last-uptodate-midsync-rejected.sh — GI-bump write before the mid-sync window
  • r-c-over-tiebreaker-skip-sync.sh — post-tiebreaker mutation write

Why

The by-res symlink is not reliably present in the satellite mount namespace on the stand, so these resolution sites either abort the cell or (for the direct-dd sites with suppressed stderr) silently skip the write that the scenario depends on. drbdadm sh-dev resolves the /dev/drbdN path without depending on the symlink — the same root cause and fix as the snap-restore cell.

Scope notes

  • Resolver-mechanics-only change: every assertion, failure message, and best-effort/fatal semantics is preserved as-is.
  • Cells that already had a last-resort ls /dev/drbd* minor-enumeration fallback (snap-full-lifecycle, snap-cross-node-consistency, r-activate-deactivate-lifecycle) keep it as a secondary path after the helper, since it covers stands where sh-dev itself fails; the helper is now the primary resolver everywhere.
  • In the two direct-dd cells the write is still best-effort (|| true), but an unresolved device is now guarded explicitly instead of dd failing against a dangling symlink path.

Validation

  • bash -n clean on all 9 cells.
  • shellcheck: only pre-existing findings (SC1091 lib.sh sourcing info on all cells, SC2016/SC2034 already present on main).
  • No readlink -f /dev/drbd/by-res or bare by-res reliance remains in any churn path; remaining by-res mentions are explanatory comments only.

…trix cells

Migrate the 9 remaining cli-matrix cells that still resolved DRBD
devices through the /dev/drbd/by-res symlink (readlink or direct dd)
to the shared resolve_drbd_device helper from lib.sh, the same way
the snap-restore cell was fixed. The by-res symlink is not reliably
present in the satellite mount namespace, so those resolution sites
fail or silently no-op on the stand.

Assertions are unchanged; only the resolver mechanics moved. The
last-resort /dev/drbd* minor-enumeration fallbacks are kept where
they already existed.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kvaps, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 57 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec87bb18-d84a-4a76-89bf-1ccb0a7d22ee

📥 Commits

Reviewing files that changed from the base of the PR and between 960f414 and bf600e5.

📒 Files selected for processing (9)
  • tests/e2e/cli-matrix/r-activate-deactivate-lifecycle.sh
  • tests/e2e/cli-matrix/r-c-over-tiebreaker-skip-sync.sh
  • tests/e2e/cli-matrix/r-d-last-uptodate-midsync-rejected.sh
  • tests/e2e/cli-matrix/snap-create-multiple-group-consistency.sh
  • tests/e2e/cli-matrix/snap-create-multiple-lifecycle.sh
  • tests/e2e/cli-matrix/snap-cross-node-consistency.sh
  • tests/e2e/cli-matrix/snap-full-lifecycle.sh
  • tests/e2e/cli-matrix/snap-r-rst-stamps-resources.sh
  • tests/e2e/cli-matrix/snap-suspend-resume-isolation-u138-u52.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cells-sh-dev-resolver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces unreliable /dev/drbd/by-res symlink lookups with a more portable resolver (resolve_drbd_device using drbdadm sh-dev) across multiple end-to-end test scripts. The review feedback highlights several instances where a failure to resolve the DRBD device path could lead to syntax errors, silent background failures, or hangs during dd operations. It is recommended to add explicit validation checks to fail early with clear error messages if the device path remains empty.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 120 to +122
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If the DRBD device cannot be resolved, the background writer dd command will fail immediately, causing the background loop to exit silently. This means the test will run without any active background writes, defeating the purpose of the concurrency test. Adding an explicit check before backgrounding ensures the writer launch fails visibly.

Suggested change
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)
on_node "$N1" bash -c "
dev='$dev'
[ -n \"\$dev\" ] || dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
[ -z \"\$dev\" ] && { echo 'no drbd device node' >&2; exit 1; }

Comment on lines 145 to +147
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If the DRBD device cannot be resolved, the background writer dd command will fail immediately, causing the background loop to exit silently. This means the test will run without any active background writes, defeating the purpose of the concurrency test. Adding an explicit check before backgrounding ensures the writer launch fails visibly.

Suggested change
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)
on_node "$N1" bash -c "
dev='$dev'
[ -n \"\$dev\" ] || dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
[ -z \"\$dev\" ] && { echo 'no drbd device node' >&2; exit 1; }

Comment on lines 161 to 166
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the DRBD device cannot be resolved (both resolve_drbd_device and the fallback ls return empty), the script will proceed to run dd with an empty of= parameter, causing a syntax error. Adding an explicit check ensures the script fails early with a clear error message.

Suggested change
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
on_node "$N1" bash -c "
set -e
dev='$dev'
if [ -z \"\$dev\" ]; then
dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
fi
if [ -z \"\$dev\" ]; then
echo 'no drbd device node' >&2
exit 1
fi

Comment on lines 299 to 304
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the DRBD device cannot be resolved, the dd command will fail with a syntax error, resulting in a confusing failure. Explicitly checking for an empty device path ensures a clear error message.

Suggested change
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
io_out=\$(on_node "$N1" bash -c "
set -e
dev='$dev'
if [ -z \"\$dev\" ]; then
dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
fi
if [ -z \"\$dev\" ]; then
echo 'no drbd device node' >&2
exit 1
fi

Comment on lines 328 to 332
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the DRBD device cannot be resolved, dd if=\$dev will run without an if parameter, causing it to read from standard input. This can hang or return an empty stream, leading to a confusing MD5 mismatch failure instead of a clear device resolution error.

Suggested change
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
seed_md5_now=\$(on_node "$N1" bash -c "
dev='$dev'
if [ -z \"\$dev\" ]; then
dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
fi
if [ -z \"\$dev\" ]; then
echo 'no drbd device node' >&2
exit 1
fi

Comment on lines 436 to 440
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the DRBD device cannot be resolved, dd if=\$dev will read from standard input, leading to a confusing MD5 mismatch failure. Adding an explicit check ensures the script fails early with a clear error message.

Suggested change
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
seed_md5_after=\$(on_node "$N1" bash -c "
dev='$dev'
if [ -z \"\$dev\" ]; then
dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
fi
if [ -z \"\$dev\" ]; then
echo 'no drbd device node' >&2
exit 1
fi

Comment on lines 99 to 104
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the DRBD device cannot be resolved, the script will proceed to run dd with an empty of= parameter, causing a syntax error. Adding an explicit check ensures the script fails early with a clear error message.

Suggested change
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
on_node "$N1" bash -c "
set -e
dev='$dev'
if [ -z \"\$dev\" ]; then
dev=\$(ls -1 /dev/drbd* 2>/dev/null | grep -vE 'by-(res|disk)' | head -1)
fi
if [ -z \"\$dev\" ]; then
echo 'no drbd device node' >&2
exit 1
fi

@kvaps Andrei Kvapil (kvaps) merged commit c50ede1 into main Jun 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant