cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] wido commented on a change in pull request #3122: Add back ability to disable backup of snapshot to secondary
Date Tue, 08 Jan 2019 11:05:10 GMT
wido commented on a change in pull request #3122: Add back ability to disable backup of snapshot
to secondary
URL: https://github.com/apache/cloudstack/pull/3122#discussion_r245956538
 
 

 ##########
 File path: server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
 ##########
 @@ -1123,12 +1123,24 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationExc
             }
 
             SnapshotInfo snapshotOnPrimary = snapshotStrategy.takeSnapshot(snapshot);
-            if (payload.getAsyncBackup()) {
-                backupSnapshotExecutor.schedule(new BackupSnapshotTask(snapshotOnPrimary,
snapshotBackupRetries - 1, snapshotStrategy), 0, TimeUnit.SECONDS);
+            boolean backupFlag = BackupSnapshotAfterTakingSnapshot.value() == null ||
+                    BackupSnapshotAfterTakingSnapshot.value();
+
+            if (backupFlag) {
+                if (payload.getAsyncBackup()) {
+                    backupSnapshotExecutor.schedule(new BackupSnapshotTask(snapshotOnPrimary,
snapshotBackupRetries - 1, snapshotStrategy), 0, TimeUnit.SECONDS);
+                } else {
+                    SnapshotInfo backupedSnapshot = snapshotStrategy.backupSnapshot(snapshotOnPrimary);
+                    if (backupedSnapshot != null) {
+                        snapshotStrategy.postSnapshotCreation(snapshotOnPrimary);
+                    }
+                }
             } else {
-                SnapshotInfo backupedSnapshot = snapshotStrategy.backupSnapshot(snapshotOnPrimary);
-                if (backupedSnapshot != null) {
-                    snapshotStrategy.postSnapshotCreation(snapshotOnPrimary);
+                if(s_logger.isDebugEnabled()) {
+                    s_logger.debug("skipping backup of snapshot to secondary due to configuration");
+                }
+                if (!snapshotOnPrimary.markBackedUp()) {
+                    throw new CloudRuntimeException("Can't mark snapshot as backed up!");
 
 Review comment:
   Same applies here. Maybe add the snapshot name, volume ID, 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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message