Search in sources :

Example 1 with SmisBlockCreateCGMirrorJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGMirrorJob in project coprhd-controller by CoprHD.

the class VmaxMirrorOperations method createGroupMirrors.

@Override
public void createGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("createGroupMirrors operation START");
    List<BlockMirror> mirrors = null;
    try {
        if (!storage.getUsingSmis80()) {
            throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
        }
        mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
        BlockMirror firstMirror = mirrors.get(0);
        Volume sourceVolume = _dbClient.queryObject(Volume.class, firstMirror.getSource());
        String sourceGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVolume, _dbClient);
        String replicaLabel = ControllerUtils.generateLabel(sourceVolume.getLabel(), firstMirror.getLabel());
        // CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
        ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
        // Create CG mirrors
        CIMObjectPath job = VmaxGroupOperationsUtils.internalCreateGroupReplica(storage, sourceGroupName, replicaLabel, null, createInactive, taskCompleter, SYNC_TYPE.MIRROR, _dbClient, _helper, _cimPath);
        ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGMirrorJob(job, storage.getId(), taskCompleter)));
        for (BlockMirror mirror : mirrors) {
            mirror.setSyncState(SynchronizationState.SYNCHRONIZED.name());
        }
        _dbClient.persistObject(mirrors);
    } catch (Exception e) {
        _log.error("Problem making SMI-S call: ", e);
        // Roll back changes
        if (mirrors != null && !mirrors.isEmpty()) {
            for (BlockMirror mirrorObj : mirrors) {
                mirrorObj.setInactive(true);
            }
        }
        _dbClient.persistObject(mirrors);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupMirrors", e.getMessage());
        taskCompleter.error(_dbClient, error);
    }
    _log.info("createGroupMirrors operation END");
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) SmisBlockCreateCGMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGMirrorJob) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) WBEMException(javax.wbem.WBEMException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)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 SmisBlockCreateCGMirrorJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGMirrorJob)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1