Skip to content

[4.19] [Storage] Use ssh retries in run_ssh_commands (#4471) #4730

Open
jpeimer wants to merge 3 commits intoRedHatQE:cnv-4.19from
jpeimer:419_use_ssh_retries
Open

[4.19] [Storage] Use ssh retries in run_ssh_commands (#4471) #4730
jpeimer wants to merge 3 commits intoRedHatQE:cnv-4.19from
jpeimer:419_use_ssh_retries

Conversation

@jpeimer
Copy link
Copy Markdown
Contributor

@jpeimer jpeimer commented May 4, 2026

Short description:

Backport: #4471

More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:

jpeimer and others added 2 commits May 4, 2026 17:33
…edHatQE#4597)

Backport:
RedHatQE#4471

<!-- full-ticket-url needs to be provided. This would add a link to the
pull request to the jira and close it when the pull request is merged
If the task is not tracked by a Jira ticket, just write "NONE".
-->

---------

Signed-off-by: Jenia Peimer <jpeimer@redhat.com>
Signed-off-by: rnetser <rnetser@redhat.com>
Signed-off-by: Nir Dothan <ndothan@redhat.com>
Signed-off-by: Yossi Segev <ysegev@redhat.com>
Co-authored-by: Ruth Netser <rnetser@redhat.com>
Co-authored-by: Nir Dothan <ndothan@redhat.com>
Co-authored-by: Yossi Segev <40713576+yossisegev@users.noreply.github.com>
Signed-off-by: Jenia Peimer <jpeimer@redhat.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0328123e-c81a-45ad-a0c4-934b2bb77689

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@jpeimer jpeimer marked this pull request as ready for review May 4, 2026 14:43
@openshift-virtualization-qe-bot-4
Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest verify-bugs-are-open - verify-bugs-are-open
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Ahmad-Hafe
  • RoniKishner
  • acinko-rh
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • geetikakay
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@vsibirsk
Copy link
Copy Markdown
Collaborator

vsibirsk commented May 4, 2026

/approve

@rnetser
Copy link
Copy Markdown
Collaborator

rnetser commented May 4, 2026

/approve
/lgtm

@kshvaika
Copy link
Copy Markdown
Contributor

kshvaika commented May 4, 2026

/lgtm

@jpeimer
Copy link
Copy Markdown
Contributor Author

jpeimer commented May 5, 2026

/build-and-push-container

@jpeimer
Copy link
Copy Markdown
Contributor Author

jpeimer commented May 5, 2026

/build-and-push-container

@openshift-virtualization-qe-bot
Copy link
Copy Markdown

New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4730 published

1 similar comment
@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4730 published

@rnetser
Copy link
Copy Markdown
Collaborator

rnetser commented May 5, 2026

/approve
/lgtm

@jpeimer
Copy link
Copy Markdown
Contributor Author

jpeimer commented May 5, 2026

/verified
openshift-virtualization-tests-runner/5134
-k "test_snapshots.py or test_vm_export.py or test_online_resize.py or test_storage_class_migration.py" --storage-class-matrix=ocs-storagecluster-ceph-rbd-virtualization

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Comment thread tests/storage/snapshots/conftest.py
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get changed files in the PR
gh pr view 4730 --repo RedHatQE/openshift-virtualization-tests --json files --jq '.files[].path'
echo "---DIFF---"
gh pr diff 4730 --repo RedHatQE/openshift-virtualization-tests

Length of output: 17334


🏁 Script executed:

#!/bin/bash
# Check for smoke test markers in affected files
echo "=== Smoke markers in affected test files ==="
rg -n "pytest.mark.smoke" tests/storage/snapshots/test_snapshots.py tests/storage/test_online_resize.py tests/storage/vm_export/test_vm_export.py tests/storage/storage_migration/ 2>/dev/null

echo ""
echo "=== Check smoke tests that import from utilities/storage.py ==="
rg -rn "pytest.mark.smoke" tests/storage/ --include="*.py" -l

echo ""
echo "=== Check all smoke tests that import run_command_on_vm_and_check_output, write_file_via_ssh, assert_disk_serial, check_disk_count_in_vm ==="
rg -rn "from utilities.storage import.*run_command_on_vm_and_check_output|from utilities.storage import.*write_file_via_ssh|from utilities.storage import.*assert_disk_serial|from utilities.storage import.*check_disk_count_in_vm" --include="*.py"

echo ""
echo "=== First changed line in first file ==="
gh pr diff 4730 --repo RedHatQE/openshift-virtualization-tests | grep "^@@" | head -5

Length of output: 1421


🏁 Script executed:

#!/bin/bash
echo "=== Smoke markers in affected test files ==="
rg -n "pytest.mark.smoke" tests/storage/snapshots/test_snapshots.py tests/storage/test_online_resize.py tests/storage/vm_export/test_vm_export.py tests/storage/storage_migration/

echo ""
echo "=== Check smoke tests in storage dir ==="
rg -rn "pytest.mark.smoke" tests/storage/ -l

echo ""
echo "=== Check files importing changed utilities ==="
rg -rn "from utilities\.storage import" tests/storage/ -l

echo ""
echo "=== Get line number of first change in first file ==="
# First changed file is tests/storage/snapshots/conftest.py, first hunk at line 20
head -25 tests/storage/snapshots/conftest.py

Length of output: 2718


🏁 Script executed:

#!/bin/bash
# Check if smoke test files import the specifically modified functions
echo "=== Check if smoke test files use modified ssh functions ==="
for f in tests/storage/cdi_upload/test_upload_virtctl.py tests/storage/cdi_import/test_import_http.py tests/storage/cdi_import/test_import_registry.py tests/storage/cdi_clone/test_clone.py; do
  echo "--- $f ---"
  rg -n "write_file_via_ssh|run_command_on_vm_and_check_output|assert_disk_serial|check_disk_count_in_vm|run_ssh_commands" "$f" 2>/dev/null || echo "(none)"
done

echo ""
echo "=== Get PR commit SHA for inline comment ==="
gh pr view 4730 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid'

Length of output: 938


🏁 Script executed:

#!/bin/bash
echo "=== Smoke tests using check_disk_count_in_vm ==="
for f in tests/storage/cdi_upload/test_upload_virtctl.py tests/storage/cdi_import/test_import_registry.py tests/storage/cdi_clone/test_clone.py; do
  echo "--- $f ---"
  # Show smoke markers with surrounding context to find test names
  rg -n "smoke|check_disk_count_in_vm" "$f" | head -30
done

echo ""
echo "=== Post inline comment via GitHub API ==="
COMMIT_ID="9ec58a7caa8aef7056f43223045bf42f4dc57ac8"
REPO="RedHatQE/openshift-virtualization-tests"
PR_NUMBER=4730

BODY="**Test Execution Plan**

- **Run smoke tests: True**
  _Dependency path: smoke tests in \`test_upload_virtctl.py\`, \`test_import_registry.py\`, \`test_clone.py\` → \`check_disk_count_in_vm\` (modified in \`utilities/storage.py\` to add SSH retry params)_

- \`tests/storage/snapshots/test_snapshots.py\`
- \`tests/storage/test_online_resize.py\`
- \`tests/storage/vm_export/test_vm_export.py\`
- \`tests/storage/storage_migration/\` (full directory — conftest + utils modified)
- \`-m smoke\` — \`check_disk_count_in_vm\` now has retry logic; verify smoke tests in \`test_upload_virtctl.py\`, \`test_import_registry.py\`, \`test_clone.py\`"

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  /repos/${REPO}/pulls/${PR_NUMBER}/comments \
  -f body="${BODY}" \
  -f commit_id="${COMMIT_ID}" \
  -f path="tests/storage/snapshots/conftest.py" \
  -F line=20 \
  -f side="RIGHT"

Length of output: 4118


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants