piyush5netapp commented on code in PR #13053:
URL: https://github.com/apache/cloudstack/pull/13053#discussion_r3207356148
##########
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:
@winterhazel I understand that if we do
if (!dataObject.getType() == DataObjectType.VOLUME) {
errMsg = "Invalid DataObjectType (" + dataObject.getType() +
") passed to createAsync";
logger.error(errMsg);
throw new CloudRuntimeException(errMsg);
}
... followed by code supporting VOLUME dataobject type.
seems appropriate now as we currently support volume type only.
But we have written in this way as we will be supporting other dataObject
Type in coming months.
In that case , we can have switch or if block of all supported and at last
else with unsupported type.
Let me know your thoughts on this so that I can take care of the similar
comments accordingly.
--
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]