Search in sources :

Example 1 with SmisBlockSnapshotSessionCreateJob

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();
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) SmisBlockSnapshotSessionCreateJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionCreateJob) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) BlockObject(com.emc.storageos.db.client.model.BlockObject) CIMArgument(javax.cim.CIMArgument)

Aggregations

BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)1 Volume (com.emc.storageos.db.client.model.Volume)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)1 SmisBlockSnapshotSessionCreateJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionCreateJob)1 URI (java.net.URI)1 CIMArgument (javax.cim.CIMArgument)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1