Skip to content

Conversation

@sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Feb 3, 2026

Description

This PR support custom SSH port for KVM hosts from the host url while adding the host and the configuration 'kvm.host.discovery.ssh.port'. The port is used during

  • KVM host discovery to connect to the Host during Add Host command
  • Any other operations on host using SSH

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?

…m.host.discovery.ssh.port'

- Use the custom SSH port for KVM host discovery to connect to the Host during Add Host command
- and any other operations on host using SSH
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 7.14286% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 4.15%. Comparing base (ce42ce5) to head (fa48e90).
⚠️ Report is 4 commits behind head on 4.20.

Files with missing lines Patch % Lines
...java/com/cloud/agent/manager/AgentManagerImpl.java 0.00% 11 Missing ⚠️
...che/cloudstack/backup/NetworkerBackupProvider.java 0.00% 8 Missing ⚠️
...rvisor/kvm/discoverer/LibvirtServerDiscoverer.java 0.00% 6 Missing ⚠️
...rc/main/java/com/cloud/utils/ssh/SSHCmdHelper.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               4.20   #12571       +/-   ##
=============================================
- Coverage     16.26%    4.15%   -12.12%     
=============================================
  Files          5660      404     -5256     
  Lines        499959    32965   -466994     
  Branches      60707     5893    -54814     
=============================================
- Hits          81326     1370    -79956     
+ Misses       409560    31419   -378141     
+ Partials       9073      176     -8897     
Flag Coverage Δ
uitests 4.15% <ø> (-0.01%) ⬇️
unittests 17.11% <7.14%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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

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

@sureshanaparti
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " +
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", false);

ConfigKey<Integer> KVMHostDiscoverySshPort = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class,
Copy link
Member

@winterhazel winterhazel Feb 3, 2026

Choose a reason for hiding this comment

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

Wouldn't it be better to have this as a parameter on host addition/edit to allow configuring it on a host-level?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can, but do we really want to allow to use a different ssh port for all hosts within a cluster? seems a bit overkill.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a problem allowing it. Maybe a single host needs to use a different port for SSH connection.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, a bit of an edge case, only applicable to smaller installations I’d guess (in my ignorance). You are not asking to remove a higher level setting are you? just to add a per host parameter..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the config is applicable for the kvm hosts on the entire cloudstack installation, mainly for large deployments where the custom port is used for all the hosts. it doesn't provide flexibility to set few hosts on one port, and few hosts on the other. it's always better to have all these hosts accessible on the same port. a new host parameter (that can be updated through add or update host call) can provide flexibility, but it's mostly NULL/empty (when not defined or default port is used) and is not applicable for VMware hosts.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM @DaanHoogland - setting being global as it is now should also work

Copy link
Member

@winterhazel winterhazel Feb 5, 2026

Choose a reason for hiding this comment

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

@DaanHoogland I suggest having either just host configuration stored on URL field -> cluster setting -> 22, or host configuration stored on host_detail -> cluster setting -> 22, depending on whichever is easier to implement without breaking compatibility.

Storing this configuration at two places for host-level seems unnecessary, and might just make it confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

right, simplifying to:
if not part of the host field (i.e. localhost:22), check the cluster setting, else 22.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to pick port from host detail (if defined through url), otherwise cluster setting (defaulted to 22).

@blueorangutan
Copy link

[SF] Trillian test result (tid-15362)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 58847 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12571-t15362-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@RosiKyu RosiKyu removed their assignment Feb 5, 2026
@nvazquez nvazquez marked this pull request as draft February 5, 2026 14:19
…that port if passed, other fall back to config 'kvm.host.discovery.ssh.port')
@sureshanaparti sureshanaparti marked this pull request as ready for review February 10, 2026 06:41
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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.

@sureshanaparti sureshanaparti changed the title Support for custom SSH port for KVM hosts using the configuration Support for custom SSH port for KVM hosts using the host url on add host and the configuration Feb 10, 2026
@sureshanaparti sureshanaparti changed the title Support for custom SSH port for KVM hosts using the host url on add host and the configuration Support for custom SSH port for KVM hosts from the host url on add host and the configuration Feb 10, 2026
Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

@sureshanaparti
thanks for the update

just a minor comment: there are two method getHostSshPort, can one of them be removed ?

@blueorangutan
Copy link

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

@sureshanaparti
Copy link
Contributor Author

sureshanaparti commented Feb 10, 2026

@sureshanaparti thanks for the update

just a minor comment: there are two method getHostSshPort, can one of them be removed ?

@weizhouapache better in hostdao, but adding circular dependency with AgentManager. any other thoughts?

@weizhouapache
Copy link
Member

@sureshanaparti thanks for the update
just a minor comment: there are two method getHostSshPort, can one of them be removed ?

@weizhouapache better in hostdao, but adding circular dependency with AgentManager. any other thoughts?

@sureshanaparti
in AgentManager (definition) and AgentManagerImpl (override) ?

@sureshanaparti
Copy link
Contributor Author

sureshanaparti commented Feb 10, 2026

@sureshanaparti in AgentManager (definition) and AgentManagerImpl (override) ?

updated @weizhouapache

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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.

@sureshanaparti sureshanaparti force-pushed the kvm-custom-ssh-port-support branch from c2de55c to 5347dce Compare February 10, 2026 08:49
@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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.

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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.

@blueorangutan
Copy link

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

@sureshanaparti
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

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.

7 participants