Skip to content

[Storage/Network] Specify architecture for internal HTTP server for multiarch clusters - #5813

Merged
rnetser merged 8 commits into
RedHatQE:mainfrom
jpeimer:internal_http_server_arch
Aug 11, 2026
Merged

[Storage/Network] Specify architecture for internal HTTP server for multiarch clusters#5813
rnetser merged 8 commits into
RedHatQE:mainfrom
jpeimer:internal_http_server_arch

Conversation

@jpeimer

@jpeimer jpeimer commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
What this PR does / why we need it:

On multi-arch clusters with a single --cpu-arch target, the internal HTTP server pod could be scheduled on a node with the wrong architecture.

This PR:

  • Adds a nodeSelector with kubernetes.io/arch to the internal HTTP server Deployment so it lands on the correct architecture node.
  • Extracts the duplicated py_config["cpu_arch"] + cluster_type == MULTIARCH check (repeated in utilities/storage.py, tests/storage/conftest.py, and libs/vm/factory.py) into a single get_multiarch_cpu_arch() function in utilities/architecture.py.
Which issue(s) this PR fixes:

Failures on multi-arch clusters that run wit single requested arch.

Special notes for reviewer:
jira-ticket:

Summary by CodeRabbit

  • Bug Fixes
    • Improved multi-architecture cluster handling when creating virtual machines and storage resources.
    • Registry-based storage volumes now receive the appropriate CPU architecture metadata.
    • Storage deployments are scheduled onto compatible nodes when architecture information is available.
    • Improved consistency in default CPU architecture detection across deployment workflows.
    • Enhanced handling for environments where architecture information is unavailable or not applicable.

jpeimer added 4 commits July 22, 2026 10:53
On multi-arch clusters with a single --cpu-arch target, the internal
HTTP server pod must be scheduled on a node matching the target
architecture. Add a nodeSelector using kubernetes.io/arch label when
both cpu_arch is set and cluster_type is multiarch.

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Jenia Peimer <jpeimer@redhat.com>
…ted multiarch check

The pattern `py_config.get("cpu_arch") + cluster_type == MULTIARCH` was
duplicated across utilities/storage.py, tests/storage/conftest.py, and
libs/vm/factory.py. Extract it into a single function in
utilities/architecture.py and update all call sites.

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Jenia Peimer <jpeimer@redhat.com>
The constants modules (architecture.py, cluster.py) have no imports from
utilities/, so there is no circular dependency risk. Remove the lazy
imports and TODO comments.

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Jenia Peimer <jpeimer@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Multi-architecture architecture handling

Layer / File(s) Summary
Shared multi-architecture helper
utilities/architecture.py, utilities/unittests/test_architecture.py
Adds get_multiarch_cpu_arch() and tests multiarch, non-multiarch, missing, and empty configurations.
VM and registry architecture propagation
libs/vm/factory.py, utilities/storage.py, utilities/unittests/test_storage.py
VM defaults and registry data-volume sources now use the shared architecture helper.
Architecture-aware storage deployment
tests/storage/conftest.py
Deep-copies the internal HTTP deployment template and conditionally applies the Kubernetes architecture node selector.

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

Possibly related PRs

Suggested labels: new-tests

Suggested reviewers: vsibirsk, rnetser, dshchedr

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The 86-character title clearly describes specifying the internal HTTP server architecture for multi-architecture clusters and meets the length requirement.
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.
Pr Template Sections ✅ Passed The live PR body contains all four required headings. The first section has meaningful rationale and change details; the other sections are present and may be empty.
Stp Link Required ✅ Passed The PR diff adds no test files or test functions under tests/. It only adds fixture logic in tests/storage/conftest.py; utilities/unittests are excluded.
Stp Scenario Coverage ✅ Passed The PR modifies tests/storage/conftest.py, not a test_*.py file; the other modified tests are under utilities/unittests/, which the check explicitly skips.
✨ 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.

@openshift-virtualization-qe-bot

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 (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /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
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

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
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

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:

  • EdDev
  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Acedus
  • Ahmad-Hafe
  • Anatw
  • Dsanatar
  • EdDev
  • RoniKishner
  • acinko-rh
  • akalenyu
  • awels
  • azhivovk
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • frenzyfriday
  • geetikakay
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • nirdothan
  • orelmisan
  • rnetser
  • servolkov
  • vsibirsk
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6-1m)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 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

📌 Additional Information

Custom Commands:

  • /test-plan — Triggers CodeRabbit to analyze the PR's changed files and post a test execution plan
  • /rerun-smoke — Adds retest-smoke label on the PR to trigger smoke tests execution

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
tests/storage/conftest.py (2)

6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

MEDIUM: Use a specific import for deepcopy.

The new import copy violates the repository import rule. Use from copy import deepcopy and update the deep-copy call. This preserves the behavior and complies with the required import style.

As per coding guidelines, prefer specific imports and do not use bare import module statements.

🤖 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 `@tests/storage/conftest.py` at line 6, Replace the bare copy import with a
specific deepcopy import, then update the deep-copy call sites in the test
fixture to use the imported symbol directly while preserving existing behavior.

Source: Coding guidelines


238-246: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

HIGH: Pass the configured HCO namespace to ResourceEditorValidateHCOReconcile.

hco_namespace is injected here, but the constructor call does not pass it. ResourceEditorValidateHCOReconcile defaults to "openshift-cnv", while tests/conftest.py::hco_namespace uses py_config["hco_namespace"]. When the configured namespace differs, reconciliation checks run against the wrong namespace.

Pass hco_namespace=hco_namespace.name.

Proposed fix
 with ResourceEditorValidateHCOReconcile(
     admin_client=admin_client,
+    hco_namespace=hco_namespace.name,
     patches={

The unused-argument warning from Ruff is valid here because this fixture should supply the namespace to the reconciliation helper.

🤖 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 `@tests/storage/conftest.py` around lines 238 - 246, Update the
ResourceEditorValidateHCOReconcile constructor call in
cdi_config_upload_proxy_overridden to pass the injected configured namespace as
hco_namespace=hco_namespace.name, ensuring reconciliation uses the test
configuration instead of the helper’s default.

Source: Linters/SAST tools

utilities/architecture.py (1)

25-27: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

MEDIUM: Resolve the import cycle instead of adding linter suppressions.

These imports are inside functions and add # noqa: PLC0415. The PR objective identifies the circular dependency as the reason. Refactor the dependency boundary so KUBERNETES_ARCH_LABEL and MULTIARCH can be imported at module scope. If the lazy imports must remain, obtain explicit approval for the exception.

As per coding guidelines, Python files must not add linter suppressions and imports must remain at module scope. Based on learnings, the temporary # noqa: PLC0415 exception applies only to documented lint-rule-enablement work for pre-existing violations.

Also applies to: 58-60

🤖 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 `@utilities/architecture.py` around lines 25 - 27, Refactor the dependency
boundary in utilities/architecture.py so KUBERNETES_ARCH_LABEL and MULTIARCH are
importable at module scope, then move their imports out of the affected
functions and remove the PLC0415 suppressions and temporary TODO. Preserve the
existing architecture behavior while ensuring no new in-function imports remain.

Sources: Coding guidelines, Learnings

🤖 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.

Outside diff comments:
In `@tests/storage/conftest.py`:
- Line 6: Replace the bare copy import with a specific deepcopy import, then
update the deep-copy call sites in the test fixture to use the imported symbol
directly while preserving existing behavior.
- Around line 238-246: Update the ResourceEditorValidateHCOReconcile constructor
call in cdi_config_upload_proxy_overridden to pass the injected configured
namespace as hco_namespace=hco_namespace.name, ensuring reconciliation uses the
test configuration instead of the helper’s default.

In `@utilities/architecture.py`:
- Around line 25-27: Refactor the dependency boundary in
utilities/architecture.py so KUBERNETES_ARCH_LABEL and MULTIARCH are importable
at module scope, then move their imports out of the affected functions and
remove the PLC0415 suppressions and temporary TODO. Preserve the existing
architecture behavior while ensuring no new in-function imports remain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 48fda206-e7c2-4fa4-bfee-24746af56150

📥 Commits

Reviewing files that changed from the base of the PR and between 721e62f and 38be695.

📒 Files selected for processing (4)
  • libs/vm/factory.py
  • tests/storage/conftest.py
  • utilities/architecture.py
  • utilities/unittests/test_storage.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • RedHatQE/openshift-virtualization-tests-design-docs (manual)

@jpeimer

jpeimer commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/retest all

@jpeimer

jpeimer commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

/retest tox

@jpeimer

jpeimer commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

/verified

(tox is broken on main; need to retest once it's fixed there)

@jpeimer

jpeimer commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

/retest tox

@jpeimer

jpeimer commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

/verified

@rnetser rnetser left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/approve
/lgtm

@jpeimer

jpeimer commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-smoke

@rnetser
rnetser merged commit 65cd6e0 into RedHatQE:main Aug 11, 2026
24 checks passed
@openshift-virtualization-qe-bot-5

Copy link
Copy Markdown

Successfully removed PR tag: quay.io/openshift-cnv/openshift-virtualization-tests:pr-5813.

@openshift-virtualization-qe-bot-5

Copy link
Copy Markdown

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

@jpeimer

jpeimer commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick cnv-4.22

@openshift-virtualization-qe-bot-6

Copy link
Copy Markdown

Cherry-pick conflicts were resolved by AI

Cherry-picked PR [Storage/Network] Specify architecture for internal HTTP server for multiarch clusters into cnv-4.22: #5980
Conflicts were automatically resolved by AI (claude/claude-opus-4-6-1m).

@jpeimer Manual verification is required — please review the changes and test before merging.

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.