use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionCreateJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method createSnapshotSession.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void createSnapshotSession(StorageSystem system, URI snapSessionURI, TaskCompleter completer) throws DeviceControllerException {
if (system.checkIfVmax3()) {
// Only supported for VMAX3 storage systems.
try {
_log.info("Create snapshot session operation START");
BlockSnapshotSession snapSession = _dbClient.queryObject(BlockSnapshotSession.class, snapSessionURI);
URI sourceObjURI = snapSession.getParent().getURI();
BlockObject sourceObj = BlockObject.fetch(_dbClient, sourceObjURI);
// Need to terminate an restore sessions, so that we can
// restore from the same snapshot multiple times
terminateAnyRestoreSessionsForVolume(system, sourceObj, completer);
URI tenantURI = null;
if (URIUtil.isType(sourceObjURI, Volume.class)) {
tenantURI = ((Volume) sourceObj).getTenant().getURI();
} else {
Volume sourceObjParent = _dbClient.queryObject(Volume.class, ((BlockSnapshot) sourceObj).getParent().getURI());
tenantURI = sourceObjParent.getTenant().getURI();
}
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, tenantURI);
String tenantName = tenant.getLabel();
String snapSessionLabelToUse = _nameGenerator.generate(tenantName, snapSession.getSessionLabel(), snapSessionURI.toString(), '-', SmisConstants.MAX_SMI80_SNAPSHOT_NAME_LENGTH);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
CIMObjectPath sourceObjPath = _cimPath.getBlockObjectPath(system, sourceObj);
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
inArgs = _helper.getCreateSynchronizationAspectInput(sourceObjPath, false, snapSessionLabelToUse, new Integer(SmisConstants.MODE_SYNCHRONOUS));
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.CREATE_SYNCHRONIZATION_ASPECT, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionCreateJob(jobPath, system.getId(), completer)));
} catch (Exception e) {
_log.error("Exception creating snapshot session ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
} else {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
}
Aggregations