Skip to content

Fix automatic SystemVM template download to S3 secondary storage - #12426

Open
Damans227 wants to merge 18 commits into
apache:4.20from
Damans227:fix/9002-s3-systemvm-bootstrap
Open

Fix automatic SystemVM template download to S3 secondary storage#12426
Damans227 wants to merge 18 commits into
apache:4.20from
Damans227:fix/9002-s3-systemvm-bootstrap

Conversation

@Damans227

@Damans227 Damans227 commented Jan 14, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes an issue where the SystemVM template is not automatically downloaded to S3 secondary storage when adding it to a CloudStack zone.

Root Cause:

  • S3 stores use REGION scope but DefaultEndPointSelector only returned LocalHostEndpoint for ZONE scope, so no endpoint was found to download the SystemVM template.

  • Allow Zone scoped S3 Secondary Storage.

Fix:
Allow LocalHostEndpoint to handle SYSTEM template downloads for REGION-scoped stores, plus added null checks for S3 stores without URLs and enabled path-style access for S3-compatible storage.

Fixes: #9002

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

Broken:

image

Fixed:

Screencast.from.2026-01-14.13-52-40.mp4

How Has This Been Tested?

Test Environment:

  • CloudStack 4.20.3.0
  • KVM hypervisor (Ubuntu 22.04)
  • MinIO S3-compatible storage

Test Steps:

  1. Started with a fresh CloudStack zone with no secondary storage configured
  2. Added NFS staging store (required for S3)
  3. Added S3 image store (MinIO) via UI
  4. Verified SystemVM template automatically downloaded to S3
  5. Verified SSVM booted successfully using the template from S3
  6. Verified Console Proxy VM also booted successfully

@nvazquez

Copy link
Copy Markdown
Contributor

@blueorangutan package

@codecov

codecov Bot commented Jan 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.33333% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.26%. Comparing base (549daae) to head (80ff748).

Files with missing lines Patch % Lines
...om/cloud/upgrade/SystemVmTemplateRegistration.java 0.00% 15 Missing ⚠️
...he/cloudstack/api/response/ImageStoreResponse.java 0.00% 12 Missing ⚠️
...datastore/lifecycle/S3ImageStoreLifeCycleImpl.java 0.00% 11 Missing ⚠️
...m/cloud/storage/template/S3TemplateDownloader.java 0.00% 8 Missing ⚠️
...com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java 0.00% 5 Missing ⚠️
...tack/storage/endpoint/DefaultEndPointSelector.java 0.00% 2 Missing ⚠️
.../api/command/admin/storage/AddImageStoreS3CMD.java 0.00% 1 Missing ⚠️
...e/datastore/provider/S3ImageStoreProviderImpl.java 0.00% 1 Missing ⚠️
...ain/java/com/cloud/storage/StorageManagerImpl.java 0.00% 1 Missing ⚠️
...oudstack/storage/template/DownloadManagerImpl.java 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12426      +/-   ##
============================================
- Coverage     16.26%   16.26%   -0.01%     
- Complexity    13434    13438       +4     
============================================
  Files          5667     5667              
  Lines        500731   500762      +31     
  Branches      60803    60808       +5     
============================================
- Hits          81455    81452       -3     
- Misses       410172   410204      +32     
- Partials       9104     9106       +2     
Flag Coverage Δ
uitests 4.14% <ø> (+<0.01%) ⬆️
unittests 17.12% <3.33%> (-0.01%) ⬇️

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

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

@nvazquez

Copy link
Copy Markdown
Contributor

@blueorangutan test


client.setEndpoint(clientOptions.getEndPoint());
// Enable path-style access for S3-compatible storage
client.setS3ClientOptions(com.amazonaws.services.s3.S3ClientOptions.builder().setPathStyleAccess(true).build());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this required?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So, when debugging the issue... I noticed that the connection to MinIO failed at the time of template upload, with an error that looked something like:

UnknownHostException: cloudstack-secondary.10.0.34.157 i.e. the SDK was trying to connect to the http://cloudstack-secondary.10.0.34.157:9000/... which is the virtual-hosted style (refer: virtual style vs path style syntax for s3).

Looking at other S3-compatible plugins in CloudStack, I found that both CephObjectStoreDriverImpl and CloudianHyperStoreUtil use enablePathStyleAccess() to get path-style URLs http://10.0.34.157:9000/cloudstack-secondary/... i.e.

     AmazonS3 client = AmazonS3ClientBuilder.standard()
                .enablePathStyleAccess()
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
                .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(url, "auto"))
                .build();

Applying the same fix here worked. The AWS SDK documentation confirms that path-style access must be explicitly enabled for S3-compatible stores.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes an issue where SystemVM templates fail to automatically download to S3 secondary storage when adding it to a CloudStack zone. The root cause was that S3 stores use REGION scope, but the endpoint selector only returned LocalHostEndpoint for ZONE-scoped stores with null scope IDs.

Changes:

  • Modified endpoint selection logic to support REGION-scoped stores for SYSTEM template downloads
  • Added null safety checks for data stores without URLs (e.g., S3 object stores)
  • Enabled path-style access for S3-compatible storage systems like MinIO

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
engine/storage/src/main/java/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java Extended condition to allow LocalHostEndpoint for REGION-scoped stores with SYSTEM templates
services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java Added null checks to skip data stores without URLs when building secondary storage addresses
services/secondary-storage/controller/src/test/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImplTest.java Added comprehensive test coverage for null handling in data store processing
utils/src/main/java/com/cloud/utils/storage/S3/S3Utils.java Enabled path-style access for S3-compatible storage systems

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

Comment thread utils/src/main/java/com/cloud/utils/storage/S3/S3Utils.java
@Damans227
Damans227 requested a review from vishesh92 January 16, 2026 17:13
@kiranchavala

Copy link
Copy Markdown
Member

@blueorangutan package

@kiranchavala kiranchavala self-assigned this Jan 30, 2026

@kiranchavala kiranchavala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Damans227

Please find the issues that i observed

Tested with the pr packages and on oracle linux 8.6

  1. Unable to use ceph s3 storage , got the following exception is logs
2026-01-30 07:52:30,770 DEBUG [o.a.c.s.r.NfsSecondaryStorageResource] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Executing command "DownloadCommand" [{"hvm":false,"description":"SystemVM Template (KVM)","checksum":"c059b0d051e0cd6fbe9d5d4fc40c7e5d","maxDownloadSizeInBytes":53687091200,"id":3,"resourceType":"TEMPLATE","installPath":"template/tmpl/1/3/routing-3","_store":{"id":1,"uuid":"fdb66906-6b57-4e32-a7df-cbb93a917fce","accessKey":"AFYT2BKNI1U8T6DY6435","secretKey":"kia5kyDAZuP7QjwxNmhVAEE5l5dzsSJWbxtSXCIA","endPoint":"https://10.0.33.100","bucketName":"testbucket","httpsFlag":true,"created":"Jan 30, 2026, 7:52:20 AM","enableRRS":false,"maxSingleUploadSizeInBytes":5368709120},"followRedirects":false,"url":"http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2","format":"QCOW2","accountId":1,"name":"routing-3","contextMap":{},"wait":0,"bypassHostMaintenance":false}].
2026-01-30 07:52:30,798 DEBUG [c.c.u.n.HTTPUtils] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Initializing new HttpMethodRetryHandler with retry count 5
2026-01-30 07:52:30,892 INFO  [c.c.s.t.S3TemplateDownloader] (pool-10-thread-1:[ctx-2cad9dd2]) (logid:1b4a38df) Starting download from http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2 to S3 bucket testbucket and size (304.60 MB) 319401369 bytes
2026-01-30 07:52:30,897 DEBUG [c.c.u.s.S.S3Utils] (pool-10-thread-1:[ctx-2cad9dd2]) (logid:1b4a38df) Sending stream as S3 object template/tmpl/1/3/routing-3/systemvm64template-4.6.0-kvm.qcow2.bz2 in bucket testbucket using PutObjectRequest
2026-01-30 07:52:31,217 DEBUG [c.c.u.s.S.S3Utils] (pool-10-thread-1:[ctx-2cad9dd2]) (logid:1b4a38df) Creating S3 client with configuration: [protocol: https, signer: null, connectionTimeOut: 10000, maxErrorRetry: -1, socketTimeout: 50000, useTCPKeepAlive: null, connectionTtl: null]
2026-01-30 07:52:31,468 DEBUG [c.c.u.s.S.S3Utils] (pool-10-thread-1:[ctx-2cad9dd2]) (logid:1b4a38df) Setting the end point for S3 client with access key AFYT2BKNI1U8T6DY6435 to https://10.0.33.100.



2026-01-30 07:52:33,803 INFO  [o.a.c.s.i.BaseImageStoreDriverImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Updating store ref entry for template Template {"format":"QCOW2","id":3,"name":"SystemVM Template (KVM)","uniqueName":"routing-3","uuid":"56911227-fd0c-11f0-9d05-1e00e00002fb"}
2026-01-30 07:52:33,817 WARN  [c.c.a.AlertManagerImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) alertType=[28] dataCenterId=[1] podId=[null] clusterId=[null] message=[Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb with error: ].
2026-01-30 07:52:33,825 WARN  [c.c.a.AlertManagerImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) No recipients set in global setting 'alert.email.addresses', skipping sending alert with subject [Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb with error: ] and content [Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb with error: ].
2026-01-30 07:52:33,825 ERROR [o.a.c.s.i.BaseImageStoreDriverImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb 
with error:

  1. Used Minio s3 storage, the systemvm template got registered successfully

But it was of "systemvm64template-4.6.0-kvm.qcow2.bz2" and the systemvm were struck in starting state

Image
  1. When the primary storage is of zone scope,

logs

2026-01-30 09:32:23,838 DEBUG [o.a.c.s.v.VolumeServiceImpl] (Work-Job-Executor-7:[ctx-45ba2dab, job-40/job-47, ctx-3f578420]) (logid:17e47580) Found template Template {"format":"QCOW2","id":3,"name":"SystemVM Template (KVM)","uniqueName":"routing-3","uuid":"56911227-fd0c-11f0-9d05-1e00e00002fb"} in storage pool StoragePool {"id":1,"name":"pri","poolType":"NetworkFilesystem","uuid":"cfc7f591-fc1e-36dd-b2c5-dc6712acf57e"} with VMTemplateStoragePool: TmplPool[3-3-1-null]
2026-01-30 09:32:23,839 DEBUG [o.a.c.s.v.VolumeServiceImpl] (Work-Job-Executor-7:[ctx-45ba2dab, job-40/job-47, ctx-3f578420]) (logid:17e47580) Acquire lock on VMTemplateStoragePool 3 with timeout 3600 seconds


  1. When the primary storage is of cluster scope,

logs


2026-01-30 09:47:14,659 DEBUG [o.a.c.s.c.m.StorageCacheManagerImpl] (Work-Job-Executor-6:[ctx-fdef51b0, job-62/job-64, ctx-9c2c6347]) (logid:11a5fb7e) waiting cache copy completion type: template, id: 3, lock: 638897157
2026-01-30 09:47:24,659 DEBUG [o.a.c.s.c.m.StorageCacheManagerImpl] (Work-Job-Executor-6:[ctx-fdef51b0, job-62/job-64, ctx-9c2c6347]) (logid:11a5fb7e) waken up
2026-01-30 09:47:24,661 DEBUG [o.a.c.s.c.m.StorageCacheManagerImpl] (Work-Job-Executor-6:[ctx-fdef51b0, job-62/job-64, ctx-9c2c6347]) (logid:11a5fb7e) waiting cache copy completion type: template, id: 3, lock: 638897157

@abh1sar abh1sar added this to the 4.20.3 milestone Feb 1, 2026
@Damans227

Copy link
Copy Markdown
Collaborator Author

Tested with the pr packages and on oracle linux 8.6

Reproduced this issue around Ceph S3 being used as secondary storage. I too get the empty error - logs show downloadStatus: DOWNLOAD_ERROR but errorString is blank. Looking into it now.

logs:

2026-02-02 18:53:10,866 DEBUG [c.c.a.t.Request] Seq 3-6421288643700195481: Sending  { Cmd , DownloadCommand ... "_store":{"com.cloud.agent.api.to.S3TO":{"endPoint":"http://10.0.33.100","bucketName":"cloudstack-secondary"}} ... }
2026-02-02 18:53:13,956 DEBUG [c.c.a.t.Request] Seq 3-6421288643700195481: Processing:  { Ans: , DownloadAnswer {"errorString":"","downloadStatus":"DOWNLOAD_ERROR","templateSize":"(0 bytes) 0"} }
2026-02-02 18:53:13,978 ERROR [o.a.c.s.i.BaseImageStoreDriverImpl] Failed to register template: 36d0a884-0055-11f1-bd19-1e004d0003d0 with error: 

@Damans227

Damans227 commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator Author

@kiranchavala Regarding the Ceph issue, your logs show HTTPS endpoint (https://10.0.33.100) but port 443 isn't responding when I curl on that host:

darora@dell16plus:~$ curl -k https://10.0.33.100/testbucket
curl: (7) Failed to connect to 10.0.33.100 port 443 after 193 ms: Couldn't connect to server

However, testing with with HTTP (http://10.0.33.100) curl works fine, and the template downloads successfully:

The testbucket in screenshot below is where SystemVM template was downloaded.

image image

Could you try with HTTP instead? Is there a reason HTTPS was configured?

@kiranchavala

kiranchavala commented Feb 3, 2026

Copy link
Copy Markdown
Member

Thanks @Damans227

The issue is solved when I point it to a HTTP s3 link

Create a zone from scratch , in the zone creation wizard add s3 as the secondary storage

  1. Te system template that is getting download is a old one

  2. The db also points to a older record

mysql> select name,url,hypervisor_type from vm_template where type="SYSTEM";
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
| name                          | url                                                                                       | hypervisor_type |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
| SystemVM Template (XenServer) | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-xen.vhd.bz2          | XenServer       |
| SystemVM Template (KVM)       | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2        | KVM             |
| SystemVM Template (vSphere)   | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-vmware.ova           | VMware          |
| SystemVM Template (HyperV)    | http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2 | Hyperv          |
| SystemVM Template (LXC)       | http://download.cloudstack.org/templates/acton/acton-systemvm-02062012.qcow2.bz2          | LXC             |
| SystemVM Template (Ovm3)      | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-ovm.raw.bz2          | Ovm3            |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
aws --profile kirans3     --endpoint-url http://10.0.33.100     s3 ls s3://testcskiran --recursive
2026-02-03 15:16:34  319401369 template/tmpl/1/3/routing-3/systemvm64template-4.6.0-kvm.qcow2.bz2

aws --profile daman --endpoint-url http://10.0.33.100     s3 ls s3://testbucket --recursive
2026-02-03 00:36:02          5 template/test-upload.txt
2026-02-03 00:47:34  319401369 template/tmpl/1/3/routing-3/systemvm64template-4.6.0-kvm.qcow2.bz2
2026-01-09 11:21:48         14 test.txt

Will check again with a fresh deployment

@Damans227

Copy link
Copy Markdown
Collaborator Author

Thanks @Damans227

The issue is solved when I point it to a HTTP s3 link

Create a zone from scratch , in the zone creation wizard add s3 as the secondary storage

  1. Te system template that is getting download is a old one

  2. The db also points to a older record

mysql> select name,url,hypervisor_type from vm_template where type="SYSTEM";
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
| name                          | url                                                                                       | hypervisor_type |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
| SystemVM Template (XenServer) | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-xen.vhd.bz2          | XenServer       |
| SystemVM Template (KVM)       | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2        | KVM             |
| SystemVM Template (vSphere)   | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-vmware.ova           | VMware          |
| SystemVM Template (HyperV)    | http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2 | Hyperv          |
| SystemVM Template (LXC)       | http://download.cloudstack.org/templates/acton/acton-systemvm-02062012.qcow2.bz2          | LXC             |
| SystemVM Template (Ovm3)      | http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-ovm.raw.bz2          | Ovm3            |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------+
aws --profile kirans3     --endpoint-url http://10.0.33.100     s3 ls s3://testcskiran --recursive
2026-02-03 15:16:34  319401369 template/tmpl/1/3/routing-3/systemvm64template-4.6.0-kvm.qcow2.bz2

aws --profile daman --endpoint-url http://10.0.33.100     s3 ls s3://testbucket --recursive
2026-02-03 00:36:02          5 template/test-upload.txt
2026-02-03 00:47:34  319401369 template/tmpl/1/3/routing-3/systemvm64template-4.6.0-kvm.qcow2.bz2
2026-01-09 11:21:48         14 test.txt

Will check again with a fresh deployment

Got it. Thanks for checking.

@kiranchavala

Copy link
Copy Markdown
Member

Also @Damans227 If possible can you try to improve the cloudstack UI so that bucket details are show in the secondary storage details

Currently there is no way to identify the bucket and s3 URL

@Damans227

Copy link
Copy Markdown
Collaborator Author

2026-01-30 07:52:33,825 ERROR [o.a.c.s.i.BaseImageStoreDriverImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb
with error:

Yea, I’ll look into it.

Also noticed that when an exception happens during template registration, the error string is coming through empty. I’ll try to fix that as well.

2026-01-30 07:52:33,825 ERROR [o.a.c.s.i.BaseImageStoreDriverImpl] (pool-11-thread-1:[ctx-a125d9e1]) (logid:7259f280) Failed to register template: 56911227-fd0c-11f0-9d05-1e00e00002fb 
with error:

@Damans227

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

1 similar comment
@Damans227

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@Damans227

Copy link
Copy Markdown
Collaborator Author

@kiranchavala Bucket details shown in the secondary storage details:
image

@Damans227

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@kiranchavala

Copy link
Copy Markdown
Member

Thanks @Damans227 of the fixes

is the scope set to Region by Default or can Zone be set ?

@Damans227

Copy link
Copy Markdown
Collaborator Author

Thanks @Damans227 of the fixes

is the scope set to Region by Default or can Zone be set ?

No, S3 is hardcoded to REGION scope only and can't be set to ZONE.

@DaanHoogland
DaanHoogland force-pushed the fix/9002-s3-systemvm-bootstrap branch from 781138a to 80ff748 Compare August 4, 2026 07:45
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Suppressed comments (3)

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

  • Status.POST_DOWNLOAD_FINISHED is being set before postRemoteDownload(jobId) completes. convertStatus(POST_DOWNLOAD_FINISHED) maps to DOWNLOADED, so status polls can report the template as fully downloaded/installed while the install step is still running (or potentially fail later).
                // Set early so status polls see DOWNLOADED; overridden on error below
                td.setStatus(Status.POST_DOWNLOAD_FINISHED);
                td.setDownloadError("Download success, starting install ");
                String result = postRemoteDownload(jobId);
                if (result != null) {

core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java:223

  • When catching InterruptedException, the thread's interrupted flag should be restored (via Thread.currentThread().interrupt()) after logging/setting state. Otherwise higher-level code may not observe the interruption and shutdown/cancellation handling becomes unreliable.
        } catch (InterruptedException e) {
            errorString = "Interruption occurred while waiting for upload of " + downloadUrl + " to complete";
            logger.warn(errorString);
            status = Status.UNRECOVERABLE_ERROR;

server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java:106

  • newImageStoreResponse now calls imageStoreDetailsDao.getDetails(ids.getId()) for every S3 store returned. On list APIs this can introduce an extra query per store (N+1 pattern) and add noticeable DB overhead when many image stores exist.
        if (DataStoreProvider.S3_IMAGE.equalsIgnoreCase(ids.getProviderName())) {
            Map<String, String> s3Details = imageStoreDetailsDao.getDetails(ids.getId());
            if (s3Details != null) {
                osResponse.setS3Endpoint(s3Details.get(ApiConstants.S3_END_POINT));
                osResponse.setS3BucketName(s3Details.get(ApiConstants.S3_BUCKET_NAME));
            }

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.

Default systemVM template is not downloaded to S3 secondary storage

9 participants