sureshanaparti commented on code in PR #12970:
URL: https://github.com/apache/cloudstack/pull/12970#discussion_r3049336807


##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -1785,6 +1798,41 @@ protected void checkConversionStoragePool(Long 
convertStoragePoolId, boolean for
         }
     }
 
+    protected void validateSelectedConversionStoragePoolForVddk(boolean 
useVddk, Long convertStoragePoolId,
+                                                                
ServiceOfferingVO serviceOffering, Map<String, Long> dataDiskOfferingMap) {
+        if (!useVddk || convertStoragePoolId == null) {
+            return;
+        }
+
+        StoragePoolVO selectedStoragePool = 
primaryDataStoreDao.findById(convertStoragePoolId);
+        if (selectedStoragePool == null) {
+            return;
+        }
+
+        if (serviceOffering.getDiskOfferingId() != null) {
+            DiskOfferingVO rootDiskOffering = 
diskOfferingDao.findById(serviceOffering.getDiskOfferingId());
+            if (rootDiskOffering == null) {
+                throw new InvalidParameterValueException(String.format("Cannot 
find disk offering with ID %s that belongs to the service offering %s",
+                        serviceOffering.getDiskOfferingId(), 
serviceOffering.getName()));
+            }
+            if 
(!volumeApiService.doesStoragePoolSupportDiskOffering(selectedStoragePool, 
rootDiskOffering)) {
+                throw new InvalidParameterValueException("Using VDDK, multiple 
storage pools cannot be used if a storage pool is selected for conversion");

Review Comment:
   better rephrase the msg, to indicate that the selected compute/disk 
offerings picked multiple storage pools other than the selected pool for 
conversion.



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