Skip to content

libvirt: omit PAE/ACPI/APIC features for s390x domains#313

Draft
ibm-adarsh wants to merge 1 commit intoopenshift:mainfrom
ibm-adarsh:s390x-disable-acpi-domain-features
Draft

libvirt: omit PAE/ACPI/APIC features for s390x domains#313
ibm-adarsh wants to merge 1 commit intoopenshift:mainfrom
ibm-adarsh:s390x-disable-acpi-domain-features

Conversation

@ibm-adarsh
Copy link
Copy Markdown

@ibm-adarsh ibm-adarsh commented Apr 23, 2026

newDomainDef() always set x86-oriented features. On s390x, RHEL 9 + QEMU 9 with machine types like s390-ccw-virtio-rhel9.6.0 reject with virError 67 (machine type does not support ACPI), blocking worker Machine creation.

Clear the features block for s390 after resolving host arch and machine type in newDomainDefForConnection. Add unit tests (ClearX86Only).

Summary by CodeRabbit

  • Bug Fixes

    • Resolved a domain configuration issue for s390 architecture guests by properly excluding x86-specific virtual machine features that were previously incorrectly applied to guest definitions.
  • Tests

    • Added comprehensive unit tests to thoroughly validate that domain feature handling now works correctly across multiple different processor architectures, including both s390x and modern x86_64.

newDomainDef() always set x86-oriented features. On s390x, RHEL 9 + QEMU 9
with machine types like s390-ccw-virtio-rhel9.6.0 reject <acpi/> with
virError 67 (machine type does not support ACPI), blocking worker
Machine creation.

Clear the features block for s390 after resolving host arch and machine
type in newDomainDefForConnection. Add unit tests (ClearX86Only).
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 23, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Walkthrough

A new helper function clearX86OnlyDomainFeaturesForArch is introduced to conditionally remove x86-specific domain features for s390 architecture guests. The helper is integrated into the domain configuration flow, with unit tests validating correct behavior for s390x and x86_64 architectures.

Changes

Cohort / File(s) Summary
Architecture-specific domain feature handling
pkg/cloud/libvirt/client/domain.go
Added clearX86OnlyDomainFeaturesForArch helper function to conditionally set Domain.Features to nil for s390 guests; integrated into newDomainDefForConnection after canonical machine name is set.
Unit tests for feature clearing
pkg/cloud/libvirt/client/domain_test.go
Added two test cases validating that clearX86OnlyDomainFeaturesForArch clears features for s390x architecture and preserves them for x86_64.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title specifically refers to omitting PAE/ACPI/APIC features for s390x domains, which directly matches the main objective: clearing x86-oriented domain features for s390 architecture to resolve compatibility issues.
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.
Stable And Deterministic Test Names ✅ Passed Both new test functions have stable, deterministic names without dynamic information like timestamps, UUIDs, or random identifiers.
Test Structure And Quality ✅ Passed The custom check instructions are designed for Ginkgo test code structure, but this PR only adds standard Go unit tests using testing.T.
Microshift Test Compatibility ✅ Passed PR adds standard Go unit tests, not Ginkgo e2e tests, making the MicroShift API compatibility check inapplicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed New tests are standard Go unit tests using testing.T, not Ginkgo e2e tests, so the SNO compatibility check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies libvirt domain configuration for s390x architecture support, not Kubernetes scheduling constraints or deployment manifests.
Ote Binary Stdout Contract ✅ Passed PR introduces only a helper function and two standard unit test functions with no process-level code modifications that could write to stdout.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add Ginkgo e2e tests. Only unit tests for domain configuration logic were added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign enxebre for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 23, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 23, 2026

Hi @ibm-adarsh. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/cloud/libvirt/client/domain_test.go (1)

3-20: Consider asserting the emitted XML as well.

The test verifies the in-memory state; adding an XML assertion would directly cover the libvirt rejection this PR fixes (<acpi/>/<features> must be absent).

🧪 Proposed test hardening
 import (
 	"runtime"
+	"strings"
 	"testing"
 
 	libvirtxml "github.com/libvirt/libvirt-go-xml"
 )
@@
 	clearX86OnlyDomainFeaturesForArch(&d)
 	if d.Features != nil {
 		t.Fatalf("s390x: expected Features=nil, got %#v", d.Features)
 	}
+	xmlOut, err := xmlMarshallIndented(&d)
+	if err != nil {
+		t.Fatalf("s390x: failed to marshal domain XML: %v", err)
+	}
+	if strings.Contains(xmlOut, "<features") || strings.Contains(xmlOut, "<acpi") {
+		t.Fatalf("s390x: expected x86-only features to be omitted from XML, got:\n%s", xmlOut)
+	}
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cloud/libvirt/client/domain_test.go` around lines 3 - 20, Add an
assertion that the serialized XML emitted from the domain after calling
clearX86OnlyDomainFeaturesForArch does not contain a <features> or <acpi>
element: after calling newDomainDef() and clearX86OnlyDomainFeaturesForArch(&d)
serialize the domain struct to XML (using the existing libvirtxml types/imports
already in the test) and assert the resulting XML string does not contain
"<features" or "<acpi" (or that the <features> element is absent), referencing
the same symbols newDomainDef, clearX86OnlyDomainFeaturesForArch and d used in
the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/cloud/libvirt/client/domain_test.go`:
- Around line 3-20: Add an assertion that the serialized XML emitted from the
domain after calling clearX86OnlyDomainFeaturesForArch does not contain a
<features> or <acpi> element: after calling newDomainDef() and
clearX86OnlyDomainFeaturesForArch(&d) serialize the domain struct to XML (using
the existing libvirtxml types/imports already in the test) and assert the
resulting XML string does not contain "<features" or "<acpi" (or that the
<features> element is absent), referencing the same symbols newDomainDef,
clearX86OnlyDomainFeaturesForArch and d used in the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 353121cb-54e3-4ed3-ab0d-09d791900e9e

📥 Commits

Reviewing files that changed from the base of the PR and between 63c1b63 and 727e82b.

📒 Files selected for processing (2)
  • pkg/cloud/libvirt/client/domain.go
  • pkg/cloud/libvirt/client/domain_test.go

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant