Search in sources :

Example 6 with HDSReplicationSyncJob

use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.

the class HDSMirrorOperations method fractureSingleVolumeMirror.

/**
 * Split ShadowImage pair
 */
@Override
public void fractureSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean sync, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("fractureSingleVolumeMirror started");
    try {
        BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirror);
        Volume sourceVolume = dbClient.queryObject(Volume.class, mirrorObj.getSource());
        hdsProtectionOperations.modifyShadowImagePair(storage, sourceVolume.getNativeId(), mirrorObj.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.split);
        HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), sourceVolume.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.SPLIT, taskCompleter);
        hdsCommandHelper.waitForAsyncHDSJob(syncjob);
        mirrorObj.setSyncState(SynchronizationState.FRACTURED.name());
        dbClient.persistObject(mirrorObj);
        taskCompleter.ready(dbClient);
    } catch (Exception e) {
        log.error("Failed to resume single volume mirror: {}", mirror, e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(dbClient, serviceError);
    }
    log.info("fractureSingleVolumeMirror completed");
}
Also used : HDSReplicationSyncJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) HDSJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob) Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Example 7 with HDSReplicationSyncJob

use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.

the class HDSStorageDevice method doWaitForSynchronized.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.emc.storageos.volumecontroller.BlockStorageDevice#doWaitForSynchronized
     * (java.lang.Class, com.emc.storageos.db.client.model.StorageSystem,
     * java.net.URI, com.emc.storageos.volumecontroller.TaskCompleter)
     */
@Override
public void doWaitForSynchronized(Class<? extends BlockObject> clazz, StorageSystem storageObj, URI target, TaskCompleter completer) {
    log.info("START waitForSynchronized for {}", target);
    try {
        Volume targetObj = dbClient.queryObject(Volume.class, target);
        // Source could be either Volume or BlockSnapshot
        BlockObject sourceObj = BlockObject.fetch(dbClient, targetObj.getAssociatedSourceVolume());
        // We split the pair which causes the data to be synchronized.
        // When the split is complete that data is synchronized.
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageObj), storageObj.getSmisUserName(), storageObj.getSmisPassword());
        HDSApiProtectionManager hdsApiProtectionManager = hdsApiClient.getHdsApiProtectionManager();
        String replicationGroupObjectID = hdsApiProtectionManager.getReplicationGroupObjectId();
        ReplicationInfo replicationInfo = hdsApiProtectionManager.getReplicationInfoFromSystem(sourceObj.getNativeId(), targetObj.getNativeId()).first;
        hdsApiProtectionManager.modifyShadowImagePair(replicationGroupObjectID, replicationInfo.getObjectID(), HDSApiProtectionManager.ShadowImageOperationType.split, storageObj.getModel());
        // Update state in case we are waiting for synchronization
        // after creation of a new full copy that was not created
        // inactive.
        String state = targetObj.getReplicaState();
        if (!ReplicationState.SYNCHRONIZED.name().equals(state)) {
            targetObj.setSyncActive(true);
            targetObj.setReplicaState(ReplicationState.SYNCHRONIZED.name());
            dbClient.persistObject(targetObj);
        }
        // Queue job to wait for replication status to move to split.
        ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageObj.getId(), sourceObj.getNativeId(), targetObj.getNativeId(), ReplicationStatus.SPLIT, completer)));
    } catch (Exception e) {
        log.error("Exception occurred while waiting for synchronization", e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        completer.error(dbClient, serviceError);
    }
    log.info("completed doWaitForSynchronized");
}
Also used : HDSReplicationSyncJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob) HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) HDSApiProtectionManager(com.emc.storageos.hds.api.HDSApiProtectionManager) ReplicationInfo(com.emc.storageos.hds.model.ReplicationInfo) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) BlockObject(com.emc.storageos.db.client.model.BlockObject) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Aggregations

Volume (com.emc.storageos.db.client.model.Volume)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 HDSException (com.emc.storageos.hds.HDSException)7 HDSReplicationSyncJob (com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)4 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)4 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)3 HDSJob (com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob)3 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 HDSApiClient (com.emc.storageos.hds.api.HDSApiClient)1 HDSApiProtectionManager (com.emc.storageos.hds.api.HDSApiProtectionManager)1 ReplicationInfo (com.emc.storageos.hds.model.ReplicationInfo)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)1 SimpleTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter)1