Search in sources :

Example 6 with SRDFOperationContext

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

the class SRDFOperations method performEstablish.

public void performEstablish(StorageSystem system, Volume target, boolean refreshVolumeProperties, TaskCompleter completer) {
    log.info("START performEstablish");
    checkTargetHasParentOrFail(target);
    ServiceError error = null;
    try {
        // refresh RDF group source provider, it is required after R2 snap/clone restore performed on target provider
        RemoteDirectorGroup rdfGroup = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
        StorageSystem sourceSystem = dbClient.queryObject(StorageSystem.class, rdfGroup.getSourceStorageSystemUri());
        callEMCRefresh(helper, sourceSystem);
        SRDFOperationContext establishCtx = getContextFactory(system).build(SRDFOperation.ESTABLISH, target);
        establishCtx.appendFilters(new BrokenSynchronizationsOnlyFilter(utils));
        establishCtx.perform();
        if (refreshVolumeProperties) {
            refreshTargetVolumeProperties(system, target);
        }
    } catch (Exception e) {
        log.error("Failed to establish srdf link {}", target.getSrdfParent().getURI(), e);
        error = SmisException.errors.jobFailed(e.getMessage());
    } finally {
        if (error == null) {
            completer.ready(dbClient);
        } else {
            completer.error(dbClient, error);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BrokenSynchronizationsOnlyFilter(com.emc.storageos.volumecontroller.impl.smis.srdf.collectors.BrokenSynchronizationsOnlyFilter) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) SRDFOperationContext(com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) NoSynchronizationsFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 7 with SRDFOperationContext

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

the class SRDFOperations method performRestore.

public void performRestore(StorageSystem system, Volume target, TaskCompleter completer) {
    log.info("START performRestore");
    checkTargetHasParentOrFail(target);
    ServiceError error = null;
    try {
        SRDFOperationContext restoreCtx = getContextFactory(system).build(SRDFOperation.RESTORE, target);
        restoreCtx.appendFilters(new BrokenSynchronizationsOnlyFilter(utils));
        restoreCtx.perform();
        refreshTargetVolumeProperties(system, target);
    } catch (Exception e) {
        log.error("Failed to restore srdf link {}", target.getSrdfParent().getURI(), e);
        error = SmisException.errors.jobFailed(e.getMessage());
    } finally {
        if (error == null) {
            completer.ready(dbClient);
        } else {
            completer.error(dbClient, error);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BrokenSynchronizationsOnlyFilter(com.emc.storageos.volumecontroller.impl.smis.srdf.collectors.BrokenSynchronizationsOnlyFilter) SRDFOperationContext(com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) NoSynchronizationsFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)

Example 8 with SRDFOperationContext

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

the class SRDFOperations method performFailover.

public void performFailover(StorageSystem system, Volume target, TaskCompleter completer) {
    log.info("START performFailover");
    checkTargetHasParentOrFail(target);
    ServiceError error = null;
    try {
        Volume sourceVolume = getSourceVolume(target);
        StorageSystem sourceSystem = dbClient.queryObject(StorageSystem.class, sourceVolume.getStorageController());
        // for 4.6.x CG, only failback and swap are at group level. Failover has to be called at ModifyListSync.
        StorageSystem activeSystem = findProviderWithGroup(target);
        AbstractSRDFOperationContextFactory ctxFactory = getContextFactory(activeSystem);
        SRDFOperationContext ctx = null;
        if (!system.getUsingSmis80() && !isFailedOver(activeSystem, sourceVolume, target)) {
            log.info("Failing over link");
            ctx = ctxFactory.build(SRDFOperation.FAIL_OVER, target);
            ctx.perform();
        } else {
            invokeFailOverStrategy(sourceSystem, target);
        }
        if (completer instanceof SRDFLinkFailOverCompleter) {
            // Re-check the fail over status.
            LinkStatus status = null;
            if (isFailedOver(activeSystem, sourceVolume, target)) {
                status = LinkStatus.FAILED_OVER;
            } else {
                status = sourceVolume.hasConsistencyGroup() ? LinkStatus.CONSISTENT : LinkStatus.IN_SYNC;
            }
            ((SRDFLinkFailOverCompleter) completer).setLinkStatus(status);
        }
    } catch (Exception e) {
        log.error("Failed to failover srdf link {}", target.getSrdfParent().getURI(), e);
        error = SmisException.errors.jobFailed(e.getMessage());
    } finally {
        if (error == null) {
            completer.ready(dbClient);
        } else {
            completer.error(dbClient, error);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) LinkStatus(com.emc.storageos.db.client.model.Volume.LinkStatus) Volume(com.emc.storageos.db.client.model.Volume) SRDFLinkFailOverCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkFailOverCompleter) AbstractSRDFOperationContextFactory(com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory) SRDFOperationContext(com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) NoSynchronizationsFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

SRDFOperationContext (com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)7 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)7 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)7 WBEMException (javax.wbem.WBEMException)7 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 Volume (com.emc.storageos.db.client.model.Volume)3 LinkStatus (com.emc.storageos.db.client.model.Volume.LinkStatus)3 SRDFLinkFailOverCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkFailOverCompleter)2 AbstractSRDFOperationContextFactory (com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory)2 BrokenSynchronizationsOnlyFilter (com.emc.storageos.volumecontroller.impl.smis.srdf.collectors.BrokenSynchronizationsOnlyFilter)2 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 RemoteDirectorGroup (com.emc.storageos.db.client.model.RemoteDirectorGroup)1 CustomQueryUtility.queryActiveResourcesByConstraint (com.emc.storageos.db.client.util.CustomQueryUtility.queryActiveResourcesByConstraint)1 SRDFOperation (com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation)1 ErrorOnEmptyFilter (com.emc.storageos.volumecontroller.impl.smis.srdf.collectors.ErrorOnEmptyFilter)1 URI (java.net.URI)1 CIMInstance (javax.cim.CIMInstance)1