Damans227 commented on code in PR #13411:
URL: https://github.com/apache/cloudstack/pull/13411#discussion_r4295870825
##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1633,11 +1633,17 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume)
throws ResourceAllocationExc
boolean backupSnapToSecondary =
isBackupSnapshotToSecondaryForZone(volume.getDataCenterId());
if (isKvmAndFileBasedStorage && backupSnapToSecondary) {
- DataStore imageStore =
snapshotSrv.findSnapshotImageStore(snapshot);
- if (imageStore == null) {
- throw new CloudRuntimeException(String.format("Could not find
any secondary storage to allocate snapshot [%s].", snapshot));
+ try {
+ DataStore imageStore =
snapshotSrv.findSnapshotImageStore(snapshot);
+ if (imageStore == null) {
+ throw new CloudRuntimeException(String.format("Could not
find any secondary storage to allocate snapshot [%s].", snapshot));
+ }
+ snapshot.setImageStore(imageStore);
+ } catch (CloudRuntimeException ex) {
+ logger.error("There was an error while selecting image store
for snapshot: {}", ex.getMessage());
+ handleErrorInUncreatedSnapshot(snapshotId);
Review Comment:
should this also give back the snapshot and storage counts the account was
charged? it throws before the catch below that does that, and deleting a
snapshot in error doesnt give them back either
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]