Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Oct 9, 2025

Description

This change introduces support for:

  • synchronizing extension files across management servers in a clustered environment.
  • download extension files as an archive (from a desired management server in a clustered environment). If needed (cases when MS is not directly accessible), download can be made to work via SSVM and secondary storage.

Key changes:

  • Adds new syncExtension API to trigger synchronization for a selected extension.
  • Implements util to create .tgz archive of the extension directory or selected files for sync.
  • For sync, sends DownloadAndSyncExtensionFilesCommand to peer management servers. Handles archive download, staging, and extraction on the receiver side.
  • Adds new downloadExtension API to allow downloading extension files as an archive.
  • Implements util to create .zip archive of the extension directory for download.
  • For forcing download via secondary storage, global configuration - extension.share.download.use.secondary.storage can be used and set to true.
  • Generates signed share URL with HMAC signature and expiry.
  • URL expiry and file cleanup can be controlled via global configuration - extension.share.link.validity.interval
  • Adds Sync Extension and Download Extension actions in the UI Extensions view.
  • Updates events, logging, and cleanup of temporary share files.
  • Refactors all filesystem-related code to the extensions framework layer.
  • Checksum for extensions is now calculated and compared for all files in the extension directory.

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

For Sync:
image

(localcloud) 🐱 > sync extension id=3cf82f18-89c5-4acc-8f46-8d42da139f30 sourcemanagementserverid=0d8d73fa-9241-49aa-8d7e-7642f143ce66
{
  "success": true
}
(localcloud) 🐱 > sync extension id=3cf82f18-89c5-4acc-8f46-8d42da139f30
💩 Missing required parameters:  sourcemanagementserverid
(localcloud) 🐱 > sync extension -h
syncExtension: To sync the extension files from one management server to other management server(s)
This API is asynchronous.
Required params: id, sourcemanagementserverid, 
API Params               Type     Description
==========               ====     ===========
files                    list     List of files to sync. Specify absolute o
                                  r relative paths. If not provided, all e
                                  xtension files will be synced.
id                       uuid     ID of the extension
sourcemanagementserverid uuid     ID of the management server from which fi
                                  les are to be synced
targetmanagementserverids list     the IDs of the management servers to whic
                                  h the extension files are to be synced. 
                                  If not specified, the files will be sync
                                  ed to all management servers

For Download:

image image
(localcloud) 🐱 > download extension -h
downloadExtension: To download the extension files as an archive
This API is asynchronous.
Required params: id, 
API Params               Type     Description
==========               ====     ===========
id                       uuid     ID of the extension
managementserverid       uuid     ID of the management server from which fi
                                  les are to be downloaded
(localcloud) 🐱 > download extension id=3cf82f18-89c5-4acc-8f46-8d42da139f30
{
  "extension": {
    "id": "3cf82f18-89c5-4acc-8f46-8d42da139f30",
    "managementserverid": "0d8d73fa-9241-49aa-8d7e-7642f143ce66",
    "managementservername": "qa1-4.22-test-61f54c88-kvm-mgmt1",
    "name": "test",
    "url": "http://172.120.0.228:8080/share/extensions/test-1760334975686.zip?exp=1760338575"
  }
}
(localcloud) 🐱 > download extension id=3cf82f18-89c5-4acc-8f46-8d42da139f30 managementserverid=5ccb810f-4a31-4b8d-a36c-2ebb7e87cb26 
{
  "extension": {
    "id": "3cf82f18-89c5-4acc-8f46-8d42da139f30",
    "managementserverid": "5ccb810f-4a31-4b8d-a36c-2ebb7e87cb26",
    "managementservername": "422-test-mgmt2",
    "name": "test",
    "url": "http://172.120.0.83:8080/share/extensions/test-1760334994612.zip?exp=1760338594"
  }
}

How Has This Been Tested?

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

@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 61.86075% with 619 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.69%. Comparing base (bfc4f60) to head (2332c9c).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...extensions/manager/ExtensionsShareManagerImpl.java 76.47% 66 Missing and 50 partials ⚠️
...sions/manager/ExtensionsFilesystemManagerImpl.java 65.35% 64 Missing and 33 partials ⚠️
...work/extensions/manager/ExtensionsManagerImpl.java 73.14% 24 Missing and 34 partials ⚠️
...amework/extensions/ExtensionArchiveDataObject.java 12.50% 48 Missing and 1 partial ⚠️
...dstack/storage/to/DownloadableArchiveObjectTO.java 0.00% 48 Missing ⚠️
.../cloudstack/utils/server/ServerPropertiesUtil.java 26.22% 43 Missing and 2 partials ⚠️
...om/cloud/storage/download/DownloadMonitorImpl.java 0.00% 31 Missing ⚠️
...oudstack/storage/template/DownloadManagerImpl.java 0.00% 31 Missing ⚠️
...dstack/storage/image/BaseImageStoreDriverImpl.java 0.00% 28 Missing ⚠️
...pache/cloudstack/utils/filesystem/ArchiveUtil.java 69.04% 20 Missing and 6 partials ⚠️
... and 17 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11814      +/-   ##
============================================
+ Coverage     17.56%   17.69%   +0.13%     
- Complexity    15540    15765     +225     
============================================
  Files          5909     5925      +16     
  Lines        529045   530378    +1333     
  Branches      64615    64758     +143     
============================================
+ Hits          92933    93865     +932     
- Misses       425657   425928     +271     
- Partials      10455    10585     +130     
Flag Coverage Δ
uitests 3.58% <ø> (-0.01%) ⬇️
unittests 18.77% <61.86%> (+0.14%) ⬆️

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.

This change introduces support for synchronizing extension files across management servers in a clustered environment.

- Adds new syncExtension API to trigger synchronization for a selected extension.
- Implements service to create .tgz archive of the extension directory or selected files.
- Generates signed share URL with HMAC signature and expiry.
- Sends DownloadAndSyncExtensionFilesCommand to peer management servers.
- Handles archive download, staging, and extraction on receiver side.
- Adds Sync Extension action in the UI Extensions view.
- Updates events, logging, and cleanup of temporary share files.

Refactors all filesystem related code to extensions framework layer.
Checksum for extensions is now calculated and compared for all files in
the extension directory.

Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
@shwstppr shwstppr changed the title extensions: add sync functionality extensions: add sync, download functionalities Oct 13, 2025
@apache apache deleted a comment from blueorangutan Oct 13, 2025
@apache apache deleted a comment from blueorangutan Oct 13, 2025
@apache apache deleted a comment from blueorangutan Oct 14, 2025
@apache apache deleted a comment from blueorangutan Oct 14, 2025
@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@apache apache deleted a comment from blueorangutan Oct 30, 2025
@apache apache deleted a comment from blueorangutan Oct 30, 2025
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
@apache apache deleted a comment from blueorangutan Nov 3, 2025
@apache apache deleted a comment from blueorangutan Nov 3, 2025
@shwstppr
Copy link
Contributor Author

shwstppr commented Nov 3, 2025

@blueorangutan package

@blueorangutan
Copy link

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

@shwstppr shwstppr marked this pull request as ready for review November 3, 2025 12:02
@shwstppr shwstppr requested a review from Copilot November 3, 2025 12:02
@blueorangutan
Copy link

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

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 adds extension file synchronization and download capabilities across management servers. It introduces new components for managing extension file distribution, including archive creation, download mechanisms, and file validation.

  • Extension sync functionality to propagate extension files across management servers
  • Download API to retrieve extension archives via signed URLs
  • New filesystem and share managers to handle extension file operations

Reviewed Changes

Copilot reviewed 73 out of 73 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ServerPropertiesUtil.java New utility for reading server.properties with caching
HMACSignUtil.java New utility for HMAC signature generation
ArchiveUtil.java New utility for creating and extracting TGZ/ZIP archives
ExtensionsShareManager*.java New manager and implementation for extension sync/download
ExtensionsFilesystemManager*.java New manager for extension filesystem operations
ShareServlet.java New servlet for serving shared files
ShareSignedUrlFilter.java New filter for validating signed URLs
DigestHelper.java Added method to deduce algorithm from checksum length
UploadManagerImpl.java Refactored to use constants for base paths
DownloadManagerImpl.java Refactored download logic to handle archives
Comments suppressed due to low confidence (1)

services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java:1

  • Incorrect constant used. Should use BASE_MOUNT_DIR instead of BASE_EXTRACT_DIR for constructing the path to the snapshot file, as this is reading from mounted storage, not the extract directory.

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

Signed-off-by: Abhishek Kumar <[email protected]>
@shwstppr
Copy link
Contributor Author

shwstppr commented Nov 9, 2025

@blueorangutan package

@blueorangutan
Copy link

@shwstppr 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 15689

@shwstppr
Copy link
Contributor Author

shwstppr commented Nov 9, 2025

@blueorangutan test

@blueorangutan
Copy link

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

@shwstppr
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@shwstppr , should we try this for 22.1?

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@shwstppr
Copy link
Contributor Author

@DaanHoogland I think better to keep it for 4.23. New functionalities/APIs, especially share context for management servers. I would prefer them to go in a non-LTS release first

@DaanHoogland DaanHoogland added this to the 4.23 milestone Nov 11, 2025
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.

3 participants