Allow multiple simultaneous console viewers for KVM user VMs - #13870
Allow multiple simultaneous console viewers for KVM user VMs#13870Ericreeses wants to merge 2 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in global configuration to allow multiple simultaneous console viewers for KVM user VMs by forcing each console request to require a new viewer session (unique session UUID), while leaving system VMs and other hypervisors unchanged.
Changes:
- Introduces global setting
consoleproxy.kvm.multiple.viewers.enabledand exposes it viaConsoleAccessManagerconfig keys. - Updates KVM console-connection detail generation to set
sessionRequiresNewViewer=trueonly for KVM + User VM when the setting is enabled. - Adds unit tests and release notes for the new behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManager.java |
Adds the new global ConfigKey for enabling multiple KVM console viewers. |
server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java |
Registers the new config key and applies sessionRequiresNewViewer for KVM user VMs when enabled. |
server/src/test/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImplTest.java |
Adds unit tests for the new KVM user VM behavior and expected non-effect on KVM system VMs. |
PendingReleaseNotes |
Documents the new global setting and its default behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13870 +/- ##
=========================================
Coverage 19.64% 19.64%
- Complexity 19790 19791 +1
=========================================
Files 6368 6368
Lines 574889 574897 +8
Branches 70353 70356 +3
=========================================
+ Hits 112962 112967 +5
Misses 449656 449656
- Partials 12271 12274 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nvazquez
left a comment
There was a problem hiding this comment.
Code LGTM - seems like this functionality has been added since the extensions support for console proxy, so externalizing it into a disabled by default global setting makes sense to me. Haven't tested it yet
Description
This PR adds support for multiple simultaneous console viewers for the same KVM user VM.
Currently, console proxy sessions for a VM use the VM client tag as the viewer key. When a second user opens the console for the same VM, the existing viewer is replaced and the first user's console session is disconnected.
CloudStack already supports using a unique console session UUID as the viewer key when
sessionRequiresNewVieweris enabled. This change exposes that existing capability for KVM user VMs through a new global setting:consoleproxy.kvm.multiple.viewers.enabledThe setting defaults to
false, preserving the existing single-viewer behavior.When enabled for a KVM user VM, each console request uses a unique viewer session, allowing multiple users to access the same VM console simultaneously.
The change is limited to KVM user VMs. System VMs and other hypervisors retain their existing console behavior.
Fixes: #13869
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate)
N/A
How Has This Been Tested?
Unit tests were added to
ConsoleAccessManagerImplTestcovering:Focused unit test:
mvn -pl server -Dtest=ConsoleAccessManagerImplTest testResult:
Tests run: 39, Failures: 0, Errors: 0, Skipped: 0BUILD SUCCESSThe CloudStack CI-style build was also executed:
mvn -B -P developer,systemvm -Dsimulator -Dnoredist clean install -T$(nproc)Result:
BUILD SUCCESSThe feature was additionally validated manually with CloudStack 4.22.1.0 and KVM. With the existing behavior, opening the same VM console from a second user disconnects the first user. After enabling per-session viewers, two users were able to remain connected to the same KVM VM console simultaneously.
How did you try to break this feature and the system with this change?
The global setting defaults to
false, and unit testing verifies that the existing single-viewer behavior remains unchanged when it is disabled.The feature is explicitly restricted to KVM user VMs. The feature is explicitly restricted to KVM user VMs. A unit test verifies that KVM system VMs do not receive the new viewer behavior and that the multiple-viewer setting is not consulted.
Existing Hyper-V and external-console tests in
ConsoleAccessManagerImplTestalso continue to pass.The complete CloudStack developer/systemvm simulator build passed after the change.
Reviewer Test Procedure
consoleproxy.kvm.multiple.viewers.enabledtrue.consoleproxy.kvm.multiple.viewers.enabledback tofalse.