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_r125422077
 
 

 ##########
 File path: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ##########
 @@ -386,58 +398,53 @@ public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
                     volumeInfo.stateTransit(Volume.Event.OperationFailed);
                 }
             }
+            snapshotOnPrimary = result.getSnapshot();
+            snapshotOnPrimary.addPayload(snapshot.getPayload());
 
-            snapshot = result.getSnapshot();
-            DataStore primaryStore = snapshot.getDataStore();
-            boolean backupFlag = 
Boolean.parseBoolean(configDao.getValue(Config.BackupSnapshotAfterTakingSnapshot.toString()));
-
-            SnapshotInfo backupedSnapshot;
-            if(backupFlag) {
-                backupedSnapshot = backupSnapshot(snapshot);
-            } else {
-                // Fake it to get the transitions to fire in the proper order
-                s_logger.debug("skipping backup of snapshot due to 
configuration "+Config.BackupSnapshotAfterTakingSnapshot.toString());
-
-                SnapshotObject snapObj = (SnapshotObject)snapshot;
-                try {
-                    snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
-                } catch (NoTransitionException e) {
-                    s_logger.debug("Failed to change state: " + 
snapshot.getId() + ": " + e.toString());
-                    throw new CloudRuntimeException(e.toString());
-                }
-                backupedSnapshot = snapshot;
+            /*The Management Server ID is stored in snapshot_details table 
with the snapshot id and (name, value): (MS_ID, <ms_id>), to know which 
snapshots have not been completed in case of some failure situation like
+             *  Mgmt server down etc. and by fetching the entries on restart 
the cleaning up of failed snapshots is done*/
+            
_snapshotDetailsDao.addDetail(((SnapshotObject)snapshotOnPrimary).getId(), 
AsyncJob.Constants.MS_ID, Long.toString(MacAddress.getMacAddress().toLong()), 
false);
 
 Review comment:
   Why the MS ID is always computed from mac address? It is already available 
in DB and there are helper methods to get it
 
----------------------------------------------------------------
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

Reply via email to