Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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;
public static String username;
public static String password;
public static String managementLIF;
public static String svmName;
public static ProtocolType protocolType;
public static 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;
username = username;
password = password;
managementLIF = managementLIF;
svmName = svmName;
protocolType = protocolType;
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 @@ -42,6 +42,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,10 +64,21 @@ 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;
}
Expand Down Expand Up @@ -108,7 +126,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 void createStorageVolume(String volumeName, Long size) {
s_logger.info("Creating volume: " + volumeName + " of size: " + size + " bytes");

String svmName = storage.getSvmName();
Expand Down Expand Up @@ -169,4 +196,133 @@ public void createVolume(String volumeName, Long size) {
}
s_logger.info("Volume created successfully: " + volumeName);
}

/**
* Updates ONTAP Flex-Volume
* Eligible only for Unified ONTAP storage
* throw exception in case of disaggregated ONTAP storage
*
* @param values
*/
public void updateStorageVolume(Map<String,String> values)

Choose a reason for hiding this comment

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

We can have model where we have nested hierarchy of the file and volume model combined instead of map. This will help us know what fields are required for what operation from readability perspective.

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

{
//TODO
}

/**
* 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 void getStorageVolume(Map<String,String> values)
{
//TODO
}

/**
* 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 void 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 void 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 void 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 void enableAccess(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 disableAccess(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 void updateAccess(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 void getAccess(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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,61 @@

import org.apache.cloudstack.storage.feign.model.OntapStorage;

import java.util.Map;

public class UnifiedNASStrategy extends NASStrategy{
public UnifiedNASStrategy(OntapStorage ontapStorage) {
super(ontapStorage);
}

@Override
public String createExportPolicy(String svmName, String policyName) {
return "";
public void createCloudStackVolume(Map<String, String> values) {

}

@Override
void updateCloudStackVolume(Map<String, String> values) {

}

@Override
void deleteCloudStackVolume(Map<String, String> values) {

}

@Override
void getCloudStackVolume(Map<String, String> values) {

}

@Override
void enableAccess(Map<String, String> values) {

}

@Override
public String addExportRule(String policyName, String clientMatch, String[] protocols, String[] roRule, String[] rwRule) {
return "";
void disableAccess(Map<String, String> values) {

}

@Override
public String assignExportPolicyToVolume(String volumeUuid, String policyName) {
return "";
void updateAccess(Map<String, String> values) {

}

@Override
public String enableNFS(String svmUuid) {
return "";
void getAccess(Map<String, String> values) {

}

@Override
void enableLogicalAccess(Map<String, String> values) {

}

@Override
void disableLogicalAccess(Map<String, String> values) {

}

}
Loading
Loading