forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
CSTACKEX-34: Upgrade to framework classes design #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
973f5e2
CSTACKEX-34: Upgrade to framework classes design
rajiv-jain-netapp 686a892
CSTACKEX-34: incorporating the review comments
rajiv-jain-netapp edfcdde
CSTACKEX-34: transient changes to the review comments
rajiv-jain-netapp 73eb9f5
CSTACKEX-34: Unable to get checkstyle pass hence fixing this as well
rajiv-jain-netapp 465fffe
CSTACKEX-34: further review comments incorporations
rajiv-jain-netapp 3d6bd91
CSTACKEX-34: addressing checkstyle issues
rajiv-jain-netapp 5815ebd
CSTACKEX-34: fix checksyle issues
rajiv-jain-netapp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,8 @@ | |
| import org.apache.cloudstack.storage.feign.model.Volume; | ||
| import org.apache.cloudstack.storage.feign.model.response.JobResponse; | ||
| import org.apache.cloudstack.storage.feign.model.response.OntapResponse; | ||
| import org.apache.cloudstack.storage.service.model.AccessGroup; | ||
| import org.apache.cloudstack.storage.service.model.CloudStackVolume; | ||
| import org.apache.cloudstack.storage.utils.Constants; | ||
| import org.apache.cloudstack.storage.utils.Utility; | ||
| import org.apache.logging.log4j.LogManager; | ||
|
|
@@ -42,6 +44,13 @@ | |
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Storage Strategy represents the communication path for all the ONTAP storage options | ||
| * | ||
| * ONTAP storage operation would vary based on | ||
| * Supported protocols: NFS3.0, NFS4.1, FC, iSCSI, Nvme/TCP and Nvme/FC | ||
| * Supported platform: Unified and Disaggregated | ||
| */ | ||
| public abstract class StorageStrategy { | ||
| @Inject | ||
| private Utility utils; | ||
|
|
@@ -57,12 +66,24 @@ public abstract class StorageStrategy { | |
|
|
||
| private final OntapStorage storage; | ||
|
|
||
| /** | ||
| * Presents aggregate object for the unified storage, not eligible for disaggregated | ||
| */ | ||
| private List<Aggregate> aggregates; | ||
|
|
||
| private static final Logger s_logger = (Logger) LogManager.getLogger(StorageStrategy.class); | ||
|
|
||
| protected enum PROTOCOLS | ||
| { NFS30, | ||
| NFS41, | ||
| FC, | ||
| iSCSI, | ||
| NvmeTCP, | ||
| NvmeFC }; | ||
|
|
||
| public StorageStrategy(OntapStorage ontapStorage) { | ||
| storage = ontapStorage; | ||
|
|
||
| } | ||
|
|
||
| // Connect method to validate ONTAP cluster, credentials, protocol, and SVM | ||
|
|
@@ -108,7 +129,16 @@ public boolean connect() { | |
| } | ||
|
|
||
| // Common methods like create/delete etc., should be here | ||
| public void createVolume(String volumeName, Long size) { | ||
|
|
||
| /** | ||
| * Creates ONTAP Flex-Volume | ||
| * Eligible only for Unified ONTAP storage | ||
| * throw exception in case of disaggregated ONTAP storage | ||
| * | ||
| * @param volumeName | ||
| * @param size | ||
| */ | ||
| public Volume createStorageVolume(String volumeName, Long size) { | ||
| s_logger.info("Creating volume: " + volumeName + " of size: " + size + " bytes"); | ||
|
|
||
| String svmName = storage.getSvmName(); | ||
|
|
@@ -168,5 +198,138 @@ public void createVolume(String volumeName, Long size) { | |
| throw new CloudRuntimeException("Failed to create volume: " + e.getMessage()); | ||
| } | ||
| s_logger.info("Volume created successfully: " + volumeName); | ||
| //TODO | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Updates ONTAP Flex-Volume | ||
| * Eligible only for Unified ONTAP storage | ||
| * throw exception in case of disaggregated ONTAP storage | ||
| * | ||
| * @param values | ||
| */ | ||
| public Volume updateStorageVolume(Map<String,String> values) | ||
| { | ||
| //TODO | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Delete ONTAP Flex-Volume | ||
| * Eligible only for Unified ONTAP storage | ||
| * throw exception in case of disaggregated ONTAP storage | ||
| * | ||
| * @param values | ||
| */ | ||
| public void deleteStorageVolume(Map<String,String> values) | ||
| { | ||
| //TODO | ||
| } | ||
|
|
||
| /** | ||
| * Updates ONTAP Flex-Volume | ||
| * Eligible only for Unified ONTAP storage | ||
| * throw exception in case of disaggregated ONTAP storage | ||
| * | ||
| * @param values | ||
| */ | ||
| public Volume getStorageVolume(Map<String,String> values) | ||
| { | ||
| //TODO | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses. | ||
| * it is going to mimic | ||
| * createLun for iSCSI, FC protocols | ||
| * createFile for NFS3.0 and NFS4.1 protocols | ||
| * createNameSpace for Nvme/TCP and Nvme/FC protocol | ||
| * @param values | ||
| */ | ||
| abstract public CloudStackVolume createCloudStackVolume(Map<String,String> values); | ||
|
||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses. | ||
| * it is going to mimic | ||
| * updateLun for iSCSI, FC protocols | ||
| * updateFile for NFS3.0 and NFS4.1 protocols | ||
| * updateNameSpace for Nvme/TCP and Nvme/FC protocol | ||
| * @param values | ||
| */ | ||
| abstract CloudStackVolume updateCloudStackVolume(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses. | ||
| * it is going to mimic | ||
| * deleteLun for iSCSI, FC protocols | ||
| * deleteFile for NFS3.0 and NFS4.1 protocols | ||
| * deleteNameSpace for Nvme/TCP and Nvme/FC protocol | ||
| * @param values | ||
| */ | ||
| abstract void deleteCloudStackVolume(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses. | ||
| * it is going to mimic | ||
| * getLun for iSCSI, FC protocols | ||
| * getFile for NFS3.0 and NFS4.1 protocols | ||
| * getNameSpace for Nvme/TCP and Nvme/FC protocol | ||
| * @param values | ||
| */ | ||
| abstract CloudStackVolume getCloudStackVolume(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * createiGroup for iSCSI and FC protocols | ||
| * createExportPolicy for NFS 3.0 and NFS 4.1 protocols | ||
| * createSubsystem for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract AccessGroup createAccessGroup(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * deleteiGroup for iSCSI and FC protocols | ||
| * deleteExportPolicy for NFS 3.0 and NFS 4.1 protocols | ||
| * deleteSubsystem for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract void deleteAccessGroup(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * updateiGroup example add/remove-Iqn for iSCSI and FC protocols | ||
| * updateExportPolicy example add/remove-Rule for NFS 3.0 and NFS 4.1 protocols | ||
| * //TODO for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract AccessGroup updateAccessGroup(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * getiGroup for iSCSI and FC protocols | ||
| * getExportPolicy for NFS 3.0 and NFS 4.1 protocols | ||
| * getNameSpace for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract AccessGroup getAccessGroup(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * lunMap for iSCSI and FC protocols | ||
| * //TODO for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract void enableLogicalAccess(Map<String,String> values); | ||
|
|
||
| /** | ||
| * Method encapsulates the behavior based on the opted protocol in subclasses | ||
| * lunUnmap for iSCSI and FC protocols | ||
| * //TODO for Nvme/TCP and Nvme/FC protocols | ||
| * @param values | ||
| */ | ||
| abstract void disableLogicalAccess(Map<String,String> values); | ||
|
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OntapStorage also has protocol, we can remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took care