Skip to content

Commit d0fc058

Browse files
Tonitzpptoni.zamparettiCopilot
authored andcommitted
Change migration volume exception messages (apache#12367)
Co-authored-by: toni.zamparetti <toni.zamparetti@scclouds.com.br> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 687ffcb commit d0fc058

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,14 +2220,16 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
22202220
}
22212221
Collections.shuffle(suitableStoragePoolsWithEnoughSpace);
22222222
MigrateVolumeCmd migrateVolumeCmd = new MigrateVolumeCmd(volume.getId(), suitableStoragePoolsWithEnoughSpace.get(0).getId(), newDiskOffering.getId(), true);
2223+
String volumeUuid = volume.getUuid();
22232224
try {
22242225
Volume result = migrateVolume(migrateVolumeCmd);
22252226
volume = (result != null) ? _volsDao.findById(result.getId()) : null;
22262227
if (volume == null) {
2227-
throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume: %s migration failed to storage pool %s", volume, suitableStoragePools.get(0)));
2228+
throw new CloudRuntimeException("Change offering for the volume failed.");
22282229
}
22292230
} catch (Exception e) {
2230-
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()));
2231+
logger.error("Volume change offering operation failed for volume ID: {} migration failed to storage pool {} due to {}", volumeUuid, suitableStoragePoolsWithEnoughSpace.get(0).getId(), e.getMessage());
2232+
throw new CloudRuntimeException("Change offering for the volume failed.", e);
22312233
}
22322234
}
22332235

@@ -2240,7 +2242,7 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
22402242
if (volumeMigrateRequired) {
22412243
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()));
22422244
} else {
2243-
throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume ID: %s due to resize volume operation failed", volume.getUuid()));
2245+
throw new CloudRuntimeException(String.format("Volume disk offering change operation failed for volume ID [%s] because the volume resize operation failed.", volume.getUuid()));
22442246
}
22452247
}
22462248
}

0 commit comments

Comments
 (0)