Copilot commented on code in PR #12367:
URL: https://github.com/apache/cloudstack/pull/12367#discussion_r2671896646
##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -2179,14 +2179,16 @@ public Volume changeDiskOfferingForVolumeInternal(Long
volumeId, Long newDiskOff
}
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);
Review Comment:
The error message "Change offering for the volume failed." is grammatically
correct but could be more specific. Consider using "Failed to change the
volume's disk offering." for better clarity and consistency with other error
messages in the codebase.
##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -2179,14 +2179,16 @@ public Volume changeDiskOfferingForVolumeInternal(Long
volumeId, Long newDiskOff
}
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.");
Review Comment:
The error message "Change offering for the volume failed." is grammatically
correct but could be more specific. Consider using "Failed to change the
volume's disk offering." for better clarity and consistency with other error
messages in the codebase.
--
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]