use of com.emc.storageos.db.client.model.BlockObject in project coprhd-controller by CoprHD.
the class DefaultBlockSnapshotSessionApiImpl method validateRestoreSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void validateRestoreSnapshotSession(List<BlockObject> snapSessionSourceObjs, Project project) {
// Validate the project tenant.
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, project.getTenantOrg().getURI());
ArgValidator.checkEntity(tenant, project.getTenantOrg().getURI(), false);
// Verify the user is authorized.
BlockServiceUtils.verifyUserIsAuthorizedForRequest(project, BlockServiceUtils.getUserFromContext(_securityContext), _permissionsHelper);
for (BlockObject snapSessionSourceObj : snapSessionSourceObjs) {
if (URIUtil.isType(snapSessionSourceObj.getId(), Volume.class)) {
// Make sure that we don't have some pending
// operation against the volume.
Volume sourceVolume = (Volume) snapSessionSourceObj;
checkForPendingTasks(sourceVolume, sourceVolume.getTenant().getURI());
// On some platforms it is not possible to restore an array snapshot
// point-in-time copy to a source volume if the volume has active mirrors.
verifyActiveMirrors(sourceVolume);
}
}
}
use of com.emc.storageos.db.client.model.BlockObject in project coprhd-controller by CoprHD.
the class VPlexBlockSnapshotSessionApiImpl method prepareSnapshotsForSession.
/**
* {@inheritDoc}
*/
@Override
public List<Map<URI, BlockSnapshot>> prepareSnapshotsForSession(List<BlockObject> sourceObjList, int sourceCount, int newTargetCount, String newTargetsName, boolean inApplication) {
// The snapshots are generally prepared with information from the
// source side backend volume, which is the volume being snapped.
// The passed source object will be a volume, else would not have
// made it this far.
List<BlockObject> srcSideBackendVolumes = new ArrayList<>();
for (BlockObject sourceObj : sourceObjList) {
srcSideBackendVolumes.add(VPlexUtil.getVPLEXBackendVolume((Volume) sourceObj, true, _dbClient));
}
BlockSnapshotSessionApi snapSessionImpl = getImplementationForBackendSystem(srcSideBackendVolumes.get(0).getStorageController());
List<Map<URI, BlockSnapshot>> snapshotMap = snapSessionImpl.prepareSnapshotsForSession(srcSideBackendVolumes, sourceCount, newTargetCount, newTargetsName, inApplication);
// However, the project is from the VPLEX volume.
Project sourceProject = BlockSnapshotSessionUtils.querySnapshotSessionSourceProject(sourceObjList.get(0), _dbClient);
for (Map<URI, BlockSnapshot> snapshots : snapshotMap) {
for (BlockSnapshot snapshot : snapshots.values()) {
snapshot.setProject(new NamedURI(sourceProject.getId(), sourceObjList.get(0).getLabel()));
_dbClient.updateObject(snapshot);
}
}
return snapshotMap;
}
use of com.emc.storageos.db.client.model.BlockObject in project coprhd-controller by CoprHD.
the class VPlexBlockSnapshotSessionApiImpl method createSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void createSnapshotSession(BlockObject sourceObj, URI snapSessionURI, List<List<URI>> snapSessionSnapshotURIs, String copyMode, String taskId) {
if (URIUtil.isType(sourceObj.getId(), Volume.class)) {
// Get the platform specific implementation for the source side
// backend storage system and call the create method.
Volume vplexVolume = (Volume) sourceObj;
BlockObject srcSideBackendVolume = VPlexUtil.getVPLEXBackendVolume(vplexVolume, true, _dbClient);
BlockSnapshotSessionApi snapSessionImpl = getImplementationForBackendSystem(srcSideBackendVolume.getStorageController());
snapSessionImpl.createSnapshotSession(srcSideBackendVolume, snapSessionURI, snapSessionSnapshotURIs, copyMode, taskId);
} else {
// so should never be called.
throw APIException.methodNotAllowed.notSupportedForVplexVolumes();
}
}
use of com.emc.storageos.db.client.model.BlockObject in project coprhd-controller by CoprHD.
the class VPlexBlockSnapshotSessionApiImpl method validateRestoreSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void validateRestoreSnapshotSession(List<BlockObject> snapSessionSourceObjs, Project project) {
if (URIUtil.isType(snapSessionSourceObjs.get(0).getId(), Volume.class)) {
// Get the platform specific implementation for the source side
// backend storage system and call the validation routine.
List<BlockObject> srcSideBackendVolumes = new ArrayList<>();
for (BlockObject snapSessionSourceObj : snapSessionSourceObjs) {
Volume vplexVolume = (Volume) snapSessionSourceObj;
srcSideBackendVolumes.add(VPlexUtil.getVPLEXBackendVolume(vplexVolume, true, _dbClient));
}
BlockSnapshotSessionApi snapSessionImpl = getImplementationForBackendSystem(srcSideBackendVolumes.get(0).getStorageController());
snapSessionImpl.validateRestoreSnapshotSession(srcSideBackendVolumes, project);
for (BlockObject snapSessionSourceObj : snapSessionSourceObjs) {
Volume vplexVolume = (Volume) snapSessionSourceObj;
// Check for pending tasks on the VPLEX source volume.
checkForPendingTasks(vplexVolume, vplexVolume.getTenant().getURI());
// Verify no active mirrors on the VPLEX volume.
verifyActiveMirrors(vplexVolume);
}
} else {
// so should never be called.
throw APIException.methodNotAllowed.notSupportedForVplexVolumes();
}
}
use of com.emc.storageos.db.client.model.BlockObject in project coprhd-controller by CoprHD.
the class VPlexBlockSnapshotSessionApiImpl method linkNewTargetVolumesToSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void linkNewTargetVolumesToSnapshotSession(BlockObject snapSessionSourceObj, BlockSnapshotSession snapSession, List<List<URI>> snapshotURIs, String copyMode, String taskId) {
if (URIUtil.isType(snapSessionSourceObj.getId(), Volume.class)) {
// Get the platform specific implementation for the source side
// backend storage system and call the link method.
Volume vplexVolume = (Volume) snapSessionSourceObj;
BlockObject srcSideBackendVolume = VPlexUtil.getVPLEXBackendVolume(vplexVolume, true, _dbClient);
BlockSnapshotSessionApi snapSessionImpl = getImplementationForBackendSystem(srcSideBackendVolume.getStorageController());
snapSessionImpl.linkNewTargetVolumesToSnapshotSession(srcSideBackendVolume, snapSession, snapshotURIs, copyMode, taskId);
} else {
// so should never be called.
throw APIException.methodNotAllowed.notSupportedForVplexVolumes();
}
}
Aggregations