JoaoJandre commented on code in PR #9270:
URL: https://github.com/apache/cloudstack/pull/9270#discussion_r1734995660


##########
server/src/main/java/org/apache/cloudstack/snapshot/SnapshotHelper.java:
##########
@@ -264,4 +264,12 @@ protected Set<Long> 
getSnapshotIdsOnlyInPrimaryStorage(long volumeId) {
 
         return snapshotIdsOnlyInPrimaryStorage;
     }
+
+    public SnapshotInfo convertSnapshotIfNeeded(SnapshotInfo snapshotInfo) {
+        if (snapshotInfo.getParent() == null || 
!HypervisorType.KVM.equals(snapshotInfo.getHypervisorType())) {
+            return snapshotInfo;
+        }
+
+        return snapshotService.convertSnapshot(snapshotInfo);

Review Comment:
   @slavkap In the latest commit I changed the copied snapshots' name to match 
the original, but that should not matter for this issue, in any case, I have 
done the following test, in an env with two zones:
   1. Create a VM in zone 'A';
   2. Create two snapshots, marking them to be copied zone 'B' as well;
   Got the following results on storage:
   ```
   root@management:/mnt/sec-nfs# ls -lah snapshots/2/85/
   total 3.2G
   drwxr-xr-x 2 nobody nogroup 4.0K Aug 28 16:34 .
   drwxr-xr-x 6 nobody nogroup 4.0K Aug 28 16:30 ..
   -rw-r--r-- 1 nobody nogroup 3.2G Aug 28 16:30 
25ced820-28c1-4bee-b41a-b03ebdbd1f76
   -rw-r--r-- 1 nobody nogroup 3.0M Aug 28 16:31 
57199f60-afd0-424b-9313-9bda9afe34ca
   root@management:/mnt/sec-nfs# ls -lah sec-2/snapshots/2/85/
   total 6.4G
   drwxrwxrwx 2 nobody nogroup 4.0K Aug 28 16:32 .
   drwxrwxrwx 4 nobody nogroup 4.0K Aug 28 16:30 ..
   -rw-rw-rw- 1 nobody nogroup 3.2G Aug 28 16:31 
25ced820-28c1-4bee-b41a-b03ebdbd1f76
   -rw-rw-rw- 1 nobody nogroup 3.2G Aug 28 16:32 
57199f60-afd0-424b-9313-9bda9afe34ca
   ```
   3. Then I created a template from the second snapshot, I saw that a 
temporary file was created, but after the process finished the file as deleted, 
and the storage returned to the above scenario.
   



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to