Skip to content

Conversation

@pavanaravapalli
Copy link

@pavanaravapalli pavanaravapalli commented Nov 12, 2025

Description

This PR addresses an issue #12055 where SSH keys were being unnecessarily regenerated in developer mode even when valid keys already existed on disk.

When both the public and private key files are present at the expected file paths but missing from the database, CloudStack will now reuse the existing keys on disk instead of regenerating them. The existing keys are injected into the database, ensuring consistency without overwriting the developer’s configured keys.

Impact

Prevents loss of existing SSH keys in developer environments.
Ensures smoother setup by reusing valid keys already present on disk.
No impact on normal operation or production deployments.

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?

Verified behavior in developer mode with pre-existing SSH key files but no DB entries.
Confirmed that no new keys are generated and the existing keys are properly persisted in the database.

Before Fix

Pasted Graphic Pasted Graphic 1 Pasted Graphic 2

After Fix

Pasted Graphic

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

@pavanaravapalli pavanaravapalli marked this pull request as draft November 12, 2025 17:12
@DaanHoogland DaanHoogland requested review from Copilot and weizhouapache and removed request for Copilot November 13, 2025 07:49
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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to fix unnecessary regeneration of SSH keys in developer mode when they already exist. The change adds a conditional check to skip key generation if the key files are already present on the filesystem.

  • Adds file existence check before SSH key generation
  • Targets developer mode to prevent overwriting existing SSH keys
  • Reduces unnecessary file system operations during startup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DaanHoogland DaanHoogland self-requested a review November 13, 2025 08:17
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (5f9e131) to head (60b23c1).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
...java/com/cloud/server/ConfigurationServerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12059      +/-   ##
============================================
+ Coverage     17.55%   17.56%   +0.01%     
- Complexity    15537    15540       +3     
============================================
  Files          5910     5912       +2     
  Lines        529336   529383      +47     
  Branches      64654    64660       +6     
============================================
+ Hits          92904    92982      +78     
+ Misses       425975   425942      -33     
- Partials      10457    10459       +2     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.63% <0.00%> (+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.

@pavanaravapalli pavanaravapalli changed the title WIP : { Fixed: unnecessary regeneration of SSH keys in developer mode when t…} WIP : Avoid unnecessary SSH key regeneration in developer mode Nov 13, 2025
@pavanaravapalli pavanaravapalli changed the title WIP : Avoid unnecessary SSH key regeneration in developer mode Avoid unnecessary SSH key regeneration in developer mode Nov 13, 2025
@pavanaravapalli pavanaravapalli marked this pull request as ready for review November 13, 2025 09:07
@pavanaravapalli
Copy link
Author

@DaanHoogland
Just to confirm — is one LGTM sufficient for merging this PR, or should we wait for two approvals.

@DaanHoogland
Copy link
Contributor

@DaanHoogland Just to confirm — is one LGTM sufficient for merging this PR, or should we wait for two approvals.

we usually require two lgtm, on of which should include testing report. Sometimes we slack when only doc or logging has changed, but this is the general rule.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland 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 15821

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.

code lgtm

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan test

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

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.

In developer mode, MS force-generates new keys ignoring pre-existing key files

4 participants