koushik-das commented on a change in pull request #2081: CLOUDSTACK-9894
Separate creation and backup operations for a volume snapshot
URL: https://github.com/apache/cloudstack/pull/2081#discussion_r123685018
##########
File path: server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
##########
@@ -1123,6 +1150,39 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume)
throws ResourceAllocationExc
return snapshot;
}
+ protected class BackupSnapshotTask extends ManagedContextRunnable {
+ SnapshotInfo snapshot;
+ int maxAttempts;
+ SnapshotStrategy snapshotStrategy;
+
+ public BackupSnapshotTask(SnapshotInfo snap, int maxRetries,
SnapshotStrategy strategy) {
+ snapshot = snap;
+ maxAttempts = maxRetries;
+ snapshotStrategy = strategy;
+ }
+
+ @Override
+ protected void runInContext() {
+ try {
+ s_logger.debug("Value of attempts is " + maxAttempts);
+
+ SnapshotInfo backupedSnapshot =
snapshotStrategy.backupSnapshot(snapshot);
+
+ if (backupedSnapshot != null) {
+ snapshotStrategy.cleanSnapshotAfterCreation(snapshot);
+ }
+ } catch (final Exception e) {
+ if (maxAttempts >= 0) {
+ s_logger.debug("Attempt failed, in retrying backup");
Review comment:
Add more information in the log message, like backup attempt failed for
which snapshot, how many attempts left for retry etc.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services