Skip to content

Allow multiple simultaneous console viewers for KVM user VMs - #13870

Open
Ericreeses wants to merge 1 commit into
apache:mainfrom
Ericreeses:KvmMultipleConsoleViewers
Open

Allow multiple simultaneous console viewers for KVM user VMs#13870
Ericreeses wants to merge 1 commit into
apache:mainfrom
Ericreeses:KvmMultipleConsoleViewers

Conversation

@Ericreeses

Copy link
Copy Markdown

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 sessionRequiresNewViewer is enabled. This change exposes that existing capability for KVM user VMs through a new global setting:

consoleproxy.kvm.multiple.viewers.enabled

The 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

  • 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)

N/A

How Has This Been Tested?

Unit tests were added to ConsoleAccessManagerImplTest covering:

  • KVM user VM with multiple console viewers enabled: a new viewer is required.
  • KVM user VM with multiple console viewers disabled: existing single-viewer behavior is preserved.
  • KVM system VM with the setting enabled: multiple-viewer behavior is not applied.

Focused unit test:

mvn -pl server -Dtest=ConsoleAccessManagerImplTest test

Result:

Tests run: 39, Failures: 0, Errors: 0, Skipped: 0

BUILD SUCCESS

The CloudStack CI-style build was also executed:

mvn -B -P developer,systemvm -Dsimulator -Dnoredist clean install -T$(nproc)

Result:

BUILD SUCCESS

The 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. A unit test verifies that KVM system VMs do not receive the new viewer behavior even when the setting is enabled.

Existing Hyper-V and external-console tests in ConsoleAccessManagerImplTest also continue to pass.

The complete CloudStack developer/systemvm simulator build passed after the change.

Reviewer Test Procedure

  1. Deploy the change to a CloudStack environment using KVM.
  2. In Global Settings, locate:
    consoleproxy.kvm.multiple.viewers.enabled
  3. Set the value to true.
  4. Open the console of the same running KVM user VM from two separate CloudStack user sessions or browser sessions.
  5. Verify that:
    • Both console sessions remain connected.
    • Opening the second console does not disconnect the first.
    • Both users can view the same VM console.
    • Keyboard and mouse input continue to function from both sessions.
  6. Close one of the console sessions and verify that the other session remains connected.
  7. Open another console session for the same VM and verify that it can connect without disconnecting the existing viewer.
  8. Set consoleproxy.kvm.multiple.viewers.enabled back to false.
  9. Open two fresh console sessions for the same KVM user VM.
  10. Verify that the existing single-viewer behavior is restored: opening the second console replaces/disconnects the first viewer.
  11. Optionally verify that enabling the setting does not change console behavior for KVM system VMs or non-KVM hypervisors.

@boring-cyborg

boring-cyborg Bot commented Aug 12, 2026

Copy link
Copy Markdown

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)
Here are some useful points:

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.

Allow multiple simultaneous console viewers for KVM user VMs

1 participant