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

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 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.
  • Generates signed share URL with HMAC signature and expiry.
  • 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 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?

Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 63.02932% with 454 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.64%. Comparing base (b99a030) to head (fdfcfe6).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...work/extensions/manager/ExtensionsManagerImpl.java 50.46% 80 Missing and 27 partials ⚠️
...sions/manager/ExtensionsFilesystemManagerImpl.java 66.30% 61 Missing and 32 partials ⚠️
...extensions/manager/ExtensionsShareManagerImpl.java 76.16% 50 Missing and 32 partials ⚠️
.../main/java/org/apache/cloudstack/ServerDaemon.java 0.00% 67 Missing ⚠️
.../cloudstack/utils/server/ServerPropertiesUtil.java 32.65% 31 Missing and 2 partials ⚠️
...pache/cloudstack/utils/filesystem/ArchiveUtil.java 69.04% 20 Missing and 6 partials ⚠️
...nsions/api/response/DownloadExtensionResponse.java 0.00% 13 Missing ⚠️
...va/org/apache/cloudstack/ShareSignedUrlFilter.java 74.28% 5 Missing and 4 partials ⚠️
...nsions/command/StartSyncExtensionFilesCommand.java 36.36% 6 Missing and 1 partial ⚠️
...framework/extensions/api/DownloadExtensionCmd.java 82.14% 3 Missing and 2 partials ⚠️
... and 7 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11814      +/-   ##
============================================
+ Coverage     17.56%   17.64%   +0.07%     
- Complexity    15500    15680     +180     
============================================
  Files          5899     5921      +22     
  Lines        527793   529595    +1802     
  Branches      64479    64639     +160     
============================================
+ Hits          92714    93442     +728     
- Misses       424653   425629     +976     
- Partials      10426    10524      +98     
Flag Coverage Δ
uitests 3.59% <ø> (-0.01%) ⬇️
unittests 18.71% <63.02%> (+0.08%) ⬆️

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
@shwstppr
Copy link
Contributor Author

@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 ✔️ debian ✖️ suse15. SL-JID 15425

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.

2 participants