Search in sources :

Example 16 with DeviceControllerException

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

the class BlockConsistencyGroupUpdateCompleter method error.

@Override
public void error(DbClient dbClient, ServiceCoded serviceCoded) throws DeviceControllerException {
    try {
        super.error(dbClient, serviceCoded);
        BlockConsistencyGroup consistencyGroup = dbClient.queryObject(BlockConsistencyGroup.class, getConsistencyGroupURI());
        dbClient.error(BlockConsistencyGroup.class, consistencyGroup.getId(), getOpId(), serviceCoded);
        recordBourneBlockConsistencyGroupEvent(dbClient, consistencyGroup.getId(), eventType(Status.error), Status.error, eventMessage(Status.error, consistencyGroup));
    } catch (Exception e) {
        _log.error("Failed updating status. BlockConsistencyGroupUpdate {}, " + "for task " + getOpId(), getId(), e);
    }
}
Also used : DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Example 17 with DeviceControllerException

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

the class BlockMirrorCreateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        List<BlockMirror> mirrorList = dbClient.queryObject(BlockMirror.class, getIds());
        for (BlockMirror mirror : mirrorList) {
            Volume volume = dbClient.queryObject(Volume.class, mirror.getSource());
            switch(status) {
                case error:
                    mirror.setInactive(true);
                    dbClient.persistObject(mirror);
                    removeMirrorFromVolume(mirror.getId(), volume, dbClient);
                    dbClient.error(BlockMirror.class, mirror.getId(), getOpId(), coded);
                    dbClient.error(Volume.class, volume.getId(), getOpId(), coded);
                    break;
                default:
                    dbClient.ready(BlockMirror.class, mirror.getId(), getOpId());
                    dbClient.ready(Volume.class, volume.getId(), getOpId());
            }
            recordBlockMirrorOperation(dbClient, OperationTypeEnum.CREATE_VOLUME_MIRROR, status, eventMessage(status, volume, mirror), mirror, volume);
        }
    } catch (Exception e) {
        _log.error("Failed updating status. BlockMirrorCreate {}, for task " + getOpId(), Joiner.on("\t").join(getIds()), e);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 18 with DeviceControllerException

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

the class BlockMirrorDeactivateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        List<BlockMirror> mirrorList = dbClient.queryObject(BlockMirror.class, getIds());
        for (BlockMirror mirror : mirrorList) {
            Volume volume = dbClient.queryObject(Volume.class, mirror.getSource());
            switch(status) {
                case error:
                    dbClient.error(BlockMirror.class, mirror.getId(), getOpId(), coded);
                    dbClient.error(Volume.class, volume.getId(), getOpId(), coded);
                    break;
                default:
                    dbClient.ready(BlockMirror.class, mirror.getId(), getOpId());
                    dbClient.ready(Volume.class, volume.getId(), getOpId());
            }
            recordBlockMirrorOperation(dbClient, OperationTypeEnum.DEACTIVATE_VOLUME_MIRROR, status, eventMessage(status, volume, mirror), mirror, volume);
        }
        List<URI> promotees = getPromotees();
        if (promotees != null && !promotees.isEmpty()) {
            List<Volume> promotedVolumes = dbClient.queryObject(Volume.class, promotees);
            List<Volume> volumesToUpdate = new ArrayList<Volume>();
            for (Volume volume : promotedVolumes) {
                switch(status) {
                    case error:
                        dbClient.error(Volume.class, volume.getId(), getOpId(), coded);
                        volume.setInactive(true);
                        volumesToUpdate.add(volume);
                        break;
                    default:
                        dbClient.ready(Volume.class, volume.getId(), getOpId());
                }
            }
            if (!volumesToUpdate.isEmpty()) {
                dbClient.persistObject(volumesToUpdate);
            }
        }
    } catch (Exception e) {
        _log.error("Failed updating status. BlockMirrorDeactivate {}, for task " + getOpId(), Joiner.on("\t").join(getIds()), e);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 19 with DeviceControllerException

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

the class BlockMirrorDeleteCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        List<BlockMirror> mirrorList = dbClient.queryObject(BlockMirror.class, getIds());
        for (BlockMirror mirror : mirrorList) {
            Volume volume = dbClient.queryObject(Volume.class, mirror.getSource());
            switch(status) {
                case error:
                    dbClient.error(BlockMirror.class, mirror.getId(), getOpId(), coded);
                    dbClient.error(Volume.class, volume.getId(), getOpId(), coded);
                    break;
                default:
                    dbClient.ready(BlockMirror.class, mirror.getId(), getOpId());
                    dbClient.ready(Volume.class, volume.getId(), getOpId());
            }
            recordBlockMirrorOperation(dbClient, OperationTypeEnum.DELETE_VOLUME_MIRROR, status, eventMessage(status, volume, mirror), mirror, volume);
        }
    } catch (Exception e) {
        _log.error("Failed updating status. BlockMirrorCreate {}, for task " + getOpId(), Joiner.on("\t").join(getIds()), e);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 20 with DeviceControllerException

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

the class BlockSnapshotDeactivateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        List<BlockSnapshot> snapshots = dbClient.queryObject(BlockSnapshot.class, snapshotURIs);
        for (BlockSnapshot snapshot : snapshots) {
            Volume volume = dbClient.queryObject(Volume.class, snapshot.getParent());
            switch(status) {
                case error:
                    setErrorOnDataObject(dbClient, BlockSnapshot.class, snapshot, coded);
                    setErrorOnDataObject(dbClient, Volume.class, volume.getId(), coded);
                    break;
                case ready:
                    // Only execute the following logic if the snapshot has been deactivated and is tied to a bookmark
                    if (deactivatedSnapshots.contains(snapshot.getId()) && RPHelper.hasRpBookmark(snapshot)) {
                        // Note regarding the syncActive field:
                        // If we are performing a disable image access as part of a snapshot create for an array snapshot + RP bookmark,
                        // we want to set the syncActive field to true. This will enable us to perform snapshot exports and remove
                        // snapshots from exports.
                        // Update the snapshot/volume fields
                        RPHelper.updateRPSnapshotPostImageAccessChange(snapshot, volume, Volume.VolumeAccessState.NOT_READY, setSnapshotSyncActive, dbClient);
                    }
                default:
                    setReadyOnDataObject(dbClient, BlockSnapshot.class, snapshot);
                    setReadyOnDataObject(dbClient, Volume.class, volume.getId());
                    break;
            }
            recordBlockSnapshotOperation(dbClient, OperationTypeEnum.DEACTIVATE_VOLUME_SNAPSHOT, status, eventMessage(status, volume, snapshot), snapshot);
        }
        super.complete(dbClient, status, coded);
        _log.info("Done deactivate {}, with Status: {}", getOpId(), status.name());
    } catch (Exception e) {
        _log.error("Failed updating status. SnapshotDeactivate {}, for task " + getOpId(), getId(), e);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) 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