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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations