use of com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam in project coprhd-controller by CoprHD.
the class VirtualPoolMapper method toFileVirtualPool.
public static FileVirtualPoolRestRep toFileVirtualPool(VirtualPool from) {
if (from == null) {
return null;
}
FileVirtualPoolRestRep to = new FileVirtualPoolRestRep();
// Show the feature even if it's disabled
to.setProtection(new FileVirtualPoolProtectionParam());
to.getProtection().setSnapshots(new VirtualPoolProtectionSnapshotsParam());
to.getProtection().getSnapshots().setMaxSnapshots(from.getMaxNativeSnapshots());
to.getProtection().setReplicationSupported(from.getFileReplicationSupported());
to.getProtection().setAllowFilePolicyAtProjectLevel(from.getAllowFilePolicyAtProjectLevel());
to.getProtection().setAllowFilePolicyAtFSLevel(from.getAllowFilePolicyAtFSLevel());
if (from.getFrRpoType() != null) {
to.getProtection().setMinRpoType(from.getFrRpoType());
}
if (from.getFrRpoValue() != null) {
to.getProtection().setMinRpoValue(from.getFrRpoValue());
}
to.getProtection().setScheduleSnapshots(from.getScheduleSnapshots());
to.setLongTermRetention(from.getLongTermRetention());
if (from.getFilePolicies() != null && !from.getFilePolicies().isEmpty()) {
to.setFileProtectionPolicies(from.getFilePolicies());
}
return mapVirtualPoolFields(from, to, null);
}
use of com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method getFileVirtualPoolsOptions.
private static List<StringOption> getFileVirtualPoolsOptions(FilePolicyRestRep policy) {
Collection<FileVirtualPoolRestRep> virtualPools;
virtualPools = getViprClient().fileVpools().getAll();
Collection<FileVirtualPoolRestRep> vPools = Lists.newArrayList();
for (FileVirtualPoolRestRep vpool : virtualPools) {
// first level filter based on the protection is enabled or not
FileVirtualPoolProtectionParam protectParam = vpool.getProtection();
if (protectParam == null) {
continue;
}
// 2nde level filter based on the applied level of policy and the pool
if (FilePolicyApplyLevel.project.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtProjectLevel()) {
continue;
}
if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtFSLevel()) {
continue;
}
// now add pool into list if matches protection type with policy
if (FilePolicyType.file_snapshot.name().equalsIgnoreCase(policy.getType()) && protectParam.getScheduleSnapshots()) {
vPools.add(vpool);
} else if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getType()) && protectParam.getReplicationSupported()) {
vPools.add(vpool);
}
}
return createResourceOptions(vPools);
}
use of com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam in project coprhd-controller by CoprHD.
the class FileVirtualPoolForm method doLoad.
protected void doLoad(FileVirtualPoolRestRep virtualPool) {
loadCommon(virtualPool);
FileVirtualPoolProtectionParam protection = virtualPool.getProtection();
if ((protection != null) && (protection.getSnapshots() != null)) {
maxSnapshots = protection.getSnapshots().getMaxSnapshots();
}
if (protection != null) {
scheduleSnapshots = protection.getScheduleSnapshots();
replicationSupported = protection.getReplicationSupported();
allowPolicyApplyAtProject = protection.getAllowFilePolicyAtProjectLevel();
allowPolicyApplyAtFS = protection.getAllowFilePolicyAtFSLevel();
rpRpoType = protection.getMinRpoType();
replicationRpo = protection.getMinRpoValue();
}
longTermRetention = virtualPool.getLongTermRetention();
}
use of com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam in project coprhd-controller by CoprHD.
the class FileVirtualPoolService method prepareVirtualPool.
// this method must not persist anything to the DB.
private VirtualPool prepareVirtualPool(FileVirtualPoolParam param, boolean validateReplArgs) {
VirtualPool vPool = new VirtualPool();
vPool.setType(VirtualPool.Type.file.name());
// set common VirtualPool parameters.
populateCommonVirtualPoolCreateParams(vPool, param);
StringSetMap arrayInfo = new StringSetMap();
if (null != param.getSystemType()) {
if (!VirtualPool.SystemType.NONE.toString().equals(param.getSystemType()) && !VirtualPool.SystemType.isFileTypeSystem(param.getSystemType())) {
throw APIException.badRequests.invalidParameter("system_type", param.getSystemType());
}
arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, param.getSystemType());
vPool.addArrayInfoDetails(arrayInfo);
}
vPool.setMaxNativeSnapshots(VirtualPool.MAX_DISABLED);
if (null != param.getProtection()) {
FileVirtualPoolProtectionParam protectionParam = param.getProtection();
if ((protectionParam.getSnapshots() != null) && (protectionParam.getSnapshots().getMaxSnapshots() != null)) {
vPool.setMaxNativeSnapshots(protectionParam.getSnapshots().getMaxSnapshots());
}
vPool.setScheduleSnapshots(false);
if (protectionParam.getScheduleSnapshots() != null) {
vPool.setScheduleSnapshots(protectionParam.getScheduleSnapshots());
}
vPool.setFileReplicationSupported(false);
if (protectionParam.getReplicationSupported() != null) {
vPool.setFileReplicationSupported(protectionParam.getReplicationSupported());
}
vPool.setAllowFilePolicyAtProjectLevel(false);
if (protectionParam.getAllowFilePolicyAtProjectLevel() != null) {
vPool.setAllowFilePolicyAtProjectLevel(protectionParam.getAllowFilePolicyAtProjectLevel());
}
vPool.setAllowFilePolicyAtFSLevel(false);
if (protectionParam.getAllowFilePolicyAtFSLevel() != null) {
vPool.setAllowFilePolicyAtFSLevel(protectionParam.getAllowFilePolicyAtFSLevel());
}
}
if (null != param.getLongTermRetention()) {
vPool.setLongTermRetention(param.getLongTermRetention());
}
return vPool;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method getVpoolForProtectionPolicy.
/**
* This call return the pool or pools which can be associated with policy.
* Currently this does not check vpool is assigned to another policy.
* As we do not have direct reference of policy in file vpool and looping all
* policy and then its assigned resource to figure out it is assign or not
* is causing slowness in GUI.Will address this in future release
*
* @param id
*/
public static void getVpoolForProtectionPolicy(String id) {
Collection<FileVirtualPoolRestRep> vPools = Lists.newArrayList();
FilePolicyRestRep policy = getViprClient().fileProtectionPolicies().get(uri(id));
if (policy.getAssignedResources() != null && !policy.getAssignedResources().isEmpty()) {
NamedRelatedResourceRep vpoolNameRes = null;
// get the first vpool and return it.
if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.vpool.name())) {
vpoolNameRes = policy.getAssignedResources().get(0);
} else if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.project.name())) {
vpoolNameRes = policy.getVpool();
}
if (vpoolNameRes != null) {
FileVirtualPoolRestRep vpolRestep = getViprClient().fileVpools().get(vpoolNameRes.getId());
vPools.add(vpolRestep);
renderJSON(vPools);
return;
}
}
List<FileVirtualPoolRestRep> virtualPools = getViprClient().fileVpools().getAll();
for (FileVirtualPoolRestRep vpool : virtualPools) {
// first level filter based on the protection is enabled or not
FileVirtualPoolProtectionParam protectParam = vpool.getProtection();
if (protectParam == null) {
continue;
}
// 2nde level filter based on the applied level of policy and the pool
if (FilePolicyApplyLevel.project.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtProjectLevel()) {
continue;
}
if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtFSLevel()) {
continue;
}
// now add pool into list if matches protection type with policy
if (FilePolicyType.file_snapshot.name().equalsIgnoreCase(policy.getType()) && protectParam.getScheduleSnapshots()) {
vPools.add(vpool);
} else if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getType()) && protectParam.getReplicationSupported()) {
vPools.add(vpool);
}
}
renderJSON(vPools);
}
Aggregations