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

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


The following commit(s) were added to refs/heads/main by this push:
     new bc76f2042d7 Change migration volume exception messages (#12367)
bc76f2042d7 is described below

commit bc76f2042d74ecee12a4cbea95e70b4bd75aae85
Author: Tonitzpp <[email protected]>
AuthorDate: Thu Jan 8 09:55:34 2026 -0300

    Change migration volume exception messages (#12367)
    
    Co-authored-by: toni.zamparetti <[email protected]>
    Co-authored-by: Copilot <[email protected]>
---
 server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java 
b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 4f03e788173..bdf9bc1bc1d 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -2179,14 +2179,16 @@ public class VolumeApiServiceImpl extends ManagerBase 
implements VolumeApiServic
             }
             Collections.shuffle(suitableStoragePoolsWithEnoughSpace);
             MigrateVolumeCmd migrateVolumeCmd = new 
MigrateVolumeCmd(volume.getId(), 
suitableStoragePoolsWithEnoughSpace.get(0).getId(), newDiskOffering.getId(), 
true);
+            String volumeUuid = volume.getUuid();
             try {
                 Volume result = migrateVolume(migrateVolumeCmd);
                 volume = (result != null) ? _volsDao.findById(result.getId()) 
: null;
                 if (volume == null) {
-                    throw new CloudRuntimeException(String.format("Volume 
change offering operation failed for volume: %s migration failed to storage 
pool %s", volume, suitableStoragePools.get(0)));
+                    throw new CloudRuntimeException("Change offering for the 
volume failed.");
                 }
             } catch (Exception e) {
-                throw new CloudRuntimeException(String.format("Volume change 
offering operation failed for volume: %s migration failed to storage pool %s 
due to %s", volume, suitableStoragePools.get(0), e.getMessage()));
+                logger.error("Volume change offering operation failed for 
volume ID: {} migration failed to storage pool {} due to {}", volumeUuid, 
suitableStoragePoolsWithEnoughSpace.get(0).getId(), e.getMessage());
+                throw new CloudRuntimeException("Change offering for the 
volume failed.", e);
             }
         }
 
@@ -2199,7 +2201,7 @@ public class VolumeApiServiceImpl extends ManagerBase 
implements VolumeApiServic
                 if (volumeMigrateRequired) {
                     logger.warn(String.format("Volume change offering 
operation succeeded for volume ID: %s but volume resize operation failed, so 
please try resize volume operation separately", volume.getUuid()));
                 } else {
-                    throw new CloudRuntimeException(String.format("Volume 
change offering operation failed for volume ID: %s due to resize volume 
operation failed", volume.getUuid()));
+                    throw new CloudRuntimeException(String.format("Volume disk 
offering change operation failed for volume ID [%s] because the volume resize 
operation failed.", volume.getUuid()));
                 }
             }
         }

Reply via email to