@@ -128,22 +128,19 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
128128 throw new CloudRuntimeException ("createCloudStackVolume : Storage Pool not found for id: " + dataStore .getId ());
129129 }
130130 Map <String , String > details = storagePoolDetailsDao .listDetailsKeyPairs (dataStore .getId ());
131+ // For NFS, skip ONTAP REST API operations - CloudStack manages files natively
132+ if (ProtocolType .NFS .name ().equalsIgnoreCase (details .get (Constants .PROTOCOL ))) {
133+ String volumeUuid = ((VolumeInfo ) dataObject ).getUuid ();
134+ s_logger .info ("createCloudStackVolumeForTypeVolume: NFS protocol detected - returning volume UUID for native file management: {}" , volumeUuid );
135+ return volumeUuid ;
136+ }
137+ // For iSCSI and other protocols, use ONTAP REST API
131138 StorageStrategy storageStrategy = getStrategyByStoragePoolDetails (details );
132139 s_logger .info ("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [{}] successful, preparing CloudStackVolumeRequest" , details .get (Constants .SVM_NAME ));
133140 CloudStackVolume cloudStackVolumeRequest = Utility .createCloudStackVolumeRequestByProtocol (storagePool , details , (VolumeInfo ) dataObject );
134141 CloudStackVolume cloudStackVolume = storageStrategy .createCloudStackVolume (cloudStackVolumeRequest );
135142 if (ProtocolType .ISCSI .name ().equalsIgnoreCase (details .get (Constants .PROTOCOL )) && cloudStackVolume .getLun () != null && cloudStackVolume .getLun ().getName () != null ) {
136143 return cloudStackVolume .getLun ().getName ();
137- } else if (ProtocolType .NFS .name ().equalsIgnoreCase (details .get (Constants .PROTOCOL ))) {
138- // For NFS, ONTAP creates a directory for organization
139- // CloudStack will create the actual .qcow2 file inside this directory
140- String directoryName = cloudStackVolume .getCloudstackVolName ();
141- String volumeUuid = ((VolumeInfo ) dataObject ).getUuid ();
142- // Return path: "directory-name/volume-uuid"
143- // CloudStack will append .qcow2 extension when creating the actual disk file
144- String volumePath = directoryName + "/" + volumeUuid ;
145- s_logger .info ("createCloudStackVolumeForTypeVolume: NFS volume directory [{}] created, returning path: {}" , directoryName , volumePath );
146- return volumePath ;
147144 } else {
148145 String errMsg = "createCloudStackVolumeForTypeVolume: Volume creation failed. Lun or Lun Path is null for dataObject: " + dataObject ;
149146 s_logger .error (errMsg );
0 commit comments