shwstppr commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1192305234


##########
services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
##########
@@ -1997,6 +1997,17 @@ private void savePostUploadPSK(String psk) {
         }
     }
 
+    protected String getSnapshotFilepathForDelete(String path, String 
snapshotName) {
+        String finalPath = path + "/*" + snapshotName + "*";
+        if (!path.endsWith(snapshotName)) {
+            return finalPath;
+        }
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug(String.format("Snapshot file %s is present in the 
same name directory %s. Deleting the directory", snapshotName, path));
+        }
+        return path;
+    }

Review Comment:
   @weizhouapache directory check be added but we always expect it to be a 
directory anyway as we append the `/*SNAPSHOT_NAME*
   
   And there will always be files (I checked  VMware, Xen and KVM. Snapshots 
are placed inside the same name folder **only for VMWare**). Example
   
   ```
   [root@sl-nestednfs snapshots]# tree 2/10/
   2/10/
   └── fd57cb44-0559-490c-998d-5313eec52cef
       ├── fd57cb44-0559-490c-998d-5313eec52cef-disk0.vmdk
       ├── fd57cb44-0559-490c-998d-5313eec52cef-disk1.nvram
       └── fd57cb44-0559-490c-998d-5313eec52cef.ovf
   ```



-- 
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]

Reply via email to