From 6ceac8565f1fbdb34c7844a53e90d759e2917152 Mon Sep 17 00:00:00 2001 From: Suresh Kumar Anaparti Date: Wed, 16 Jul 2025 09:43:06 +0530 Subject: [PATCH 1/2] Fix to create instances with smaller templates (< 1 GB) on PowerFlex/ScaleIO storage --- .../driver/ScaleIOPrimaryDataStoreDriver.java | 4 ++-- .../driver/ScaleIOPrimaryDataStoreDriverTest.java | 12 ++++++++++++ .../kvm/storage/StorPoolStorageAdaptor.java | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java index 192ae4636e9c..a26b00a8f7b1 100644 --- a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java +++ b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java @@ -1362,9 +1362,9 @@ public void resize(DataObject dataObject, AsyncCompletionCallback Date: Thu, 17 Jul 2025 10:42:31 +0530 Subject: [PATCH 2/2] code improvements --- .../driver/ScaleIOPrimaryDataStoreDriver.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java index a26b00a8f7b1..3d2ca5b1d096 100644 --- a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java +++ b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java @@ -1230,13 +1230,13 @@ private void resizeVolume(VolumeInfo volumeInfo) { } org.apache.cloudstack.storage.datastore.api.Volume scaleIOVolume = client.getVolume(scaleIOVolumeId); - long newSizeInGB = newSizeInBytes / (1024 * 1024 * 1024); - long newSizeIn8gbBoundary = (long) (Math.ceil(newSizeInGB / 8.0) * 8.0); + double newSizeInGB = newSizeInBytes / (1024.0 * 1024 * 1024); + long newSizeIn8GBBoundary = (long) (Math.ceil(newSizeInGB / 8.0) * 8.0); - if (scaleIOVolume.getSizeInKb() == newSizeIn8gbBoundary << 20) { + if (scaleIOVolume.getSizeInKb() == newSizeIn8GBBoundary << 20) { logger.debug("No resize necessary at API"); } else { - scaleIOVolume = client.resizeVolume(scaleIOVolumeId, (int) newSizeIn8gbBoundary); + scaleIOVolume = client.resizeVolume(scaleIOVolumeId, (int) newSizeIn8GBBoundary); if (scaleIOVolume == null) { throw new CloudRuntimeException("Failed to resize volume: " + volumeInfo.getName()); } @@ -1366,8 +1366,8 @@ public long getVolumeSizeRequiredOnPool(long volumeSize, Long templateSize, bool if (templateSize != null && isEncryptionRequired && needsExpansionForEncryptionHeader(templateSize, volumeSize)) { newSizeInGB = (volumeSize + (1<<30)) / (1024.0 * 1024 * 1024); } - long newSizeIn8gbBoundary = (long) (Math.ceil(newSizeInGB / 8.0) * 8.0); - return newSizeIn8gbBoundary * (1024 * 1024 * 1024); + long newSizeIn8GBBoundary = (long) (Math.ceil(newSizeInGB / 8.0) * 8.0); + return newSizeIn8GBBoundary * (1024 * 1024 * 1024); } @Override