Search in sources :

Example 56 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class SRDFAddPairToGroupCompleter method complete.

@Override
public void complete(final DbClient dbClient, final Operation.Status status, final ServiceCoded coded) throws DeviceControllerException {
    log.info("Completing with status: {}", status);
    setDbClient(dbClient);
    try {
        switch(status) {
            case ready:
                for (Volume source : getVolumes()) {
                    if (null != vpoolChangeURI) {
                        source.setVirtualPool(vpoolChangeURI);
                        dbClient.persistObject(source);
                        log.info("Updating virtual Pool {} to sourceVlume {}", vpoolChangeURI, source.getNativeGuid());
                    }
                }
            default:
                log.info("Unable to handle status: {}", status);
        }
    } catch (Exception e) {
        log.info("Failed to update status for task {}", getOpId(), e);
    } finally {
        super.complete(dbClient, status, coded);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 57 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class SRDFChangeCopyModeTaskCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        setDbClient(dbClient);
        switch(status) {
            case ready:
                RemoteDirectorGroup rdfGrp = null;
                for (Volume target : tgtVolumes) {
                    target.setSrdfCopyMode(newCopyMode);
                    dbClient.persistObject(target);
                    log.info(String.format("SRDF Device source %s and target %s copy mode got changed into %s", target.getSrdfParent().toString(), target.getId().toString(), newCopyMode));
                    if (rdfGrp == null) {
                        rdfGrp = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
                    }
                }
                if (rdfGrp != null) {
                    rdfGrp.setSupportedCopyMode(newCopyMode);
                    dbClient.persistObject(rdfGrp);
                    log.info("RDF Group {} copy mode got changed into : {}", rdfGrp.getId(), newCopyMode);
                }
                break;
            default:
                log.info("Unable to handle SRDF Link Change Copy Mode Operational status: {}", status);
        }
    } catch (Exception e) {
        log.error("Failed change copy mode. SRDFMirror {}, for task " + getOpId(), getId(), e);
    } finally {
        super.complete(dbClient, status, coded);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 58 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class SRDFMirrorCreateCompleter method complete.

@Override
public void complete(final DbClient dbClient, final Operation.Status status, final ServiceCoded coded) throws DeviceControllerException {
    log.info("Completing with status: {}", status);
    setDbClient(dbClient);
    try {
        switch(status) {
            case ready:
                if (null != vpoolChangeURI) {
                    // updating source volumes with changed vPool
                    URI previousVPool = null;
                    for (Volume volume : getVolumes()) {
                        if (volume.isSRDFSource()) {
                            previousVPool = volume.getVirtualPool();
                            volume.setVirtualPool(vpoolChangeURI);
                            dbClient.updateObject(volume);
                        }
                    }
                    SRDFOperationContext.insertContextOperation(this, CHANGE_VPOOL_ON_SOURCE, previousVPool, vpoolChangeURI);
                }
                // Pin the target System with the source CG, which helps to identify this system is
                // a target R2 for CG.
                Volume target = getTargetVolume();
                if (null != sourceCGUri) {
                    URI targetSystemUri = target.getStorageController();
                    StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, targetSystemUri);
                    if (targetSystem.getTargetCgs() == null) {
                        targetSystem.setTargetCgs(new StringSet());
                    }
                    targetSystem.getTargetCgs().add(sourceCGUri.toString());
                    dbClient.updateObject(targetSystem);
                }
                String copyMode = target.getSrdfCopyMode();
                RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
                log.info("Setting copyMode {} to RAGroup {}", copyMode, group.getId());
                group.setSupportedCopyMode(copyMode);
                group.setSourceReplicationGroupName(sourceRepGroup);
                group.setTargetReplicationGroupName(targetRepGroup);
                if (null == group.getVolumes()) {
                    group.setVolumes(new StringSet());
                }
                group.getVolumes().addAll(getVolumeIds());
                dbClient.updateObject(group);
                break;
            default:
                log.info("Unable to handle status: {}", status);
        }
        recordSRDFOperation(dbClient, OperationTypeEnum.CREATE_SRDF_LINK, status, getSourceVolume().getId().toString(), getTargetVolume().getId().toString());
    } catch (Exception e) {
        log.info("Failed to update status for task {}", getOpId(), e);
    } finally {
        super.complete(dbClient, status, coded);
    }
}
Also used : URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 59 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class StoragePortGroupCreateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        StoragePortGroup portGroup = dbClient.queryObject(StoragePortGroup.class, getId());
        if (status == Status.ready && portGroup != null) {
            URI systemURI = portGroup.getStorageDevice();
            StorageSystem storage = dbClient.queryObject(StorageSystem.class, systemURI);
            portGroup.setNativeGuid(String.format("%s+%s", storage.getNativeGuid(), portGroup.getLabel()));
            portGroup.setInactive(false);
            dbClient.updateObject(portGroup);
            dbClient.ready(StoragePortGroup.class, getId(), getOpId());
        } else if (status == Status.error) {
            log.error("The status is error, remove the storage port group");
            portGroup.setInactive(true);
            dbClient.error(StoragePortGroup.class, getId(), getOpId(), coded);
            dbClient.removeObject(portGroup);
        }
    } catch (Exception e) {
        log.error("Failed updating status", e);
    } finally {
        updateWorkflowStatus(status, coded);
    }
}
Also used : StoragePortGroup(com.emc.storageos.db.client.model.StoragePortGroup) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 60 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class StoragePortGroupDeleteCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        StoragePortGroup portGroup = dbClient.queryObject(StoragePortGroup.class, getId());
        if (status == Status.ready && portGroup != null) {
            dbClient.ready(StoragePortGroup.class, getId(), getOpId());
            dbClient.removeObject(portGroup);
        } else if (status == Status.error) {
            log.error("The status is error.");
            dbClient.error(StoragePortGroup.class, getId(), getOpId(), coded);
        }
    } catch (Exception e) {
        log.error("Failed updating status", e);
    } finally {
        updateWorkflowStatus(status, coded);
    }
}
Also used : StoragePortGroup(com.emc.storageos.db.client.model.StoragePortGroup) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)393 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)211 URI (java.net.URI)157 Volume (com.emc.storageos.db.client.model.Volume)115 ArrayList (java.util.ArrayList)115 WBEMException (javax.wbem.WBEMException)113 CIMObjectPath (javax.cim.CIMObjectPath)104 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)85 ExportMask (com.emc.storageos.db.client.model.ExportMask)83 CIMArgument (javax.cim.CIMArgument)81 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)75 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)63 BlockObject (com.emc.storageos.db.client.model.BlockObject)55 HashMap (java.util.HashMap)54 Initiator (com.emc.storageos.db.client.model.Initiator)52 HashSet (java.util.HashSet)52 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)48 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)46 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)46 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)43