Skip to content

kvm: reload VNC TLS certificate on running VMs after cert renewal - #14151

Open
weizhouapache wants to merge 3 commits into
4.20from
4.20-kvm-reload-vnc-tls
Open

kvm: reload VNC TLS certificate on running VMs after cert renewal#14151
weizhouapache wants to merge 3 commits into
4.20from
4.20-kvm-reload-vnc-tls

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

This PR fixes VM console access breaking after the VNC certificate expires and is renewed (issue #9718). On KVM, the VNC TLS certificate is the host's agent certificate, applied host-wide via libvirtd's vnc_tls_x509_cert_dir setting. Restarting libvirtd after a renewal does not affect VMs already running, since QEMU only loads that certificate once, at VM start.

Extend the existing PostCertificateRenewalCommand handling to, after restarting libvirtd, reload the VNC TLS certificate live on every currently running VM via the QMP display-reload command (added in QEMU 6.0, commit 9cc07651655ee86eca41059f5ead8c4e5607c734), sent through libvirt's qemu-monitor-command passthrough for compatibility with older libvirt. Hosts running QEMU < 6.0 are detected and skipped with a warning, keeping the previous stop/start-or-migrate behavior.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Fixes VM console access breaking after the VNC certificate expires and
is renewed (issue #9718). On KVM, the VNC TLS
certificate is the host's agent certificate, applied host-wide via
libvirtd's vnc_tls_x509_cert_dir setting. Restarting libvirtd after a
renewal does not affect VMs already running, since QEMU only loads
that certificate once, at VM start.

Extend the existing PostCertificateRenewalCommand handling to, after
restarting libvirtd, reload the VNC TLS certificate live on every
currently running VM via the QMP display-reload command (added in
QEMU 6.0, commit 9cc07651655ee86eca41059f5ead8c4e5607c734), sent
through libvirt's qemu-monitor-command passthrough for compatibility
with older libvirt. Hosts running QEMU < 6.0 are detected and skipped
with a warning, keeping the previous stop/start-or-migrate behavior.
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.39%. Comparing base (a4d3c66) to head (d76b589).
⚠️ Report is 1 commits behind head on 4.20.

Files with missing lines Patch % Lines
...r/LibvirtPostCertificateRenewalCommandWrapper.java 92.68% 2 Missing and 1 partial ⚠️
...ervisor/kvm/resource/LibvirtComputingResource.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #14151      +/-   ##
============================================
+ Coverage     16.37%   16.39%   +0.01%     
- Complexity    13614    13621       +7     
============================================
  Files          5669     5669              
  Lines        501527   501685     +158     
  Branches      60922    60968      +46     
============================================
+ Hits          82148    82239      +91     
- Misses       410171   410228      +57     
- Partials       9208     9218      +10     
Flag Coverage Δ
uitests 4.21% <ø> (+0.07%) ⬆️
unittests 17.25% <90.69%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19219

@winterhazel
winterhazel self-requested a review September 11, 2026 11:53
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@weizhouapache
weizhouapache marked this pull request as ready for review September 11, 2026 12:40
@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19220

@sonarqubecloud

Copy link
Copy Markdown

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19221

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.

2 participants