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.71143% with 613 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.00%. Comparing base (ffb8b91) to head (35903ed).
⚠️ Report is 24 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 0.00% 39 Missing ⚠️
...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.88%   18.00%   +0.12%     
- Complexity    16072    16292     +220     
============================================
  Files          5935     5950      +15     
  Lines        532338   533638    +1300     
  Branches      65086    65224     +138     
============================================
+ Hits          95191    96105     +914     
- Misses       426500   426758     +258     
- Partials      10647    10775     +128     
Flag Coverage Δ
uitests 3.56% <ø> (-0.01%) ⬇️
unittests 19.12% <61.71%> (+0.13%) ⬆️

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 <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@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
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@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.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@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
@github-actions
Copy link

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

@github-actions
Copy link

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

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@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 no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

@github-actions
Copy link

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

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

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

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

@shwstppr this looks great. Got a chance to test, sync and downloads are working fine. Though link expiry does not seem to be working as expected.
I've enabled this "extension.share.download.use.secondary.storage" and set "extension.share.link.validity.interval" to 30.

I've made 3 attempts of download, folders and the last file remains exists after expiry time

Image

@github-actions
Copy link

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

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.

5 participants