use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class VMAXBlockFullCopyApiImpl method establishVolumeAndFullCopyGroupRelation.
/**
* {@inheritDoc}
*/
@Override
public TaskList establishVolumeAndFullCopyGroupRelation(Volume sourceVolume, Volume fullCopyVolume) {
// Create the task list.
TaskList taskList = new TaskList();
// Create a unique task id.
String taskId = UUID.randomUUID().toString();
// Get the id of the source volume.
URI sourceVolumeURI = sourceVolume.getId();
// Get the id of the full copy volume.
URI fullCopyURI = fullCopyVolume.getId();
// Get the storage system for the source volume.
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceVolume.getStorageController());
URI sourceSystemURI = sourceSystem.getId();
// Create the task on the full copy volume.
Operation op = _dbClient.createTaskOpStatus(Volume.class, fullCopyURI, taskId, ResourceOperationTypeEnum.ESTABLISH_VOLUME_FULL_COPY);
fullCopyVolume.getOpStatus().put(taskId, op);
TaskResourceRep fullCopyVolumeTask = TaskMapper.toTask(fullCopyVolume, taskId, op);
taskList.getTaskList().add(fullCopyVolumeTask);
// Invoke the controller.
try {
BlockController controller = getController(BlockController.class, sourceSystem.getSystemType());
controller.establishVolumeAndFullCopyGroupRelation(sourceSystemURI, sourceVolumeURI, fullCopyURI, taskId);
} catch (InternalException ie) {
s_logger.error(String.format("Failed to establish group relation between volume group" + " and full copy group. Volume: %s, Full copy: %s", sourceVolumeURI, fullCopyVolume.getId()), ie);
super.handleFailedRequest(taskId, taskList, Arrays.asList(fullCopyVolume), ie, false);
}
return taskList;
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class VMAX3BlockSnapshotSessionApiImpl method relinkTargetVolumesToSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void relinkTargetVolumesToSnapshotSession(BlockObject snapSessionSourceObj, BlockSnapshotSession tgtSnapSession, List<URI> snapshotURIs, String taskId) {
// Invoke the BlockDeviceController to relink the targets
// to the passed target snapshot session.
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, snapSessionSourceObj.getStorageController());
BlockController controller = getController(BlockController.class, storageSystem.getSystemType());
controller.relinkTargetsToSnapshotSession(storageSystem.getId(), tgtSnapSession.getId(), snapshotURIs, Boolean.TRUE, taskId);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class VMAX3BlockSnapshotSessionApiImpl method restoreSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void restoreSnapshotSession(BlockSnapshotSession snapSession, BlockObject snapSessionSourceObj, String taskId) {
// Invoke the BlockDeviceController to restore the snapshot session source.
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, snapSessionSourceObj.getStorageController());
BlockController controller = getController(BlockController.class, storageSystem.getSystemType());
controller.restoreSnapshotSession(storageSystem.getId(), snapSession.getId(), Boolean.TRUE, taskId);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class VMAX3BlockSnapshotSessionApiImpl method unlinkTargetVolumesFromSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void unlinkTargetVolumesFromSnapshotSession(BlockObject snapSessionSourceObj, BlockSnapshotSession snapSession, Map<URI, Boolean> snapshotDeletionMap, OperationTypeEnum opType, String taskId) {
// Invoke the BlockDeviceController to unlink the targets
// from the snapshot session.
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, snapSessionSourceObj.getStorageController());
BlockController controller = getController(BlockController.class, storageSystem.getSystemType());
controller.unlinkTargetsFromSnapshotSession(storageSystem.getId(), snapSession.getId(), snapshotDeletionMap, opType, taskId);
}
use of com.emc.storageos.volumecontroller.BlockController in project coprhd-controller by CoprHD.
the class BlockMirrorServiceApiImpl method resumeNativeContinuousCopies.
/**
* {@inheritDoc}
*/
@Override
public TaskList resumeNativeContinuousCopies(StorageSystem storageSystem, Volume sourceVolume, List<BlockMirror> blockMirrors, String taskId) throws ControllerException {
_log.info("START resume native continuous copies");
TaskList taskList = new TaskList();
List<URI> resumedMirrors = new ArrayList<URI>();
List<URI> mirrorURIs = new ArrayList<URI>();
Map<BlockMirror, Volume> groupMirrorSourceMap = null;
List<BlockMirror> mirrorsToProcess = null;
boolean isCG = sourceVolume.isInCG();
if (isCG) {
if (blockMirrors == null) {
for (String uriStr : sourceVolume.getMirrors()) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, URI.create(uriStr));
if (mirrorIsResumable(mirror)) {
groupMirrorSourceMap = getGroupMirrorSourceMap(mirror, sourceVolume);
// only process one mirror group
break;
}
}
} else {
groupMirrorSourceMap = getGroupMirrorSourceMap(blockMirrors.get(0), sourceVolume);
}
if (groupMirrorSourceMap == null || groupMirrorSourceMap.isEmpty()) {
Operation op = new Operation();
op.ready();
op.setResourceType(ResourceOperationTypeEnum.RESUME_VOLUME_MIRROR);
op.setMessage("No continuous copy can be resumed");
_dbClient.createTaskOpStatus(Volume.class, sourceVolume.getId(), taskId, op);
taskList.getTaskList().add(toTask(sourceVolume, taskId, op));
return taskList;
}
mirrorsToProcess = new ArrayList<BlockMirror>(groupMirrorSourceMap.keySet());
mirrorURIs = new ArrayList<URI>(transform(mirrorsToProcess, FCTN_MIRROR_TO_URI));
} else {
// Assume all continuous copies are to be resumed
mirrorsToProcess = blockMirrors;
if (mirrorsToProcess == null) {
mirrorsToProcess = new ArrayList<BlockMirror>();
for (String uriStr : sourceVolume.getMirrors()) {
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, URI.create(uriStr));
mirrorsToProcess.add(mirror);
}
}
for (BlockMirror mirror : mirrorsToProcess) {
if (mirrorIsPausable(mirror) || mirrorIsResynchronizing(mirror)) {
// extract mirrors that are in resume state or resynchronizing
resumedMirrors.add(mirror.getId());
} else if (!mirrorIsResumable(mirror)) {
throw APIException.badRequests.cannotResumeContinuousCopyWithSyncState(mirror.getId(), mirror.getSyncState(), sourceVolume.getId());
}
mirrorURIs.add(mirror.getId());
}
}
/*
* if all mirrors are resumed/resynchronizing, then there is no task to do.
* Return a successful task
*/
if (!resumedMirrors.isEmpty() && mirrorURIs.isEmpty()) {
// If the mirrors is already resumed or resynchronizing, there would be no need to queue another request to
// resume it again.
Operation op = new Operation();
op.setResourceType(ResourceOperationTypeEnum.RESUME_VOLUME_MIRROR);
op.setAssociatedResourcesField(Joiner.on(',').join(resumedMirrors));
op.ready("The continuous copies are already resumed or resynchronizing");
_dbClient.createTaskOpStatus(Volume.class, sourceVolume.getId(), taskId, op);
taskList.getTaskList().add(toTask(sourceVolume, taskId, op));
} else {
if (!isCG) {
Collection<String> mirrorTargetIds = Collections2.transform(mirrorsToProcess, FCTN_VOLUME_URI_TO_STR);
String mirrorTargetCommaDelimList = Joiner.on(',').join(mirrorTargetIds);
Operation op = _dbClient.createTaskOpStatus(Volume.class, sourceVolume.getId(), taskId, ResourceOperationTypeEnum.RESUME_VOLUME_MIRROR, mirrorTargetCommaDelimList);
taskList.getTaskList().add(toTask(sourceVolume, mirrorsToProcess, taskId, op));
} else {
populateTaskList(sourceVolume, groupMirrorSourceMap, taskList, taskId, ResourceOperationTypeEnum.RESUME_VOLUME_MIRROR);
}
try {
BlockController controller = getController(BlockController.class, storageSystem.getSystemType());
controller.resumeNativeContinuousCopies(storageSystem.getId(), mirrorURIs, taskId);
} catch (ControllerException e) {
String errorMsg = format("Failed to resume continuous copies for source volume %s", sourceVolume.getId());
_log.error(errorMsg, e);
_dbClient.error(Volume.class, sourceVolume.getId(), taskId, e);
}
}
return taskList;
}
Aggregations