use of com.emc.storageos.model.varray.VirtualArrayRestRep 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);
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getFailoverTarget.
@Asset("failoverTarget")
@AssetDependencies("protectedBlockVolume")
public List<AssetOption> getFailoverTarget(AssetOptionsContext ctx, URI protectedBlockVolume) {
if (protectedBlockVolume != null) {
ViPRCoreClient client = api(ctx);
if (BlockProviderUtils.isType(protectedBlockVolume, VOLUME_TYPE)) {
debug("getting failoverTargets (protectedBlockVolume=%s)", protectedBlockVolume);
VolumeRestRep volume = client.blockVolumes().get(protectedBlockVolume);
ProtectionRestRep protection = volume.getProtection();
if (protection != null) {
// RecoverPoint protection
if (protection.getRpRep() != null && protection.getRpRep().getProtectionSet() != null) {
return getRpFailoverTargets(client, volume);
}
// VMAX SRDF protection
if (protection.getSrdfRep() != null && protection.getSrdfRep().getSRDFTargetVolumes() != null && !protection.getSrdfRep().getSRDFTargetVolumes().isEmpty()) {
return getSrdfFailoverTargets(client, volume);
}
}
} else if (BlockProviderUtils.isType(protectedBlockVolume, BLOCK_CONSISTENCY_GROUP_TYPE)) {
debug("getting failoverTargets for consistency group %s", protectedBlockVolume);
BlockConsistencyGroupRestRep cg = client.blockConsistencyGroups().get(protectedBlockVolume);
List<VolumeRestRep> srcVolumes = null;
// Get RP source volumes
if (cg.getTypes().contains(BlockConsistencyGroup.Types.RP.name())) {
srcVolumes = client.blockVolumes().getByRefs(cg.getVolumes(), RecoverPointPersonalityFilter.SOURCE);
}
// Get SRDF source volumes
if (cg.getTypes().contains(BlockConsistencyGroup.Types.SRDF.name())) {
srcVolumes = client.blockVolumes().getByRefs(cg.getVolumes(), new SRDFSourceFilter());
}
if (srcVolumes != null && !srcVolumes.isEmpty()) {
// Get the first source volume and obtain its target references
VolumeRestRep srcVolume = srcVolumes.get(0);
if (cg.getTypes() != null) {
Map<String, String> targetVolumes = Maps.newLinkedHashMap();
CachedResources<VirtualArrayRestRep> virtualArrays = new CachedResources<VirtualArrayRestRep>(client.varrays());
List<VirtualArrayRelatedResourceRep> targets = new ArrayList<VirtualArrayRelatedResourceRep>();
// Process the RP targets
if (cg.getTypes().contains(BlockConsistencyGroup.Types.RP.name())) {
targets = srcVolume.getProtection().getRpRep().getRpTargets();
}
// Process the SRDF targets
if (cg.getTypes().contains(BlockConsistencyGroup.Types.SRDF.name())) {
targets = srcVolume.getProtection().getSrdfRep().getSRDFTargetVolumes();
}
for (VolumeRestRep targetVolume : client.blockVolumes().getByRefs(targets)) {
VirtualArrayRestRep virtualArray = virtualArrays.get(targetVolume.getVirtualArray());
String label = getMessage(name(virtualArray));
targetVolumes.put(stringId(virtualArray), label);
}
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<String, String> entry : targetVolumes.entrySet()) {
options.add(new AssetOption(entry.getKey(), entry.getValue()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
}
}
}
return Lists.newArrayList();
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method createExportWithVarrayOptions.
protected static List<AssetOption> createExportWithVarrayOptions(ViPRCoreClient client, Collection<? extends ExportGroupRestRep> exportObjects) {
List<URI> varrayIds = getExportVirtualArrayIds(exportObjects);
Map<URI, VirtualArrayRestRep> varrayNames = getVirutalArrayNames(client, varrayIds);
List<AssetOption> options = Lists.newArrayList();
for (ExportGroupRestRep export : exportObjects) {
options.add(createExportWithVarrayOption(export, varrayNames));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getTargetVplexVolumeVirtualArrays.
@Asset("targetVirtualArray")
@AssetDependencies("project")
public List<AssetOption> getTargetVplexVolumeVirtualArrays(AssetOptionsContext ctx, URI projectId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> targets = Lists.newArrayList();
for (VirtualArrayRestRep varray : client.varrays().getByTenant(ctx.getTenant())) {
targets.add(createBaseResourceOption(varray));
}
return targets;
}
use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.
the class SwapContinuousCopiesService method precheck.
@Override
public void precheck() throws Exception {
super.precheck();
String sourceId = "";
String targetId = "";
String targetName = "";
String sourceName = "";
if (ConsistencyUtils.isVolumeStorageType(storageType)) {
// The type selected is volume
BlockObjectRestRep targetVolume = BlockStorageUtils.getVolume(protectionTarget);
BlockObjectRestRep sourceVolume = BlockStorageUtils.getVolume(protectionSource);
type = BlockStorageUtils.getFailoverType(targetVolume);
targetId = stringId(targetVolume);
targetName = targetVolume.getName();
sourceId = stringId(sourceVolume);
sourceName = sourceVolume.getName();
} else {
// The type selected is consistency group
BlockConsistencyGroupRestRep cg = BlockStorageUtils.getBlockConsistencyGroup(protectionSource);
VirtualArrayRestRep virtualArray = BlockStorageUtils.getVirtualArray(protectionTarget);
type = ConsistencyUtils.getFailoverType(cg);
targetId = stringId(virtualArray);
targetName = virtualArray.getName();
sourceId = stringId(cg);
sourceName = cg.getName();
}
if (type == null) {
ExecutionUtils.fail("failTask.SwapContinuousCopiesService", args(sourceId, targetId), args());
}
logInfo("swap.continuous.copies.service.precheck", type.toUpperCase(), sourceName, targetName);
}
Aggregations