Copilot commented on code in PR #12426:
URL: https://github.com/apache/cloudstack/pull/12426#discussion_r2697091918


##########
engine/storage/src/main/java/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java:
##########
@@ -400,7 +400,9 @@ public EndPoint select(DataObject object) {
         }
         if (object instanceof TemplateInfo) {
             TemplateInfo tmplInfo = (TemplateInfo)object;
-            if (store.getScope().getScopeType() == ScopeType.ZONE && 
store.getScope().getScopeId() == null && tmplInfo.getTemplateType() == 
TemplateType.SYSTEM) {
+            if (tmplInfo.getTemplateType() == TemplateType.SYSTEM &&
+                (store.getScope().getScopeType() == ScopeType.REGION ||
+                 (store.getScope().getScopeType() == ScopeType.ZONE && 
store.getScope().getScopeId() == null))) {

Review Comment:
   The modified endpoint selection logic for REGION-scoped SYSTEM templates 
lacks test coverage. Consider adding unit tests in the engine/storage module to 
verify that LocalHostEndpoint is correctly returned for REGION-scoped stores 
with SYSTEM templates, similar to the existing test coverage in 
SecondaryStorageManagerImplTest.



##########
utils/src/main/java/com/cloud/utils/storage/S3/S3Utils.java:
##########
@@ -114,6 +114,8 @@ public static TransferManager getTransferManager(final 
ClientOptions clientOptio
             LOGGER.debug(format("Setting the end point for S3 client with 
access key %1$s to %2$s.", clientOptions.getAccessKey(), 
clientOptions.getEndPoint()));
 
             client.setEndpoint(clientOptions.getEndPoint());
+            // Enable path-style access for S3-compatible storage
+            
client.setS3ClientOptions(com.amazonaws.services.s3.S3ClientOptions.builder().setPathStyleAccess(true).build());

Review Comment:
   Path-style access is being enabled unconditionally for all S3 endpoints, 
including AWS S3 which deprecated path-style access in favor of 
virtual-hosted-style. This could cause compatibility issues with AWS S3. 
Consider making path-style access configurable through ClientOptions, or only 
enabling it when a custom endpoint is detected (non-AWS S3).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to