Copilot commented on code in PR #14071:
URL: https://github.com/apache/cloudstack/pull/14071#discussion_r3950562220


##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -1127,7 +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()));
         }
 
-        DataStore dataStore = dataStoreMgr.getDataStore(storageId, 
DataStoreRole.Primary);
+        HypervisorType hypervisorType = 
_volsDao.getHypervisorType(volume.getId());
+        DiskProfile diskProfile = new DiskProfile(volume, diskOffering, 
hypervisorType);
+        Pair<Volume, DiskProfile> volumeDiskProfilePair = new Pair<>(volume, 
diskProfile);
+        if 
(!storageMgr.storagePoolHasEnoughSpace(Collections.singletonList(volumeDiskProfilePair),
 storagePool)) {
+        DataStore dataStore = (DataStore) storagePool;

Review Comment:
   The new storage-pool capacity check opens an `if` block but doesn’t 
throw/return on failure, and the block isn’t closed. As written, this makes the 
method syntactically invalid and also wouldn’t reject requests when the pool is 
past the disable threshold / lacks space.



-- 
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]

Reply via email to