use of com.emc.storageos.model.block.Copy in project coprhd-controller by CoprHD.
the class ResumeContinuousCopy method doExecute.
@Override
protected Tasks<VolumeRestRep> doExecute() throws Exception {
Copy copy = new Copy();
copy.setCopyID(continuousCopyId);
copy.setType(type);
CopiesParam param = new CopiesParam();
param.getCopies().add(copy);
return getClient().blockVolumes().resumeContinuousCopies(volumeId, param);
}
use of com.emc.storageos.model.block.Copy in project coprhd-controller by CoprHD.
the class SwapCGContinuousCopies method doExecute.
@Override
protected Tasks<BlockConsistencyGroupRestRep> doExecute() throws Exception {
Copy copy = new Copy();
copy.setType(type);
copy.setCopyID(failoverTarget);
CopiesParam param = new CopiesParam();
param.getCopies().add(copy);
return getClient().blockConsistencyGroups().swap(consistencyGroupId, param);
}
use of com.emc.storageos.model.block.Copy in project coprhd-controller by CoprHD.
the class UpdateBlockConsistencyGroupAccessMode method doExecute.
@Override
protected Tasks<BlockConsistencyGroupRestRep> doExecute() throws Exception {
Copy copy = new Copy();
copy.setType(type);
copy.setCopyID(failoverTarget);
copy.setAccessMode(accessMode);
CopiesParam param = new CopiesParam();
param.getCopies().add(copy);
return getClient().blockConsistencyGroups().updateCopyAccessMode(consistencyGroupId, param);
}
use of com.emc.storageos.model.block.Copy in project coprhd-controller by CoprHD.
the class BlockService method validateSRDFStopOperation.
/**
* Cant Perform SRDF STOP operation Sync/Async with CG if it has active snap or clone.
*
* @param id
* @param param
*/
private void validateSRDFStopOperation(URI id, CopiesParam param) {
List<URI> srdfVolumeURIList = new ArrayList<URI>();
Volume srdfSourceVolume = _dbClient.queryObject(Volume.class, id);
if (srdfSourceVolume.checkForSRDF() && srdfSourceVolume.hasConsistencyGroup()) {
srdfVolumeURIList.add(id);
for (Copy copy : param.getCopies()) {
URI copyID = copy.getCopyID();
if (URIUtil.isType(copyID, Volume.class) && URIUtil.isValid(copyID)) {
srdfVolumeURIList.add(copyID);
break;
}
}
for (URI srdfVolURI : srdfVolumeURIList) {
Volume volume = _dbClient.queryObject(Volume.class, srdfVolURI);
URIQueryResultList list = new URIQueryResultList();
Constraint constraint = ContainmentConstraint.Factory.getVolumeSnapshotConstraint(srdfVolURI);
_dbClient.queryByConstraint(constraint, list);
Iterator<URI> it = list.iterator();
while (it.hasNext()) {
URI snapshotID = it.next();
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotID);
if (snapshot != null && !snapshot.getInactive()) {
throw APIException.badRequests.cannotStopSRDFBlockSnapShotExists(volume.getLabel());
}
}
// Also check for snapshot sessions.
List<BlockSnapshotSession> snapSessions = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, BlockSnapshotSession.class, ContainmentConstraint.Factory.getParentSnapshotSessionConstraint(srdfVolURI));
if (!snapSessions.isEmpty()) {
throw APIException.badRequests.cannotStopSRDFBlockSnapShotExists(volume.getLabel());
}
// full copies deleting the volume may not be allowed.
if (!getFullCopyManager().volumeCanBeDeleted(volume)) {
throw APIException.badRequests.cantStopSRDFFullCopyNotDetached(volume.getLabel());
}
}
}
}
use of com.emc.storageos.model.block.Copy in project coprhd-controller by CoprHD.
the class BlockService method syncContinuousCopies.
/**
* Sync continuous copies.
*
* @prereq none
*
* @param id
* the URI of a ViPR Source volume
* @param param
* List of copies to sync
*
* @brief Sync continuous copies.
* @return TaskList
*
* @throws ControllerException
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/continuous-copies/sync")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskList syncContinuousCopies(@PathParam("id") URI id, CopiesParam param) throws ControllerException {
TaskResourceRep taskResp = null;
TaskList taskList = new TaskList();
// Validate the source volume URI
ArgValidator.checkFieldUriType(id, Volume.class, "id");
// Validate the list of copies
ArgValidator.checkFieldNotEmpty(param.getCopies(), "copies");
// Verify that the copy IDs are either all specified or none are specified
// for a particular protection type. Combinations are not allowed
verifyCopyIDs(param);
// Process the list of copies
for (Copy copy : param.getCopies()) {
// Validate a copy type was passed
ArgValidator.checkFieldNotEmpty(copy.getType(), "type");
// If copyID is null all copies are paused
if (copy.getType().equalsIgnoreCase(TechnologyType.RP.toString())) {
// If copyID is not set all copies are sync'd
URI copyID = copy.getCopyID();
if (!URIUtil.isValid(copyID)) {
copyID = null;
}
taskResp = performProtectionAction(id, copy, ProtectionOp.SYNC.getRestOp());
taskList.getTaskList().add(taskResp);
// If copyID is null, we have already synced all copies
if (copyID == null) {
return taskList;
}
} else if (copy.getType().equalsIgnoreCase(TechnologyType.SRDF.toString())) {
id = VPlexSrdfUtil.getSrdfIdFromVolumeId(_dbClient, id);
copy.setCopyID(VPlexSrdfUtil.getSrdfIdFromVolumeId(_dbClient, copy.getCopyID()));
taskResp = performSRDFProtectionAction(id, copy, ProtectionOp.SYNC.getRestOp());
taskList.getTaskList().add(taskResp);
} else {
throw APIException.badRequests.invalidCopyType(copy.getType());
}
}
return taskList;
}
Aggregations