Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.net.URI;
import java.util.Map;

@FeignClient(name = "SvmClient", url = "https://{clusterIP}/api/svm/svms", configuration = FeignConfiguration.class)
public interface SvmFeignClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,67 +22,67 @@
import org.apache.cloudstack.storage.utils.Constants.ProtocolType;

public class OntapStorage {
public static String _username;
public static String _password;
public static String _managementLIF;
public static String _svmName;
public static ProtocolType _protocolType;
public static Boolean _isDisaggregated;
private String username;
private String password;
private String managementLIF;
private String svmName;
private ProtocolType protocolType;
private Boolean isDisaggregated;

public OntapStorage(String username, String password, String managementLIF, String svmName, ProtocolType protocolType, Boolean isDisaggregated) {
_username = username;
_password = password;
_managementLIF = managementLIF;
_svmName = svmName;
_protocolType = protocolType;
_isDisaggregated = isDisaggregated;
this.username = username;
this.password = password;
this.managementLIF = managementLIF;
this.svmName = svmName;
this.protocolType = protocolType;
this.isDisaggregated = isDisaggregated;
}

public String getUsername() {
return _username;
return username;
}

public void setUsername(String username) {
_username = username;
username = username;
}

public String getPassword() {
return _password;
return password;
}

public void setPassword(String password) {
_password = password;
password = password;
}

public String getManagementLIF() {
return _managementLIF;
return managementLIF;
}

public void setManagementLIF(String managementLIF) {
_managementLIF = managementLIF;
managementLIF = managementLIF;
}

public String getSvmName() {
return _svmName;
return svmName;
}

public void setSvmName(String svmName) {
_svmName = svmName;
svmName = svmName;
}

public ProtocolType getProtocol() {
return _protocolType;
return protocolType;
}

public void setProtocol(ProtocolType protocolType) {
_protocolType = protocolType;
protocolType = protocolType;
}

public Boolean getIsDisaggregated() {
return _isDisaggregated;
return isDisaggregated;
}

public void setIsDisaggregated(Boolean isDisaggregated) {
_isDisaggregated = isDisaggregated;
isDisaggregated = isDisaggregated;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public DataStore initialize(Map<String, Object> dsInfos) {
boolean isValid = storageStrategy.connect();
if (isValid) {
// String volumeName = storagePoolName + "_vol"; //TODO: Figure out a better naming convention
storageStrategy.createVolume(storagePoolName, Long.parseLong((details.get("size")))); // TODO: size should be in bytes, so see if conversion is needed
storageStrategy.createStorageVolume(storagePoolName, Long.parseLong((details.get("size")))); // TODO: size should be in bytes, so see if conversion is needed
} else {
throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.cloudstack.storage.service.StorageStrategy;
import org.apache.cloudstack.storage.service.UnifiedNASStrategy;
import org.apache.cloudstack.storage.service.UnifiedSANStrategy;
import org.apache.cloudstack.storage.utils.Constants;
import org.apache.cloudstack.storage.utils.Constants.ProtocolType;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@ public NASStrategy(OntapStorage ontapStorage) {
super(ontapStorage);
}

public abstract String createExportPolicy(String svmName, String policyName);
public abstract String addExportRule(String policyName, String clientMatch, String[] protocols, String[] roRule, String[] rwRule);
public abstract String assignExportPolicyToVolume(String volumeUuid, String policyName);
public abstract String enableNFS(String svmUuid);
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ public SANStrategy(OntapStorage ontapStorage) {
super(ontapStorage);
}

public abstract String createLUN(String svmName, String volumeName, String lunName, long sizeBytes, String osType);
public abstract String createIgroup(String svmName, String igroupName, String[] initiators);
public abstract String mapLUNToIgroup(String lunName, String igroupName);
public abstract String enableISCSI(String svmUuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took care

{ NFS30,
NFS41,
FC,
iSCSI,
NvmeTCP,
NvmeFC };

public StorageStrategy(OntapStorage ontapStorage) {
storage = ontapStorage;

}

// Connect method to validate ONTAP cluster, credentials, protocol, and SVM
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per discussion, we should pass those new models as a param also instead of map in required methods

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took care


/**
* 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);

}
Loading
Loading