This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit cee330e7c8713cfad8fd6e849a6680c25d6bd230
Merge: 8936e4c5350 47a6ac89ba5
Author: Daan Hoogland <[email protected]>
AuthorDate: Mon Dec 22 10:27:57 2025 +0100

    Merge branch '4.20' into 4.22

 .../command/user/template/CreateTemplateCmd.java   |   2 +-
 .../template/GetUploadParamsForTemplateCmd.java    |   2 +-
 .../command/user/template/RegisterTemplateCmd.java |   2 +-
 debian/rules                                       |   3 +-
 .../service/StorageOrchestrationService.java       |   6 +
 .../subsystem/api/storage/TemplateService.java     |   2 +
 .../java/com/cloud/storage/StorageManager.java     |  26 +--
 .../engine/orchestration/DataMigrationUtility.java |  90 ++++++++---
 .../engine/orchestration/StorageOrchestrator.java  | 154 ++++++++++++++----
 engine/schema/templateConfig.sh                    |  14 +-
 .../storage/image/TemplateServiceImpl.java         | 179 +++++++++++++++------
 .../storage/image/TemplateServiceImplTest.java     | 102 ++++++++++++
 packaging/el8/cloud.spec                           |   3 +-
 .../cloudstack/api/ListVolumesUsageHistoryCmd.java |   3 +-
 .../cloudstack/metrics/MetricsServiceImpl.java     |  48 ++++--
 .../consoleproxy/ConsoleProxyManagerImpl.java      |   2 +-
 .../java/com/cloud/storage/StorageManagerImpl.java |   7 +-
 17 files changed, 503 insertions(+), 142 deletions(-)

diff --cc debian/rules
index 4c3023aeae2,da49ca55c1b..842fc2408af
--- a/debian/rules
+++ b/debian/rules
@@@ -86,11 -82,10 +85,11 @@@ override_dh_auto_install
        cp client/target/cloud-client-ui-$(VERSION).jar 
$(DESTDIR)/usr/share/$(PACKAGE)-management/lib/cloudstack-$(VERSION).jar
        cp client/target/lib/*jar 
$(DESTDIR)/usr/share/$(PACKAGE)-management/lib/
        cp -r engine/schema/dist/systemvm-templates/* 
$(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/
 -      rm -rf 
$(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/md5sum.txt
 +      cp -r plugins/integrations/kubernetes-service/src/main/resources/conf/* 
$(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/
 +      rm -rf 
$(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/sha512sum.txt
  
        # Bundle cmk in cloudstack-management
-       wget 
https://github.com/apache/cloudstack-cloudmonkey/releases/download/$(CMK_REL)/cmk.linux.x86-64
 -O $(DESTDIR)/usr/bin/cmk
+       wget 
https://github.com/apache/cloudstack-cloudmonkey/releases/latest/download/cmk.linux.x86-64
 -O $(DESTDIR)/usr/bin/cmk
        chmod +x $(DESTDIR)/usr/bin/cmk
  
        # nast hack for a couple of configuration files
diff --cc 
engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
index dbaffa8b3b5,de0cb34d63e..3e3901cb293
--- a/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
+++ b/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
@@@ -161,22 -161,22 +161,22 @@@ public interface StorageManager extend
              ConfigKey.Scope.StoragePool,
              null);
  
--    ConfigKey<Integer> PRIMARY_STORAGE_DOWNLOAD_WAIT = new 
ConfigKey<Integer>("Storage", Integer.class, "primary.storage.download.wait", 
"10800",
++    ConfigKey<Integer> PRIMARY_STORAGE_DOWNLOAD_WAIT = new 
ConfigKey<>("Storage", Integer.class, "primary.storage.download.wait", "10800",
              "In second, timeout for download template to primary storage", 
false);
  
--    ConfigKey<Integer>  SecStorageMaxMigrateSessions = new 
ConfigKey<Integer>("Advanced", Integer.class, 
"secstorage.max.migrate.sessions", "2",
++    ConfigKey<Integer>  SecStorageMaxMigrateSessions = new 
ConfigKey<>("Advanced", Integer.class, "secstorage.max.migrate.sessions", "2",
              "The max number of concurrent copy command execution sessions 
that an SSVM can handle", false, ConfigKey.Scope.Global);
  
--    ConfigKey<Boolean>  SecStorageVMAutoScaleDown = new 
ConfigKey<Boolean>("Advanced", Boolean.class, "secstorage.vm.auto.scale.down", 
"false",
++    ConfigKey<Boolean>  SecStorageVMAutoScaleDown = new 
ConfigKey<>("Advanced", Boolean.class, "secstorage.vm.auto.scale.down", "false",
              "Setting this to 'true' will auto scale down SSVMs", true, 
ConfigKey.Scope.Global);
  
--    ConfigKey<Integer> MaxDataMigrationWaitTime = new 
ConfigKey<Integer>("Advanced", Integer.class, "max.data.migration.wait.time", 
"15",
++    ConfigKey<Integer> MaxDataMigrationWaitTime = new ConfigKey<>("Advanced", 
Integer.class, "max.data.migration.wait.time", "15",
              "Maximum wait time (in minutes) for a data migration task before 
spawning a new SSVM", false, ConfigKey.Scope.Global);
--    ConfigKey<Boolean> DiskProvisioningStrictness = new 
ConfigKey<Boolean>("Storage", Boolean.class, 
"disk.provisioning.type.strictness", "false",
++    ConfigKey<Boolean> DiskProvisioningStrictness = new 
ConfigKey<>("Storage", Boolean.class, "disk.provisioning.type.strictness", 
"false",
              "If set to true, the disk is created only when there is a 
suitable storage pool that supports the disk provisioning type specified by the 
service/disk offering. " +
                      "If set to false, the disk is created with a disk 
provisioning type supported by the pool. Default value is false, and this is 
currently supported for VMware only.",
              true, ConfigKey.Scope.Zone);
--    ConfigKey<String> PreferredStoragePool = new 
ConfigKey<String>(String.class, "preferred.storage.pool", "Advanced", "",
++    ConfigKey<String> PreferredStoragePool = new ConfigKey<>(String.class, 
"preferred.storage.pool", "Advanced", "",
              "The UUID of preferred storage pool for allocation.", true, 
ConfigKey.Scope.Account, null);
  
      ConfigKey<Boolean> MountDisabledStoragePool = new 
ConfigKey<>(Boolean.class,
@@@ -203,7 -203,7 +203,7 @@@
              true,
              ConfigKey.Scope.Global,
              null);
--    static final ConfigKey<Boolean> DataStoreDownloadFollowRedirects = new 
ConfigKey<>(ConfigKey.CATEGORY_ADVANCED,
++    ConfigKey<Boolean> DataStoreDownloadFollowRedirects = new 
ConfigKey<>(ConfigKey.CATEGORY_ADVANCED,
              Boolean.class, "store.download.follow.redirects", "false",
              "Whether HTTP redirect is followed during store downloads for 
objects such as template, volume etc.",
              true, ConfigKey.Scope.Global);
@@@ -211,23 -211,19 +211,27 @@@
      ConfigKey<Long> HEURISTICS_SCRIPT_TIMEOUT = new ConfigKey<>("Advanced", 
Long.class, "heuristics.script.timeout", "3000",
              "The maximum runtime, in milliseconds, to execute the heuristic 
rule; if it is reached, a timeout will happen.", true);
  
--    ConfigKey<Boolean> AllowVolumeReSizeBeyondAllocation = new 
ConfigKey<Boolean>("Advanced", Boolean.class, 
"volume.resize.allowed.beyond.allocation", "false",
++    ConfigKey<Boolean> AllowVolumeReSizeBeyondAllocation = new 
ConfigKey<>("Advanced", Boolean.class, 
"volume.resize.allowed.beyond.allocation", "false",
              "Determines whether volume size can exceed the pool capacity 
allocation disable threshold (pool.storage.allocated.capacity.disablethreshold) 
" +
                      "when resize a volume upto resize capacity disable 
threshold (pool.storage.allocated.resize.capacity.disablethreshold)",
 -            true, ConfigKey.Scope.Zone);
 +            true, List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone));
  
      ConfigKey<Integer> StoragePoolHostConnectWorkers = new 
ConfigKey<>("Storage", Integer.class,
              "storage.pool.host.connect.workers", "1",
              "Number of worker threads to be used to connect hosts to a 
primary storage", true);
  
 +    ConfigKey<Float> ObjectStorageCapacityThreshold = new 
ConfigKey<>("Alert", Float.class,
 +            "objectStorage.capacity.notificationthreshold",
 +            "0.75",
 +            "Percentage (as a value between 0 and 1) of object storage 
utilization above which alerts will be sent about low storage available.",
 +            true,
 +            ConfigKey.Scope.Global,
 +            null);
 +
+     ConfigKey<Boolean> COPY_PUBLIC_TEMPLATES_FROM_OTHER_STORAGES = new 
ConfigKey<>(Boolean.class, "copy.public.templates.from.other.storages",
+             "Storage", "true", "Allow SSVMs to try copying public templates 
from one secondary storage to another instead of downloading them from the 
source.",
+             true, ConfigKey.Scope.Zone, null);
+ 
      /**
       * should we execute in sequence not involving any storages?
       * @return tru if commands should execute in sequence
@@@ -252,14 -248,14 +256,14 @@@
  
      /**
       * Returns a comma separated list of tags for the specified storage pool
--     * @param poolId
++     * @param poolId the id of the pool to get tags for
       * @return comma separated list of tags
       */
      String getStoragePoolTags(long poolId);
  
      /**
       * Returns a list of Strings with tags for the specified storage pool
--     * @param poolId
++     * @param poolId the id of the pool to get tags for
       * @return comma separated list of tags
       */
      List<String> getStoragePoolTagList(long poolId);
@@@ -276,7 -272,7 +280,7 @@@
  
      Pair<Long, Answer> sendToPool(StoragePool pool, long[] hostIdsToTryFirst, 
List<Long> hostIdsToAvoid, Command cmd) throws StorageUnavailableException;
  
--    public Answer getVolumeStats(StoragePool pool, Command cmd);
++    Answer getVolumeStats(StoragePool pool, Command cmd);
  
      boolean canPoolProvideStorageStats(StoragePool pool);
  
diff --cc engine/schema/templateConfig.sh
index d6d1809c24d,0d55eb37d04..3a963e57617
mode 100755,100644..100755
--- a/engine/schema/templateConfig.sh
+++ b/engine/schema/templateConfig.sh
@@@ -91,8 -91,8 +91,8 @@@ templates=( "kvm-x86_64:https://downloa
              
"ovm3:https://download.cloudstack.org/systemvm/$CS_VERSION/systemvmtemplate-$VERSION-x86_64-ovm.raw.bz2";
 )
  
  PARENTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P 
)/dist/systemvm-templates/"
- mkdir -p $PARENTPATH
- METADATAFILE=${PARENTPATH}"metadata.ini"
- echo > $METADATAFILE
- SOURCEFILE=${PARENTPATH}'sha512sum.txt'
+ mkdir -p "$PARENTPATH"
+ METADATAFILE="${PARENTPATH}metadata.ini"
+ echo > "$METADATAFILE"
 -SOURCEFILE="${PARENTPATH}md5sum.txt"
++SOURCEFILE="${PARENTPATH}sha512sum.txt"
  createMetadataFile
diff --cc server/src/main/java/com/cloud/storage/StorageManagerImpl.java
index df0283ae2d6,19da1425dc0..61a5f19c857
--- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
@@@ -3354,7 -2958,7 +3354,7 @@@ public class StorageManagerImpl extend
              throw new InvalidParameterValueException(String.format("host: %s 
is not a secondary storage", secHost));
          }
  
--        URI uri = null;
++        URI uri;
          try {
              uri = new URI(UriUtils.encodeURIComponent(newUrl));
              if (uri.getScheme() == null) {
@@@ -3377,7 -2981,7 +3377,7 @@@
  
          String oldUrl = secHost.getStorageUrl();
  
--        URI oldUri = null;
++        URI oldUri;
          try {
              oldUri = new URI(UriUtils.encodeURIComponent(oldUrl));
              if (!oldUri.getScheme().equalsIgnoreCase(uri.getScheme())) {
@@@ -4602,7 -4195,7 +4602,8 @@@
                  DataStoreDownloadFollowRedirects,
                  AllowVolumeReSizeBeyondAllocation,
                  StoragePoolHostConnectWorkers,
-                 ObjectStorageCapacityThreshold
++                ObjectStorageCapacityThreshold,
+                 COPY_PUBLIC_TEMPLATES_FROM_OTHER_STORAGES
          };
      }
  

Reply via email to