winterhazel commented on code in PR #13053:
URL: https://github.com/apache/cloudstack/pull/13053#discussion_r3223398049


##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java:
##########
@@ -65,14 +108,235 @@ public DataTO getTO(DataObject data) {
     @Override
     public DataStoreTO getStoreTO(DataStore store) { return null; }
 
+    @Override
+    public boolean volumesRequireGrantAccessWhenUsed(){
+        logger.info("OntapPrimaryDatastoreDriver: 
volumesRequireGrantAccessWhenUsed: Called");
+        return true;
+    }
+
+    /**
+     * Creates a volume on the ONTAP storage system.
+     */
     @Override
     public void createAsync(DataStore dataStore, DataObject dataObject, 
AsyncCompletionCallback<CreateCmdResult> callback) {
-        throw new UnsupportedOperationException("Create operation is not 
supported for ONTAP primary storage.");
+        CreateCmdResult createCmdResult = null;
+        String errMsg;
+
+        if (dataObject == null) {
+            throw new InvalidParameterValueException("dataObject should not be 
null");
+        }
+        if (dataStore == null) {
+            throw new InvalidParameterValueException("dataStore should not be 
null");
+        }
+        if (callback == null) {
+            throw new InvalidParameterValueException("callback should not be 
null");
+        }
+
+        try {
+            logger.info("Started for data store name [{}] and data object name 
[{}] of type [{}]",
+                    dataStore.getName(), dataObject.getName(), 
dataObject.getType());
+
+            StoragePoolVO storagePool = 
storagePoolDao.findById(dataStore.getId());
+            if (storagePool == null) {
+                logger.error("createAsync: Storage Pool not found for id: " + 
dataStore.getId());
+                throw new CloudRuntimeException("Storage Pool not found for 
id: " + dataStore.getId());
+            }
+            String storagePoolUuid = dataStore.getUuid();
+
+            Map<String, String> details = 
storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId());
+
+            if (dataObject.getType() == DataObjectType.VOLUME) {

Review Comment:
   @piyush5netapp got it. In this case, I think you should go with what you 
think is more manageable/better to maintain in the future (both here and for 
similar comments).
   
   I would go with different methods for handling each data object type here. 
Not demanding that you implement it in this way though. If you prefer the way 
it is now, I'm ok with it.



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