Search in sources :

Example 61 with DeviceControllerException

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

the class VolumeCreateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        for (URI id : getIds()) {
            switch(status) {
                case error:
                    dbClient.error(Volume.class, id, getOpId(), coded);
                    break;
                default:
                    dbClient.ready(Volume.class, id, getOpId());
            }
            _log.info(String.format("Done VolumeCreate - Id: %s, OpId: %s, status: %s", id.toString(), getOpId(), status.name()));
            // TODO: this may be causing a double event. If so, break this completer out to a workflow version.
            recordBlockVolumeOperation(dbClient, OperationTypeEnum.CREATE_BLOCK_VOLUME, status, id.toString());
        }
    } catch (Exception e) {
        _log.error(String.format("Failed updating status for VolumeCreate - Id: %s, OpId: %s", getId().toString(), getOpId()), e);
    }
}
Also used : URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 62 with DeviceControllerException

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

the class VolumeDeleteCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        List<Volume> volumes = dbClient.queryObject(Volume.class, getIds());
        for (Volume volume : volumes) {
            switch(status) {
                case error:
                    // failure, so we will add such information into the incoming service code message.
                    if (isRollingBack() && (coded instanceof ServiceError)) {
                        ServiceError error = (ServiceError) coded;
                        String originalMessage = error.getMessage();
                        String additionMessage = "Rollback encountered problems cleaning up " + volume.getNativeGuid() + " and may require manual clean up";
                        String updatedMessage = String.format("%s\n%s", originalMessage, additionMessage);
                        error.setMessage(updatedMessage);
                    }
                    dbClient.error(Volume.class, volume.getId(), getOpId(), coded);
                    break;
                default:
                    dbClient.ready(Volume.class, volume.getId(), getOpId());
            }
            _log.info(String.format("Done VolumeDelete - Id: %s, OpId: %s, status: %s", getId().toString(), getOpId(), status.name()));
            // Generate Zero Metering Record only after successful deletion
            if (Operation.Status.ready == status) {
                if (null != volume) {
                    removeDeletedVolumeReference(dbClient, volume);
                }
            }
            recordBlockVolumeOperation(dbClient, OperationTypeEnum.DELETE_BLOCK_VOLUME, status, volume.getId().toString());
        }
        if (status.equals(Operation.Status.ready) || (status.equals(Operation.Status.error) && isRollingBack())) {
            for (Volume volume : volumes) {
                volume.setConsistencyGroup(NullColumnValueGetter.getNullURI());
            }
            dbClient.markForDeletion(volumes);
        }
    } catch (Exception e) {
        _log.error(String.format("Failed updating status for VolumeDelete - Id: %s, OpId: %s", getIds().toString(), getOpId()), e);
    } finally {
        super.complete(dbClient, status, coded);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 63 with DeviceControllerException

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

the class VolumeExpandCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        Volume volume = dbClient.queryObject(Volume.class, getId());
        if (Operation.Status.ready == status) {
            dbClient.ready(Volume.class, getId(), getOpId());
            _log.info(String.format("Done VolumeExpand - Volume Id: %s, NativeId: %s, OpId: %s, status: %s, New size: %d", getId().toString(), volume.getNativeId(), getOpId(), status.name(), _size));
        } else if (Operation.Status.error == status) {
            dbClient.error(Volume.class, getId(), getOpId(), coded);
            _log.info(String.format("VolumeExpand failed - Volume Id: %s, NativeId: %s, OpId: %s, status: %s, New size: %d", getId().toString(), volume.getNativeId(), getOpId(), status.name(), _size));
        }
        recordBlockVolumeOperation(dbClient, OperationTypeEnum.EXPAND_BLOCK_VOLUME, status, getId().toString(), String.valueOf(_size));
    } catch (Exception e) {
        _log.error(String.format("Failed updating status for VolumeExpand - Volume Id: %s, OpId: %s", getId().toString(), getOpId()), e);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 64 with DeviceControllerException

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

the class VplexMirrorDeactivateCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        super.complete(dbClient, status, coded);
        VplexMirror mirror = dbClient.queryObject(VplexMirror.class, getMirrorURI());
        Volume sourceVplexVolume = dbClient.queryObject(Volume.class, mirror.getSource());
        switch(status) {
            case error:
                dbClient.error(VplexMirror.class, mirror.getId(), getOpId(), coded);
                dbClient.error(Volume.class, sourceVplexVolume.getId(), getOpId(), coded);
                break;
            default:
                _log.info("Removing mirror {} from source volume {}", mirror.getId().toString(), sourceVplexVolume.getId().toString());
                sourceVplexVolume.getMirrors().remove(mirror.getId().toString());
                dbClient.persistObject(sourceVplexVolume);
                if (mirror.getAssociatedVolumes() != null && !mirror.getAssociatedVolumes().isEmpty()) {
                    for (String volumeUri : mirror.getAssociatedVolumes()) {
                        Volume assocVolume = dbClient.queryObject(Volume.class, URI.create(volumeUri));
                        if (assocVolume != null && !assocVolume.getInactive()) {
                            dbClient.markForDeletion(assocVolume);
                        }
                    }
                }
                dbClient.markForDeletion(mirror);
                dbClient.ready(VplexMirror.class, mirror.getId(), getOpId());
                dbClient.ready(Volume.class, sourceVplexVolume.getId(), getOpId());
        }
        recordVplexMirrorOperation(dbClient, OperationTypeEnum.DEACTIVATE_VOLUME_MIRROR, status, eventMessage(status, sourceVplexVolume, mirror), mirror, sourceVplexVolume);
    } catch (Exception e) {
        _log.error("Failed updating status. VplexMirrorDeactivate {}, for task " + getOpId(), getId(), e);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) VplexMirror(com.emc.storageos.db.client.model.VplexMirror) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 65 with DeviceControllerException

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

the class ZoningRemovePathsCompleter method complete.

@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
    try {
        if (status == Operation.Status.ready && !exportMaskAdjustedPathMap.isEmpty()) {
            for (Map.Entry<URI, Map<URI, List<URI>>> maskPathEntry : exportMaskAdjustedPathMap.entrySet()) {
                URI maskURI = maskPathEntry.getKey();
                Map<URI, List<URI>> zoningPaths = maskPathEntry.getValue();
                ExportMask exportMask = dbClient.queryObject(ExportMask.class, maskURI);
                // update zoning map
                StringSetMap zoningMap = exportMask.getZoningMap();
                zoningMap.clear();
                for (Map.Entry<URI, List<URI>> zoningPath : zoningPaths.entrySet()) {
                    zoningMap.put(zoningPath.getKey().toString(), StringSetUtil.uriListToStringSet(zoningPath.getValue()));
                }
                dbClient.updateObject(exportMask);
            }
        }
    } catch (Exception e) {
        log.error(String.format("Failed updating status for ZoningRemovePaths - Id: %s, OpId: %s", getId().toString(), getOpId()), e);
    } finally {
        super.complete(dbClient, status, coded);
    }
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) ExportMask(com.emc.storageos.db.client.model.ExportMask) List(java.util.List) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) URI(java.net.URI) 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