mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CE-113 trace logging and rethrow instead of nesting CloudRuntimeException
This commit is contained in:
parent
d96b3cd19c
commit
c689d4a696
@ -282,6 +282,9 @@ public class SnapshotServiceImpl implements SnapshotService {
|
||||
try {
|
||||
SnapshotResult res = future.get();
|
||||
if (res.isFailed()) {
|
||||
// TODO add cleanup actions in this case
|
||||
// TODO think of whether a runtime exception is really what we want]
|
||||
|
||||
throw new CloudRuntimeException(res.getResult());
|
||||
}
|
||||
SnapshotInfo destSnapshot = res.getSnapshot();
|
||||
|
||||
@ -1993,8 +1993,14 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
SnapshotInfo snapshot = null;
|
||||
try {
|
||||
snapshot = snapshotMgr.takeSnapshot(volume);
|
||||
} catch (CloudRuntimeException cre) {
|
||||
s_logger.error("Take snapshot: " + volume.getId() + " failed", cre);
|
||||
// TODO deal with cleaning the mess
|
||||
throw cre;
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Take snapshot: " + volume.getId() + " failed", e);
|
||||
if(s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("unknown exception while taking snapshot for volume " + volume.getId() + " was caught", e);
|
||||
}
|
||||
throw new CloudRuntimeException("Failed to take snapshot", e);
|
||||
}
|
||||
|
||||
|
||||
@ -1114,8 +1114,17 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("post process snapshot failed", e);
|
||||
}
|
||||
} catch (CloudRuntimeException cre) {
|
||||
if(s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Failed to create snapshot" + cre.getLocalizedMessage());
|
||||
}
|
||||
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
|
||||
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize()));
|
||||
throw cre;
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to create snapshot", e);
|
||||
if(s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Failed to create snapshot", e);
|
||||
}
|
||||
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
|
||||
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize()));
|
||||
throw new CloudRuntimeException("Failed to create snapshot", e);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user