use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemSnapshotPolicies.
@FlashException(referrer = { "fileSystem" })
public static void fileSystemSnapshotPolicies(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<FilePolicyRestRep> filePolicies = Lists.newArrayList();
FileShareRestRep fs = client.fileSystems().get(uri(fileSystemId));
if (fs != null) {
// Get file system snapshot policies!!
if (fs.getFilePolicies() != null && !fs.getFilePolicies().isEmpty()) {
for (String uriPolicy : fs.getFilePolicies()) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
if (policyRestRep != null) {
filePolicies.add(policyRestRep);
}
}
}
}
render(filePolicies);
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSystems method listNfsAcl.
public static void listNfsAcl(String fileSystemId, String fsMountPath, String subDir) {
renderArgs.put("dataTable", new NfsACLDataTable());
renderArgs.put("subDir", subDir);
renderArgs.put("fileSystemId", uri(fileSystemId));
renderArgs.put("fsMountPath", fsMountPath);
renderArgs.put("fileSystemSubDirAndPath", fileSystemId + "~~~" + subDir + "~~~" + fsMountPath);
renderArgs.put("permissionOptions", StringOption.options(new String[] { "read", "write", "execute", "fullControl" }));
ViPRCoreClient client = BourneUtil.getViprClient();
NfsACLForm nfsACL = new NfsACLForm();
FileShareRestRep restRep = client.fileSystems().get(uri(fileSystemId));
renderArgs.put("fileSystemName", restRep.getName());
render(nfsACL);
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemMirrors.
public static void fileSystemMirrors(String fileSystemId) {
URI id = uri(fileSystemId);
ViPRCoreClient client = BourneUtil.getViprClient();
FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
}
String personality = targetFileSystems.getPersonality();
// The code will be refactored once 1:n or cascaded FS replication is supported
if (!fileMirrors.isEmpty()) {
FileShareRestRep fsRestRep = fileMirrors.get(0);
fsRestRep.getProtection().setMirrorStatus(targetFileSystems.getMirrorStatus());
}
// Verify the replication is at fs level or not
boolean replicationAtFs = false;
FileShareRestRep fs = client.fileSystems().get(id);
if (fs != null) {
FilePolicyRestRep replicationPolicy = getReplicationPolicy(client, fs);
if (replicationPolicy != null) {
if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(replicationPolicy.getAppliedAt())) {
replicationAtFs = true;
}
renderArgs.put("replicationPolicy", replicationPolicy);
}
renderArgs.put("replicationAtFsLevel", replicationAtFs);
}
renderArgs.put("personality", personality);
renderArgs.put("fileMirrors", fileMirrors);
renderArgs.put("fileSystemId", fileSystemId);
render();
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileWithContinuousCopies.
@Asset("fileWithContinuousCopies")
@AssetDependencies("project")
public List<AssetOption> getFileWithContinuousCopies(AssetOptionsContext ctx, URI project) {
final ViPRCoreClient client = api(ctx);
List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project, new SourceTargetFileSystemsFilter() {
@Override
public boolean acceptId(URI id) {
return !client.fileSystems().getFileContinuousCopies(id).isEmpty();
}
});
return createFilesystemOptions(fileShares);
}
use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFilesystemsForAssociation.
@Asset("fileFilesystemAssociation")
@AssetDependencies("project")
public List<AssetOption> getFilesystemsForAssociation(AssetOptionsContext ctx, URI project) {
ViPRCoreClient client = api(ctx);
List<FileShareRestRep> fileSharesforAssociation = Lists.newArrayList();
Map<URI, Boolean> uriToBool = Maps.newHashMap();
List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project);
for (FileShareRestRep fileShare : fileShares) {
URI vpoolId = fileShare.getVirtualPool().getId();
if (!uriToBool.containsKey(vpoolId)) {
FileVirtualPoolRestRep vpool = client.fileVpools().get(vpoolId);
uriToBool.put(vpoolId, (vpool.getProtection() != null && vpool.getProtection().getAllowFilePolicyAtFSLevel() && (vpool.getProtection().getReplicationSupported() || vpool.getProtection().getScheduleSnapshots())));
}
if (uriToBool.get(vpoolId)) {
fileSharesforAssociation.add(fileShare);
}
}
return createFilesystemOptions(fileSharesforAssociation);
}
Aggregations