use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileVirtualPoolForm method save.
@Override
public FileVirtualPoolRestRep save() {
FileVirtualPoolRestRep virtualPool = doSave();
FileVirtualPools vpools = getViprClient().fileVpools();
saveQuota(vpools);
saveTenantACLs(vpools);
return virtualPool;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileSystems method getReplicationPolicy.
private static FilePolicyRestRep getReplicationPolicy(ViPRCoreClient client, FileShareRestRep fs) {
if (fs != null) {
// Check file system vpool has replication policy!!!
FileVirtualPoolRestRep vpool = client.fileVpools().get(fs.getVirtualPool().getId());
if (vpool != null && vpool.getFileProtectionPolicies() != null && !vpool.getFileProtectionPolicies().isEmpty()) {
for (String uriPolicy : vpool.getFileProtectionPolicies()) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
if (policyRestRep != null && "file_replication".equalsIgnoreCase(policyRestRep.getType())) {
return policyRestRep;
}
}
}
// Check file system project has replication policy!!!
ProjectRestRep project = client.projects().get(fs.getProject().getId());
if (project != null && project.getFileProtectionPolicies() != null && !project.getFileProtectionPolicies().isEmpty()) {
for (String uriPolicy : project.getFileProtectionPolicies()) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
if (policyRestRep != null && "file_replication".equalsIgnoreCase(policyRestRep.getType()) && policyRestRep.getVpool() != null && policyRestRep.getVpool().getId() != null && policyRestRep.getVpool().getId().equals(vpool.getId())) {
return policyRestRep;
}
}
}
// Check file system has replication policy!!!
if (fs.getFilePolicies() != null && !fs.getFilePolicies().isEmpty()) {
for (String uriPolicy : fs.getFilePolicies()) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
if (policyRestRep != null && "file_replication".equalsIgnoreCase(policyRestRep.getType())) {
return policyRestRep;
}
}
}
}
return null;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method getVarraysAssociatedWithPools.
public static void getVarraysAssociatedWithPools(String id) {
List<VirtualArrayRestRep> varrayList = Lists.newArrayList();
Set<String> varraySet = Sets.newHashSet();
FileVirtualPoolRestRep vpool = getViprClient().fileVpools().get(uri(id));
List<RelatedResourceRep> varrays = vpool.getVirtualArrays();
for (RelatedResourceRep varray : varrays) {
varraySet.add(varray.getId().toString());
}
for (String varrayId : varraySet) {
VirtualArrayRestRep varray = getViprClient().varrays().get(uri(varrayId));
varrayList.add(varray);
}
renderJSON(varrayList);
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep 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.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileTargetVirtualPools.
@Asset("fileTargetVirtualPool")
@AssetDependencies({ "fileFilePolicy" })
public List<AssetOption> getFileTargetVirtualPools(AssetOptionsContext ctx, URI filePolicy) {
List<AssetOption> options = Lists.newArrayList();
ViPRCoreClient client = api(ctx);
FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
List<FileVirtualPoolRestRep> vpoolChanges = client.fileVpools().getByTenant(ctx.getTenant());
for (FileVirtualPoolRestRep vpool : vpoolChanges) {
if (vpool.getProtection() != null) {
if ((policyRest.getType().equals("file_snapshot") && vpool.getProtection().getScheduleSnapshots()) || (policyRest.getType().equals("file_replication") && vpool.getProtection().getReplicationSupported())) {
options.add(new AssetOption(vpool.getId(), vpool.getName()));
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations