use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterProvider method getUnmanagedFileSystemVirtualPools.
@Asset("unmanagedFileVirtualPool")
@AssetDependencies({ "fileStorageSystem", "virtualArray", "fileIngestExportType" })
public List<AssetOption> getUnmanagedFileSystemVirtualPools(AssetOptionsContext ctx, URI storageSystem, URI virtualArray, String ingestExportType) {
Map<URI, Integer> vpools = getFileVirtualPools(listUnmanagedFilesystems(ctx, storageSystem), ingestExportType);
Map<URI, FileVirtualPoolRestRep> virtualPoolMap = FileProvider.getFileVirtualPools(api(ctx), vpools.keySet());
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
FileVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
if (isVirtualPoolInVirtualArray(vpool, virtualArray)) {
options.add(newAssetOption(vpool.getId().toString(), "file.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterProvider method getUnmanagedFileVirtualPools.
@Asset("unmanagedFileVirtualPool")
@AssetDependencies({ "fileStorageSystem" })
public List<AssetOption> getUnmanagedFileVirtualPools(AssetOptionsContext ctx, URI storageSystem) {
Map<URI, Integer> vpools = getFileVirtualPools(listUnmanagedFilesystems(ctx, storageSystem));
Map<URI, FileVirtualPoolRestRep> virtualPoolMap = FileProvider.getFileVirtualPools(api(ctx), vpools.keySet());
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
FileVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
if (vpool != null) {
options.add(newAssetOption(vpool.getId().toString(), "file.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileVirtualPoolService method getFileVirtualPool.
/**
* Get info for File Store VirtualPool
*
* @param id the URN of a ViPR VirtualPool
* @brief Show file store VirtualPool
* @return VirtualPool details
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR }, acls = { ACL.USE })
public FileVirtualPoolRestRep getFileVirtualPool(@PathParam("id") URI id) {
VirtualPool vpool = getVirtualPool(VirtualPool.Type.file, id);
FileVirtualPoolRestRep restRep = toFileVirtualPool(vpool);
restRep.setNumResources(getNumResources(vpool, _dbClient));
return restRep;
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep 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);
}
use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class FileSystems method fileSystem.
public static void fileSystem(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileShareRestRep fileSystem = null;
try {
fileSystem = client.fileSystems().get(uri(fileSystemId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
flash.error(MessagesUtils.get(UNKNOWN, fileSystemId));
fileSystems(null);
}
throw e;
}
if (fileSystem != null) {
if (fileSystem.getVirtualArray() != null) {
VirtualArrayRestRep virtualArray = client.varrays().get(fileSystem.getVirtualArray());
renderArgs.put("virtualArray", virtualArray);
}
if (fileSystem.getVirtualPool() != null) {
FileVirtualPoolRestRep virtualPool = client.fileVpools().get(fileSystem.getVirtualPool());
renderArgs.put("virtualPool", virtualPool);
}
if (Security.isSystemAdminOrRestrictedSystemAdmin()) {
if (fileSystem.getStorageSystem() != null) {
StorageSystemRestRep storageSystem = client.storageSystems().get(fileSystem.getStorageSystem());
renderArgs.put("storageSystem", storageSystem);
}
if (fileSystem.getPool() != null) {
StoragePoolRestRep storagePool = client.storagePools().get(fileSystem.getPool());
renderArgs.put("storagePool", storagePool);
}
if (fileSystem.getStoragePort() != null) {
StoragePortRestRep storagePort = client.storagePorts().get(fileSystem.getStoragePort());
renderArgs.put("storagePort", storagePort);
}
}
Tasks<FileShareRestRep> tasksResponse = client.fileSystems().getTasks(fileSystem.getId());
List<Task<FileShareRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
} else {
notFound(MessagesUtils.get("resources.filesystems.notfound"));
}
renderArgs.put("permissionTypeOptions", PERMISSION_TYPES);
render(fileSystem);
}
Aggregations