Skip to content

Commit bc76f20

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,14 +2179,16 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
21792179
}
21802180
Collections.shuffle(suitableStoragePoolsWithEnoughSpace);
21812181
MigrateVolumeCmd migrateVolumeCmd = new MigrateVolumeCmd(volume.getId(), suitableStoragePoolsWithEnoughSpace.get(0).getId(), newDiskOffering.getId(), true);
2182+
String volumeUuid = volume.getUuid();
21822183
try {
21832184
Volume result = migrateVolume(migrateVolumeCmd);
21842185
volume = (result != null) ? _volsDao.findById(result.getId()) : null;
21852186
if (volume == null) {
2186-
throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume: %s migration failed to storage pool %s", volume, suitableStoragePools.get(0)));
2187+
throw new CloudRuntimeException("Change offering for the volume failed.");
21872188
}
21882189
} catch (Exception e) {
2189-
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()));
2190+
logger.error("Volume change offering operation failed for volume ID: {} migration failed to storage pool {} due to {}", volumeUuid, suitableStoragePoolsWithEnoughSpace.get(0).getId(), e.getMessage());
2191+
throw new CloudRuntimeException("Change offering for the volume failed.", e);
21902192
}
21912193
}
21922194

@@ -2199,7 +2201,7 @@ public Volume changeDiskOfferingForVolumeInternal(Long volumeId, Long newDiskOff
21992201
if (volumeMigrateRequired) {
22002202
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()));
22012203
} else {
2202-
throw new CloudRuntimeException(String.format("Volume change offering operation failed for volume ID: %s due to resize volume operation failed", volume.getUuid()));
2204+
throw new CloudRuntimeException(String.format("Volume disk offering change operation failed for volume ID [%s] because the volume resize operation failed.", volume.getUuid()));
22032205
}
22042206
}
22052207
}

0 commit comments

Comments
 (0)