GutoVeronezi commented on code in PR #8002:
URL: https://github.com/apache/cloudstack/pull/8002#discussion_r1337129420


##########
services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
##########
@@ -2050,6 +2050,15 @@ protected Answer deleteSnapshot(final DeleteCommand cmd) 
{
                 s_logger.warn(details);
                 return new Answer(cmd, false, details);
             }
+
+            // delete the directory if it is empty
+            if (snapshotDir.isDirectory() && snapshotDir.list().length == 0) {
+                if (!snapshotDir.delete()) {

Review Comment:
   ```suggestion
               // delete the directory if it is empty
               if (snapshotDir.isDirectory() && snapshotDir.list().length == 0 
&& !snapshotDir.delete()) {
   ```



##########
services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
##########
@@ -2050,6 +2050,15 @@ protected Answer deleteSnapshot(final DeleteCommand cmd) 
{
                 s_logger.warn(details);
                 return new Answer(cmd, false, details);
             }
+
+            // delete the directory if it is empty
+            if (snapshotDir.isDirectory() && snapshotDir.list().length == 0) {
+                if (!snapshotDir.delete()) {
+                    details = "Unable to delete directory " + 
snapshotDir.getName() + " at path " + snapshotPath;

Review Comment:
   ```suggestion
                       details = String.format("Unable to delete directory [%s] 
at path [%s].", snapshotDir.getName(), snapshotPath);
   ```



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