Skip to content

Lvms timeout - #50

Merged
masco merged 1 commit into
mainfrom
lvms-timeout
Jul 16, 2026
Merged

masco merged 1 commit into
mainfrom
lvms-timeout

Conversation

@masco

@masco masco commented Jul 16, 2026

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved LVM cluster readiness checks with clearer progress reporting.
    • Added early failure detection for failed or degraded cluster states.
    • Enhanced diagnostic output when readiness checks fail.
    • Added handling for unexpected cluster states to prevent misleading success results.

Walkthrough

The LVMCluster readiness task now polls .status.state with bounded retries, logs progress, reports diagnostics for failure states, rejects unexpected states, and retains changed_when: false.

Changes

LVMCluster readiness polling

Layer / File(s) Summary
State-based readiness wait
ansible/roles/lvms/tasks/main.yml
Replaces the asynchronous .status.ready loop with a strict shell loop that polls .status.state, handles terminal and transitional states, logs attempts, and emits YAML diagnostics for failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so there is nothing to assess against the changeset. Add a brief description of the LVMS wait/timeout behavior change so reviewers can confirm the intent.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is related to the main change because it points to the LVMS timeout/wait logic update, though it is broad.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ansible/roles/lvms/tasks/main.yml`:
- Around line 63-64: Configure the ansible.builtin.shell task containing the
`set -euo pipefail` loop to use `/bin/bash` via `args.executable`, preserving
the existing strict-shell behavior and retry loop.
- Line 65: Update the LVM cluster state check around the oc command to stop
unconditionally masking failures with || true. Capture and inspect oc’s exit
status, retry only the expected transient or not-found condition, and
immediately surface authentication, RBAC, context, and other API errors instead
of treating them as an empty status state.
- Line 65: Bound every oc request in the readiness probe, including the state
check and failure-path oc get ... -o yaml, with an explicit --request-timeout
value so no individual API call can block the retry loop indefinitely. Update
the relevant shell commands in the task while preserving the existing retry and
error-handling behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: cf3be300-ee77-4e24-98d6-bc1cbd0d07b0

📥 Commits

Reviewing files that changed from the base of the PR and between a583216 and 05072a3.

📒 Files selected for processing (1)
  • ansible/roles/lvms/tasks/main.yml

Comment on lines +63 to +64
set -euo pipefail
for i in $(seq 1 360); do

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
rg -n --hidden -g '*.yml' -g '*.yaml' -g 'ansible.cfg' \
  'ansible_shell_executable|module_defaults|executable:' . || true

Repository: redhat-performance/JetBrew

Length of output: 644


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== ansible/roles/lvms/tasks/main.yml =="
cat -n ansible/roles/lvms/tasks/main.yml | sed -n '1,180p'

echo
echo "== shell/executable config hits in lvms role =="
rg -n --hidden -g 'ansible/roles/lvms/**' -g 'ansible.cfg' \
  'ansible_shell_executable|module_defaults|executable:' .

echo
echo "== ansible.cfg if present =="
fd -a 'ansible.cfg' .

Repository: redhat-performance/JetBrew

Length of output: 3569


Pin the shell to bash here. ansible.builtin.shell runs under /bin/sh by default, and set -euo pipefail fails on shells without pipefail support. Add args.executable: /bin/bash or remove pipefail.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ansible/roles/lvms/tasks/main.yml` around lines 63 - 64, Configure the
ansible.builtin.shell task containing the `set -euo pipefail` loop to use
`/bin/bash` via `args.executable`, preserving the existing strict-shell behavior
and retry loop.

Source: Path instructions

poll: 5
set -euo pipefail
for i in $(seq 1 360); do
state="$(oc get lvmcluster lvmcluster -n openshift-storage -o jsonpath='{.status.state}' 2>/dev/null || true)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
rg -n -C3 -- 'status\.state|2>/dev/null|\|\| true' \
  ansible/roles/lvms/tasks/main.yml

Repository: redhat-performance/JetBrew

Length of output: 1053


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Show the full wait loop around the flagged line.
sed -n '58,82p' ansible/roles/lvms/tasks/main.yml

printf '\n--- shell semantics probe ---\n'
bash -lc 'set -euo pipefail; state="$(false 2>/dev/null || true)"; rc=$?; printf "rc=%s state=%q\n" "$rc" "$state"'

printf '\n--- masked-failure probe with command substitution ---\n'
bash -lc 'set -euo pipefail; state="$(sh -c '\''echo auth-error >&2; exit 1'\'' 2>/dev/null || true)"; printf "state=%q\n" "$state"'

Repository: redhat-performance/JetBrew

Length of output: 1048


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Confirm whether the retry loop is 30 minutes or 60 minutes.
python3 - <<'PY'
attempts = 360
sleep_seconds = 5
print(attempts * sleep_seconds)
PY

Repository: redhat-performance/JetBrew

Length of output: 169


Do not swallow oc failures here. || true makes auth, RBAC, missing-context, and API errors look like an empty .status.state, so the loop will keep retrying for up to 30 minutes instead of surfacing the real failure. Capture the exit code and only retry the expected transient/not-found case.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ansible/roles/lvms/tasks/main.yml` at line 65, Update the LVM cluster state
check around the oc command to stop unconditionally masking failures with ||
true. Capture and inspect oc’s exit status, retry only the expected transient or
not-found condition, and immediately surface authentication, RBAC, context, and
other API errors instead of treating them as an empty status state.

Source: Path instructions


🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
rg -n -C2 -- '--request-timeout|oc get' \
  ansible/roles/lvms/tasks/main.yml
if command -v oc >/dev/null 2>&1; then
  oc options 2>&1 | rg -- '--request-timeout' || true
fi

Repository: redhat-performance/JetBrew

Length of output: 1998


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sed -n '55,80p' ansible/roles/lvms/tasks/main.yml

printf '\n---\n'

rg -n -- '--request-timeout|timeout|until:|retries:|delay:' ansible/roles/lvms/tasks/main.yml

Repository: redhat-performance/JetBrew

Length of output: 1441


🌐 Web query:

oc request-timeout default oc get --request-timeout kubernetes client command line

💡 Result:

The default value for the --request-timeout flag in both the oc and kubectl command-line tools is "0" [1][2][3]. In the context of these tools, a value of "0" signifies that there is no timeout, meaning the client will not give up on a server request based on a duration limit [4][1][5]. Key technical details: - Behavior: When the flag is set to "0", the command will wait indefinitely for a response, which is the standard behavior for long-running operations like watching resources [5]. - Usage: If a non-zero value is provided (e.g., 1s, 2m, 3h), the client will enforce that duration as a timeout for the server request [4][1]. - Implementation: The kubernetes/client-go library manages these timeouts [6][7]. While the flag defaults to "0", internal client configurations and specific API request types (such as watches vs. standard GET requests) may involve nuanced handling to balance responsiveness and reliability [8][9]. If you encounter unexpected timeouts, ensure you are not passing a conflicting value in your configuration or environment variables, as the CLI flag explicitly overrides default behaviors when set [5].

Citations:


Bound each oc request with a timeout.
oc get defaults to no client-side timeout, so a stuck API call can block the 360-attempt loop forever. Apply --request-timeout to the readiness check and the failure-path oc get ... -o yaml, or wrap the whole probe in an outer wall-clock deadline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ansible/roles/lvms/tasks/main.yml` at line 65, Bound every oc request in the
readiness probe, including the state check and failure-path oc get ... -o yaml,
with an explicit --request-timeout value so no individual API call can block the
retry loop indefinitely. Update the relevant shell commands in the task while
preserving the existing retry and error-handling behavior.

Source: Path instructions

@masco
masco merged commit 8b8ad58 into main Jul 16, 2026
2 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