use of com.emc.sa.asset.annotation.AssetDependencies 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.sa.asset.annotation.AssetDependencies 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;
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class FileProvider method getFileSnapshotShares.
@Asset("fileSnapshotShares")
@AssetDependencies("fileSnapshot")
public List<AssetOption> getFileSnapshotShares(AssetOptionsContext ctx, URI fileSnapshot) {
List<AssetOption> options = Lists.newArrayList();
for (SmbShareResponse share : api(ctx).fileSnapshots().getShares(fileSnapshot)) {
String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
options.add(new AssetOption(share.getShareName(), label));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.sa.asset.annotation.AssetDependencies 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);
}
use of com.emc.sa.asset.annotation.AssetDependencies in project coprhd-controller by CoprHD.
the class FileProvider method getNFSMountsForHost.
@Asset("mountedNFSExport")
@AssetDependencies("linuxFileHost")
public List<AssetOption> getNFSMountsForHost(AssetOptionsContext ctx, URI host) {
List<AssetOption> options = Lists.newArrayList();
List<MountInfo> hostMounts = api(ctx).fileSystems().getNfsMountsByHost(host);
for (MountInfo mountInfo : hostMounts) {
String mountString = mountInfo.getMountString();
options.add(new AssetOption(mountString, getDisplayMount(ctx, mountInfo)));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations