3131import org .apache .cloudstack .storage .feign .model .Volume ;
3232import org .apache .cloudstack .storage .feign .model .response .JobResponse ;
3333import org .apache .cloudstack .storage .feign .model .response .OntapResponse ;
34+ import org .apache .cloudstack .storage .service .model .AccessGroup ;
35+ import org .apache .cloudstack .storage .service .model .CloudStackVolume ;
3436import org .apache .cloudstack .storage .utils .Constants ;
3537import org .apache .cloudstack .storage .utils .Utility ;
3638import org .apache .logging .log4j .LogManager ;
4244import java .util .List ;
4345import java .util .Objects ;
4446
47+ /**
48+ * Storage Strategy represents the communication path for all the ONTAP storage options
49+ *
50+ * ONTAP storage operation would vary based on
51+ * Supported protocols: NFS3.0, NFS4.1, FC, iSCSI, Nvme/TCP and Nvme/FC
52+ * Supported platform: Unified and Disaggregated
53+ */
4554public abstract class StorageStrategy {
4655 @ Inject
4756 private Utility utils ;
@@ -57,12 +66,16 @@ public abstract class StorageStrategy {
5766
5867 private final OntapStorage storage ;
5968
69+ /**
70+ * Presents aggregate object for the unified storage, not eligible for disaggregated
71+ */
6072 private List <Aggregate > aggregates ;
6173
6274 private static final Logger s_logger = (Logger ) LogManager .getLogger (StorageStrategy .class );
6375
6476 public StorageStrategy (OntapStorage ontapStorage ) {
6577 storage = ontapStorage ;
78+
6679 }
6780
6881 // Connect method to validate ONTAP cluster, credentials, protocol, and SVM
@@ -108,7 +121,16 @@ public boolean connect() {
108121 }
109122
110123 // Common methods like create/delete etc., should be here
111- public void createVolume (String volumeName , Long size ) {
124+
125+ /**
126+ * Creates ONTAP Flex-Volume
127+ * Eligible only for Unified ONTAP storage
128+ * throw exception in case of disaggregated ONTAP storage
129+ *
130+ * @param volumeName
131+ * @param size
132+ */
133+ public Volume createStorageVolume (String volumeName , Long size ) {
112134 s_logger .info ("Creating volume: " + volumeName + " of size: " + size + " bytes" );
113135
114136 String svmName = storage .getSvmName ();
@@ -168,5 +190,138 @@ public void createVolume(String volumeName, Long size) {
168190 throw new CloudRuntimeException ("Failed to create volume: " + e .getMessage ());
169191 }
170192 s_logger .info ("Volume created successfully: " + volumeName );
193+ //TODO
194+ return null ;
195+ }
196+
197+ /**
198+ * Updates ONTAP Flex-Volume
199+ * Eligible only for Unified ONTAP storage
200+ * throw exception in case of disaggregated ONTAP storage
201+ *
202+ * @param values
203+ */
204+ public Volume updateStorageVolume (Volume volume )
205+ {
206+ //TODO
207+ return null ;
171208 }
209+
210+ /**
211+ * Delete ONTAP Flex-Volume
212+ * Eligible only for Unified ONTAP storage
213+ * throw exception in case of disaggregated ONTAP storage
214+ *
215+ * @param values
216+ */
217+ public void deleteStorageVolume (Volume volume )
218+ {
219+ //TODO
220+ }
221+
222+ /**
223+ * Updates ONTAP Flex-Volume
224+ * Eligible only for Unified ONTAP storage
225+ * throw exception in case of disaggregated ONTAP storage
226+ *
227+ * @param values
228+ */
229+ public Volume getStorageVolume (Volume volume )
230+ {
231+ //TODO
232+ return null ;
233+ }
234+
235+ /**
236+ * Method encapsulates the behavior based on the opted protocol in subclasses.
237+ * it is going to mimic
238+ * createLun for iSCSI, FC protocols
239+ * createFile for NFS3.0 and NFS4.1 protocols
240+ * createNameSpace for Nvme/TCP and Nvme/FC protocol
241+ * @param values
242+ */
243+ abstract public CloudStackVolume createCloudStackVolume (CloudStackVolume cloudstackVolume );
244+
245+ /**
246+ * Method encapsulates the behavior based on the opted protocol in subclasses.
247+ * it is going to mimic
248+ * updateLun for iSCSI, FC protocols
249+ * updateFile for NFS3.0 and NFS4.1 protocols
250+ * updateNameSpace for Nvme/TCP and Nvme/FC protocol
251+ * @param values
252+ */
253+ abstract CloudStackVolume updateCloudStackVolume (CloudStackVolume cloudstackVolume );
254+
255+ /**
256+ * Method encapsulates the behavior based on the opted protocol in subclasses.
257+ * it is going to mimic
258+ * deleteLun for iSCSI, FC protocols
259+ * deleteFile for NFS3.0 and NFS4.1 protocols
260+ * deleteNameSpace for Nvme/TCP and Nvme/FC protocol
261+ * @param values
262+ */
263+ abstract void deleteCloudStackVolume (CloudStackVolume cloudstackVolume );
264+
265+ /**
266+ * Method encapsulates the behavior based on the opted protocol in subclasses.
267+ * it is going to mimic
268+ * getLun for iSCSI, FC protocols
269+ * getFile for NFS3.0 and NFS4.1 protocols
270+ * getNameSpace for Nvme/TCP and Nvme/FC protocol
271+ * @param values
272+ */
273+ abstract CloudStackVolume getCloudStackVolume (CloudStackVolume cloudstackVolume );
274+
275+ /**
276+ * Method encapsulates the behavior based on the opted protocol in subclasses
277+ * createiGroup for iSCSI and FC protocols
278+ * createExportPolicy for NFS 3.0 and NFS 4.1 protocols
279+ * createSubsystem for Nvme/TCP and Nvme/FC protocols
280+ * @param values
281+ */
282+ abstract AccessGroup createAccessGroup (AccessGroup accessGroup );
283+
284+ /**
285+ * Method encapsulates the behavior based on the opted protocol in subclasses
286+ * deleteiGroup for iSCSI and FC protocols
287+ * deleteExportPolicy for NFS 3.0 and NFS 4.1 protocols
288+ * deleteSubsystem for Nvme/TCP and Nvme/FC protocols
289+ * @param values
290+ */
291+ abstract void deleteAccessGroup (AccessGroup accessGroup );
292+
293+ /**
294+ * Method encapsulates the behavior based on the opted protocol in subclasses
295+ * updateiGroup example add/remove-Iqn for iSCSI and FC protocols
296+ * updateExportPolicy example add/remove-Rule for NFS 3.0 and NFS 4.1 protocols
297+ * //TODO for Nvme/TCP and Nvme/FC protocols
298+ * @param values
299+ */
300+ abstract AccessGroup updateAccessGroup (AccessGroup accessGroup );
301+
302+ /**
303+ * Method encapsulates the behavior based on the opted protocol in subclasses
304+ * getiGroup for iSCSI and FC protocols
305+ * getExportPolicy for NFS 3.0 and NFS 4.1 protocols
306+ * getNameSpace for Nvme/TCP and Nvme/FC protocols
307+ * @param values
308+ */
309+ abstract AccessGroup getAccessGroup (AccessGroup accessGroup );
310+
311+ /**
312+ * Method encapsulates the behavior based on the opted protocol in subclasses
313+ * lunMap for iSCSI and FC protocols
314+ * //TODO for Nvme/TCP and Nvme/FC protocols
315+ * @param values
316+ */
317+ abstract void enableLogicalAccess (Map <String ,String > values );
318+
319+ /**
320+ * Method encapsulates the behavior based on the opted protocol in subclasses
321+ * lunUnmap for iSCSI and FC protocols
322+ * //TODO for Nvme/TCP and Nvme/FC protocols
323+ * @param values
324+ */
325+ abstract void disableLogicalAccess (Map <String ,String > values );
326+
172327}
0 commit comments