Skip to content

fix(kubevirt-instancetypes): drop persistent EFI/TPM to unblock live-migration - #3006

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix/instancetypes-drop-persistent
Jun 23, 2026
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix/instancetypes-drop-persistent

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

What this PR does

Temporary revert. v1.5.0 restored persistent EFI/TPM state for the windows.11 / windows.2k22 / windows.2k25 profiles. With persistence on, KubeVirt creates a backend-storage PVC (persistent-state-for-<vm>) which, on the default replicated StorageClass, is ReadWriteOnce — it pins the VM to its node and blocks live-migration and node drains. With evictionStrategy: LiveMigrate this can stall cluster upgrades. See #3005.

This strips persistent EFI/TPM from the preferences again — but via yq del instead of the original sed -d, so an emptied preferredTPM stays {} (the v1.8 CRD rejects null, which is the bug the original strip caused). Secure Boot and the vTPM remain present, just non-persistent — Windows VMs still boot; they just don't persist EFI/TPM across reboots.

⚠️ Temporary stopgap until vm-state can request an RWX backend — either RWX-Block via the upstream KubeVirt change (kubevirt/kubevirt#18215), or an RWX-Filesystem vmStateStorageClass. Once that lands, persistence can be re-enabled with live-migration intact.

Screenshots

No UI changes.

Release note

fix(kubevirt-instancetypes): temporarily disable persistent EFI/TPM state to unblock live-migration of Windows VMs. Persistence created a ReadWriteOnce backend-storage PVC on the default storage class, pinning the VM to its node. Secure Boot and vTPM remain available (non-persistent); to be re-enabled once vm-state can use RWX storage.

Summary by CodeRabbit

  • Bug Fixes
    • Updated Windows virtual machine preferences to enable live migration and drain operations
    • Fixed compatibility issues with KubeVirt v1.8 virtual machine preference configurations
    • Removed persistent settings from TPM and EFI configurations to prevent blocking behaviors on Windows 11 and Windows Server 2022/2025 variants

…migration

TEMPORARY revert. Restoring persistent EFI/TPM state (4cc60e3) makes
windows.11/2k22/2k25 VMs get a backend-storage PVC that is ReadWriteOnce on the
default StorageClass, which pins the VM to its node and blocks live-migration and
node drains (with evictionStrategy: LiveMigrate this can stall cluster upgrades).
See #3005.

Strip persistent EFI/TPM from the preferences again, but with `yq del` so an
emptied preferredTPM stays `{}` (the v1.8 CRD rejects null) — the bug the original
sed strip caused. Secure Boot and the vTPM stay present, just non-persistent.

Stopgap until vm-state can request an RWX backend (RWX-Block via the upstream
KubeVirt change, or an RWX-Filesystem vmStateStorageClass).

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andrei Kvapil <[email protected]>
@kvaps Andrei Kvapil (kvaps) added kind/bug Categorizes issue or PR as related to a bug kind/backport Categorizes issue or PR as requiring a backport to the current release line area/virtualization Issues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import) labels Jun 22, 2026
@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review size/M This PR changes 30-99 lines, ignoring generated files labels Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 64eefdeb-8cbf-479b-bd73-97b3d2795c97

📥 Commits

Reviewing files that changed from the base of the PR and between 82b8c46 and 6ac2601.

📒 Files selected for processing (2)
  • packages/system/kubevirt-instancetypes/Makefile
  • packages/system/kubevirt-instancetypes/templates/preferences.yaml

📝 Walkthrough

Walkthrough

The update target in the Makefile gains a yq post-processing step that deletes .spec.firmware.preferredEfi.persistent and .spec.devices.preferredTPM.persistent from the generated templates/preferences.yaml. The generated file is updated accordingly: all six Windows VM preferences (Windows 11, Windows Server 2022, Windows Server 2025, each with a virtio variant) now carry an empty preferredTPM map instead of persistent: true.

Changes

Remove persistent TPM/EFI from Windows VM preferences

Layer / File(s) Summary
Makefile: strip persistent EFI/TPM via yq
packages/system/kubevirt-instancetypes/Makefile
Adds a yq -i del call to the update target to remove .spec.firmware.preferredEfi.persistent and .spec.devices.preferredTPM.persistent from templates/preferences.yaml, ensuring an emptied preferredTPM stays an empty object rather than becoming null.
Generated preferences: empty preferredTPM across all Windows variants
packages/system/kubevirt-instancetypes/templates/preferences.yaml
Changes spec.features.preferredTPM from {persistent: true} to {} in all six Windows VirtualMachineClusterPreference resources (Windows 11, Windows 11 virtio, Windows Server 2022, Windows Server 2022 virtio, Windows Server 2025, Windows Server 2025 virtio).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Poem

🐇 Hop, hop! The TPM said "persist no more!"
No sticky EFI blocking migration's door.
Six Windows prefs now carry an empty map,
KubeVirt v1.8 no longer sets a trap.
The rabbit cheers: live-migrate with glee! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: dropping persistent EFI/TPM settings to resolve live-migration blocking issues, which aligns perfectly with the core objective of the changeset.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/instancetypes-drop-persistent

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

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a temporary fix to unblock live-migration for Windows VMs by disabling persistent EFI and TPM states. Currently, these features trigger the creation of RWO PVCs that pin VMs to specific nodes, hindering cluster maintenance operations like node drains and upgrades. The changes ensure that while Secure Boot and vTPM remain functional, they are no longer persistent, pending a future solution that supports RWX storage for VM state.

Highlights

  • Persistent EFI/TPM Removal: Disabled persistent EFI and TPM settings in VirtualMachinePreference templates to prevent the creation of ReadWriteOnce backend-storage PVCs.
  • Live-Migration Unblocking: Removed node-pinning behavior caused by RWO storage requirements, allowing for successful live-migration and node drains.
  • Schema Compatibility: Updated the Makefile to use yq del instead of sed, ensuring that preferredTPM remains an empty object {} rather than null, which is required to pass v1.8 CRD validation.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request temporarily removes persistent EFI and TPM state from the KubeVirt preferences to prevent the creation of RWO backend-storage PVCs, which can block live-migration and node draining. The Makefile has been updated to strip these fields using yq, and the generated preferences.yaml has been updated accordingly. Feedback is provided to simplify the yq command in the Makefile by passing multiple comma-separated paths to a single del operator instead of chaining them.

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.

# which pins the VM to its node and blocks live-migration / drain. Use `del` (not
# `sed -d`) so an emptied preferredTPM stays `{}` rather than null, which the
# KubeVirt v1.8 CRD structural schema rejects. Revert once vm-state can request RWX.
yq -i 'del(.spec.firmware.preferredEfi.persistent) | del(.spec.devices.preferredTPM.persistent)' templates/preferences.yaml

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.

low

In yq (v4+), you can pass multiple comma-separated paths to the del operator instead of chaining them with |. This is slightly cleaner and more idiomatic.

	yq -i 'del(.spec.firmware.preferredEfi.persistent, .spec.devices.preferredTPM.persistent)' templates/preferences.yaml

@kvaps
Andrei Kvapil (kvaps) merged commit 27442bd into main Jun 23, 2026
18 checks passed
@kvaps
Andrei Kvapil (kvaps) deleted the fix/instancetypes-drop-persistent branch June 23, 2026 08:30
@github-actions

Copy link
Copy Markdown

myasnikovdaniil added a commit that referenced this pull request Jun 23, 2026
…FI/TPM to unblock live-migration (#3016)

# Description
Backport of #3006 to `release-1.5`.
myasnikovdaniil pushed a commit that referenced this pull request Jul 6, 2026
Reverts #3006. Dropping persistent EFI/TPM was motivated by a live-migration
concern that rested on an outdated assumption — that an RWO Filesystem
backend-storage PVC pins the VM to its node. KubeVirt has migrated
RWO-Filesystem backend storage since v1.4 (kubevirt/kubevirt#12629): on
migration it creates a fresh target state PVC and copies the small state blob,
so persistent-EFI/TPM VMs on the default replicated storage live-migrate fine
(verified: the VM reports LiveMigratable=True and the copy-on-target PVC is
created on migration). Restore upstream's persistent firmware state for the
windows.* preferences.

Assisted-By: Claude <[email protected]>
Signed-off-by: Andrei Kvapil <[email protected]>
myasnikovdaniil added a commit that referenced this pull request Jul 6, 2026
## What this PR does

Reverts #3006, restoring upstream's persistent EFI/TPM firmware state
for the `windows.11` / `windows.2k22` / `windows.2k25` preferences (and
their `.virtio` variants).

#3006 dropped persistent EFI/TPM to "unblock live-migration", on the
assumption that an RWO Filesystem backend-storage PVC pins the VM to its
node. That assumption was outdated: KubeVirt has live-migrated
RWO-Filesystem backend storage since v1.4 (kubevirt/kubevirt#12629) — on
migration it creates a fresh target state PVC and copies the small state
blob. So persistent-EFI/TPM VMs on the default `replicated` storage
live-migrate fine; the regression described in #3005 was a misdiagnosis.

Verified on a KubeVirt v1.8.2 cluster: a persistent-EFI VM with an RWO
Filesystem backend PVC reports `LiveMigratable=True`, and the
copy-on-target backend PVC is created when a migration starts. KubeVirt
maintainers confirmed the same upstream.

This restores persistent firmware state so in-guest Microsoft UEFI CA /
Secure Boot enrollment survives reboots and migrations.

### Release note

```release-note
fix(kubevirt-instancetypes): restore persistent EFI/TPM state for Windows preferences — RWO-Filesystem backend storage already live-migrates (KubeVirt v1.4+), so persistence no longer needs to be stripped
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Updated Windows instance type preferences to keep TPM persistence
enabled, improving compatibility and reducing storage-related issues.
* Ensured firmware and TPM persistence settings are preserved during
instance type preference generation for more reliable outcomes.

* **Chores**
* Streamlined the preference generation step so instance type templates
are produced consistently without removing persistence configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review area/virtualization Issues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import) kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants