Search in sources :

Example 1 with HDSReplicationSyncJob

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

the class HDSMirrorOperations method detachSingleVolumeMirror.

/**
 * 1. Delete ShadowImage Pair
 * 2. Delete DummyLunPath from secondary volume
 */
@Override
public void detachSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    NamedURI sourceVolumeURI = null;
    try {
        BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirror);
        // TODO needs to sync pair and wait for synchronization here
        Volume source = dbClient.queryObject(Volume.class, mirrorObj.getSource());
        sourceVolumeURI = mirrorObj.getSource();
        boolean status = hdsProtectionOperations.modifyShadowImagePair(storage, source.getNativeId(), mirrorObj.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.split);
        if (status) {
            String taskId = UUID.randomUUID().toString();
            TaskCompleter completer = new SimpleTaskCompleter(BlockMirror.class, mirror, taskId);
            HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), source.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.SPLIT, completer);
            hdsCommandHelper.waitForAsyncHDSJob(syncjob);
        } else {
            log.info("Replication info is not available on pair management server");
        }
        hdsProtectionOperations.deleteShadowImagePair(storage, source, mirrorObj);
        hdsProtectionOperations.removeDummyLunPath(storage, mirror);
        taskCompleter.ready(dbClient);
    } catch (Exception e) {
        String errorMsg = String.format(DETACH_ERROR_MSG_FORMAT, mirror, sourceVolumeURI != null ? sourceVolumeURI.toString() : HDSConstants.SPACE_STR);
        log.error(errorMsg, e);
        ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("detachSingleVolumeMirror", e.getMessage());
        taskCompleter.error(dbClient, serviceError);
    }
}
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) NamedURI(com.emc.storageos.db.client.model.NamedURI) Volume(com.emc.storageos.db.client.model.Volume) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Example 2 with HDSReplicationSyncJob

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

the class HDSCloneOperations method restoreFromSingleClone.

@Override
public void restoreFromSingleClone(StorageSystem storageSystem, URI cloneURI, TaskCompleter taskCompleter) {
    try {
        Volume cloneVolume = dbClient.queryObject(Volume.class, cloneURI);
        Volume sourceVolume = dbClient.queryObject(Volume.class, cloneVolume.getAssociatedSourceVolume());
        hdsProtectionOperations.modifyShadowImagePair(storageSystem, sourceVolume.getNativeId(), cloneVolume.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.restore);
        ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageSystem.getId(), sourceVolume.getNativeId(), cloneVolume.getNativeId(), ReplicationStatus.PAIR, taskCompleter)));
        log.info("FINISH restoreFromSingleClone for {}", cloneURI);
    } catch (Exception e) {
        String errorMsg = String.format(RESTORE_ERROR_MSG_FORMAT, cloneURI);
        log.error(errorMsg, e);
        taskCompleter.error(dbClient, DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
    }
}
Also used : HDSReplicationSyncJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob) Volume(com.emc.storageos.db.client.model.Volume) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Example 3 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)

Example 4 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 5 with HDSReplicationSyncJob

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

the class HDSMirrorOperations method resumeSingleVolumeMirror.

/**
 * Resync ShadowImage pair
 */
@Override
public void resumeSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("resumeSingleVolumeMirror 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.resync);
        HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), sourceVolume.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.PAIR, taskCompleter);
        hdsCommandHelper.waitForAsyncHDSJob(syncjob);
        mirrorObj.setSyncState(SynchronizationState.SYNCHRONIZED.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("resumeSingleVolumeMirror 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)

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