use of com.emc.storageos.model.block.MirrorList in project coprhd-controller by CoprHD.
the class FileService method getNativeContinuousCopies.
/**
* List FileShare mirrors
*
* @prereq none
*
* @param id
* the URN of a ViPR FileShare to list mirrors
*
* @brief List fileShare mirrors
* @return FileShare mirror response containing a list of mirror identifiers
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public MirrorList getNativeContinuousCopies(@PathParam("id") URI id) {
MirrorList list = new MirrorList();
ArgValidator.checkFieldUriType(id, FileShare.class, "id");
FileShare sourceFileShare = _dbClient.queryObject(FileShare.class, id);
StringSet sourceFileShareMirrors = sourceFileShare.getMirrorfsTargets();
if (sourceFileShareMirrors == null || sourceFileShareMirrors.isEmpty()) {
return list;
}
for (String uriStr : sourceFileShareMirrors) {
FileShare fileMirror = _dbClient.queryObject(FileShare.class, URI.create(uriStr));
if (fileMirror == null || fileMirror.getInactive()) {
_log.warn("Stale mirror {} found for fileShare {}", uriStr, sourceFileShare.getId());
continue;
}
list.getMirrorList().add(toNamedRelatedResource(fileMirror));
}
return list;
}
use of com.emc.storageos.model.block.MirrorList in project coprhd-controller by CoprHD.
the class BlockService method getNativeContinuousCopies.
/**
* List volume mirrors
*
* @prereq none
*
* @param id
* the URN of a ViPR Volume to list mirrors
*
* @brief List volume mirrors
* @return Volume mirror response containing a list of mirror identifiers
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public MirrorList getNativeContinuousCopies(@PathParam("id") URI id) {
MirrorList list = new MirrorList();
ArgValidator.checkFieldUriType(id, Volume.class, "id");
Volume sourceVolume = queryVolumeResource(id);
boolean vplexVolume = checkIfVolumeIsForVplex(id);
StringSet sourceVolumeMirrors = sourceVolume.getMirrors();
if (sourceVolumeMirrors == null || sourceVolumeMirrors.isEmpty()) {
return list;
}
for (String uriStr : sourceVolumeMirrors) {
if (vplexVolume) {
VplexMirror vplexMirror = _dbClient.queryObject(VplexMirror.class, URI.create(uriStr));
if (vplexMirror == null || vplexMirror.getInactive()) {
_log.warn("Stale mirror {} found for volume {}", uriStr, sourceVolume.getId());
continue;
}
list.getMirrorList().add(toNamedRelatedResource(vplexMirror));
} else {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, URI.create(uriStr));
if (blockMirror == null || blockMirror.getInactive()) {
_log.warn("Stale mirror {} found for volume {}", uriStr, sourceVolume.getId());
continue;
}
list.getMirrorList().add(toNamedRelatedResource(blockMirror));
}
}
return list;
}
Aggregations