Copilot commented on code in PR #14314:
URL: https://github.com/apache/cloudstack/pull/14314#discussion_r4200846007
##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -1127,6 +1127,11 @@ private VolumeVO createVolumeOnStoragePool(Long
volumeId, Long storageId) throws
throw new InvalidParameterValueException(String.format("Disk
offering: %s is not compatible with the storage pool", diskOffering.getUuid()));
}
+ if (!storageMgr.storagePoolHasEnoughSpace(volume.getSize(),
storagePool)) {
Review Comment:
The size-only overload checks allocated capacity but skips
`StorageManagerImpl.checkUsagedSpace()`. A pool already above
`pool.storage.capacity.disablethreshold` can therefore pass when its
over-provisioned allocation still has headroom, allowing a backend create
attempt on physically exhausted storage. Use the volume/DiskProfile overload,
as volume migration does, to apply both the physical-usage and
allocated-capacity checks.
##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -1127,6 +1127,11 @@ private VolumeVO createVolumeOnStoragePool(Long
volumeId, Long storageId) throws
throw new InvalidParameterValueException(String.format("Disk
offering: %s is not compatible with the storage pool", diskOffering.getUuid()));
}
+ if (!storageMgr.storagePoolHasEnoughSpace(volume.getSize(),
storagePool)) {
+ throw new InvalidParameterValueException(String.format("Storage
pool %s does not have enough space to create volume %s.",
+ storagePool.getName(), volume.getUuid()));
Review Comment:
This capacity-specific message never reaches the API caller.
`createVolume()` catches this exception and wraps it at line 1192 with only
“Failed to create volume: …”; `ApiAsyncJobDispatcher` reports that outer
message. Rethrow `InvalidParameterValueException` after the existing cleanup,
before the generic wrapper, so callers learn that capacity is insufficient
while resource-count cleanup still runs.
--
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]