use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockMapper method map.
public static BlockMirrorRestRep map(DbClient dbClient, BlockMirror from) {
if (from == null) {
return null;
}
BlockMirrorRestRep to = new BlockMirrorRestRep();
mapBlockObjectFields(from, to);
if (from.getSource() != null) {
to.setSource(toNamedRelatedResource(ResourceTypeEnum.VOLUME, from.getSource().getURI(), from.getSource().getName()));
}
to.setSyncState(from.getSyncState());
to.setSyncType(from.getSyncType());
to.setReplicaState(SynchronizationState.fromState(from.getSyncState()).name());
to.setVirtualPool(toRelatedResource(ResourceTypeEnum.BLOCK_VPOOL, from.getVirtualPool()));
if (from.getPool() != null) {
to.setPool(toRelatedResource(ResourceTypeEnum.STORAGE_POOL, from.getPool()));
}
return to;
}
use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockService method getMirror.
/**
* Show details for a specific continuous copy
*
* @prereq none
*
* @param id
* the URN of a ViPR Source volume
* @param mid
* Continuous copy URI
*
* @brief Show continuous copy
* @return BlockMirrorRestRep
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies/{mid}")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public BlockMirrorRestRep getMirror(@PathParam("id") URI id, @PathParam("mid") URI mid) {
ArgValidator.checkFieldUriType(id, Volume.class, "id");
boolean vplexVolume = checkIfVolumeIsForVplex(id);
BlockMirrorRestRep mirrorRestRep = null;
if (vplexVolume) {
ArgValidator.checkFieldUriType(mid, VplexMirror.class, "mid");
VplexMirror mirror = queryVplexMirror(mid);
if (!mirror.getSource().getURI().equals(id)) {
throw APIException.badRequests.invalidParameterVolumeMirrorMismatch(mid, id);
}
mirrorRestRep = map(mirror);
} else {
queryResource(id);
ArgValidator.checkFieldUriType(mid, BlockMirror.class, "mid");
BlockMirror mirror = queryMirror(mid);
if (!mirror.getSource().getURI().equals(id)) {
throw APIException.badRequests.invalidParameterVolumeMirrorMismatch(mid, id);
}
mirrorRestRep = map(_dbClient, mirror);
}
return mirrorRestRep;
}
use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedBlockContinuousCopyByVolume.
@Asset("exportedBlockContinuousCopy")
@AssetDependencies({ "project", "volumeWithContinuousCopies" })
public List<AssetOption> getExportedBlockContinuousCopyByVolume(AssetOptionsContext ctx, URI project, URI volume) {
debug("getting exported blockContinuousCopy (project=%s) (parent=%s)", project, volume);
final ViPRCoreClient client = api(ctx);
Set<URI> exportedMirrors = new HashSet<URI>();
for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
for (ExportBlockParam resource : export.getVolumes()) {
if (ResourceType.isType(ResourceType.BLOCK_CONTINUOUS_COPY, resource.getId())) {
exportedMirrors.add(resource.getId());
}
}
}
ExportedBlockResourceFilter<BlockMirrorRestRep> exportedMirrorFilter = new ExportedBlockResourceFilter<BlockMirrorRestRep>(exportedMirrors);
List<BlockMirrorRestRep> mirrors = client.blockVolumes().getContinuousCopies(volume, exportedMirrorFilter);
return createVolumeOptions(client, mirrors);
}
use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method constructCopiesOptions.
protected List<AssetOption> constructCopiesOptions(ViPRCoreClient client, URI project, List<BlockMirrorRestRep> copies) {
List<AssetOption> options = Lists.newArrayList();
for (BlockMirrorRestRep copy : copies) {
options.add(new AssetOption(copy.getId(), getBlockObjectLabel(client, copy, null)));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.block.BlockMirrorRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method isVMAXUsePortGroupEnabled.
public static boolean isVMAXUsePortGroupEnabled(URI resourceId) {
SimpleValueRep value = execute(new GetVMAXUsePortGroupEnabledConfig());
if (value.getValue().equalsIgnoreCase("true")) {
if (ResourceType.isType(ResourceType.VOLUME, resourceId)) {
BlockObjectRestRep obj = getVolume(resourceId);
if (obj instanceof VolumeRestRep) {
VolumeRestRep volume = (VolumeRestRep) obj;
boolean isVMAX = StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
boolean isRPOrVPlex = isVplexOrRPVolume(volume);
if (isVMAX && !isRPOrVPlex) {
return true;
}
}
if (obj instanceof BlockSnapshotRestRep) {
BlockSnapshotRestRep snapshot = (BlockSnapshotRestRep) obj;
BlockObjectRestRep parent = getVolume(snapshot.getParent().getId());
if (parent instanceof VolumeRestRep) {
VolumeRestRep volume = (VolumeRestRep) obj;
if (StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
if (parent instanceof BlockMirrorRestRep) {
BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
}
if (obj instanceof BlockMirrorRestRep) {
BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
return true;
}
}
}
if (ResourceType.isType(ResourceType.VIRTUAL_POOL, resourceId)) {
BlockVirtualPoolRestRep virtualPool = execute(new GetBlockVirtualPool(resourceId));
boolean isVMAX = StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
boolean isVPLEX = virtualPool.getHighAvailability() != null;
if (isVMAX && !isVPLEX) {
return true;
}
}
}
return false;
}
Aggregations