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


##########
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java:
##########
@@ -1785,6 +1802,45 @@ 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(String.format("The 
root disk offering '%s' is not supported by the selected conversion storage 
pool '%s'. " +
+                        "When using VDDK, all selected disk offerings must be 
compatible with the conversion storage pool, as it will become the primary 
storage for the imported volumes.",

Review Comment:
   conversion storage pool is option parameter, and for ovf export scenario, 
secondary storage is used as the default conversion storage. ensure conversion 
storage pool is set in case of vddk (and update the update the importVm API 
parameter `convertinstancepoolid` description that it is the primary storage 
for vddk enabled 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