You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "shwstppr (via GitHub)" <gi...@apache.org> on 2023/05/12 08:34:57 UTC

[GitHub] [cloudstack] shwstppr opened a new pull request, #7524: secondary-storage: delete backedup snapshot dir on delete

shwstppr opened a new pull request, #7524:
URL: https://github.com/apache/cloudstack/pull/7524

   ### Description
   
   Fixes #7516
   
   When a backed-up snapshot is deleted and the snapshot file is present in the same name directory (probably only for VMware), the whole directory can be deleted.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1205193638


##########
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;
+        }

Review Comment:
   ```suggestion
           if (!path.endsWith(snapshotName)) {
               return path + "/*" + snapshotName + "*";
           }
   ```



##########
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 @shwstppr , we are dealing with a `String`, not a `File`/directory. I think this is ok, in this place. checking for existence should not happen in this method.



-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567091027

   @shwstppr a [LL] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] codecov[bot] commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545466884

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/7524?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#7524](https://app.codecov.io/gh/apache/cloudstack/pull/7524?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2a7d875) into [4.18](https://app.codecov.io/gh/apache/cloudstack/commit/a0eb0aa5f7ad07cc45fb3e0d66fddd41437460b7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a0eb0aa) will **decrease** coverage by `0.01%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##               4.18    #7524      +/-   ##
   ============================================
   - Coverage     12.93%   12.93%   -0.01%     
   - Complexity     8941     8942       +1     
   ============================================
     Files          2716     2716              
     Lines        256108   256118      +10     
     Branches      39939    39940       +1     
   ============================================
   + Hits          33127    33128       +1     
   - Misses       218822   218830       +8     
   - Partials       4159     4160       +1     
   ```
   
   
   [see 2 files with indirect coverage changes](https://app.codecov.io/gh/apache/cloudstack/pull/7524/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1557889049

   @shwstppr a [SF] Trillian-Jenkins test job (rocky8 mgmt + vmware-67u3) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567021537

   Packaging result [LL]: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 6057


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567630079

   <b>[LL]Trillian test result (tid-6555)</b>
   Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39470 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6555-xenserver-71.zip
   Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_redundant_vpc_site2site_vpn | `Failure` | 606.12 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Error` | 1204.27 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Error` | 498.28 | test_vpc_vpn.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1559254350

   <b>Trillian test result (tid-6545)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
   Total time taken: 58718 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6545-vmware-67u3.zip
   Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_deploy_vm_on_specific_host | `Error` | 17.71 | test_vm_deployment_planner.py
   test_02_deploy_vm_on_specific_cluster | `Error` | 3603.35 | test_vm_deployment_planner.py
   test_03_deploy_vm_on_specific_pod | `Error` | 4.38 | test_vm_deployment_planner.py
   test_04_deploy_vm_on_host_override_pod_and_cluster | `Error` | 2.42 | test_vm_deployment_planner.py
   test_05_deploy_vm_on_cluster_override_pod | `Error` | 2.36 | test_vm_deployment_planner.py
   test_09_expunge_vm | `Failure` | 425.69 | test_vm_life_cycle.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1557884811

   @blueorangutan test rocky8 vmware-67u3


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1571317873

   <b>[SF] Trillian test result (tid-6635)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39388 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6635-kvm-centos7.zip
   Smoke tests completed. 108 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545919821

   @rohityadavcloud a [LL] Trillian-Jenkins test job (rocky8 mgmt + vmware-67u3) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567284070

   <b>[LL] Trillian Build Failed (tid-6556)<b/>


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567089474

   @blueorangutan LLtest matrix


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1571604220

   <b>[SF] Trillian test result (tid-6634)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
   Total time taken: 54302 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6634-vmware-67u3.zip
   Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_upgrade_kubernetes_cluster | `Failure` | 563.71 | test_kubernetes_clusters.py
   test_01_deploy_vm_on_specific_host | `Error` | 16.69 | test_vm_deployment_planner.py
   test_02_deploy_vm_on_specific_cluster | `Error` | 3604.87 | test_vm_deployment_planner.py
   test_03_deploy_vm_on_specific_pod | `Error` | 1.30 | test_vm_deployment_planner.py
   test_04_deploy_vm_on_host_override_pod_and_cluster | `Error` | 4.36 | test_vm_deployment_planner.py
   test_05_deploy_vm_on_cluster_override_pod | `Error` | 2.33 | test_vm_deployment_planner.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on a diff in pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1546626960

   <b>Trillian test result (tid-6509)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
   Total time taken: 70326 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6509-vmware-67u3.zip
   Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_redundant_vpc_site2site_vpn | `Failure` | 3612.76 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Failure` | 3612.10 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Error` | 3612.19 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Failure` | 3609.33 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Error` | 3609.41 | test_vpc_vpn.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1562513490

   @blueorangutan LLtest rocky8 vmware-67u3


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1566936789

   @shwstppr a [LL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545558283

   @shwstppr a Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545624321

   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 6069


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] weizhouapache commented on a diff in pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1192290042


##########
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:
   @shwstppr 
   would it be safer to check if the path is a directory and there is no files in the directory before deletion ?



-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1557858558

   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 6102


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1563898430

   Packaging result [LL]: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 6056


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1567659283

   <b>[LL]Trillian test result (tid-6557)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 43226 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6557-kvm-centos7.zip
   Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_redundant_VPC_default_routes | `Failure` | 979.95 | test_vpc_redundant.py
   test_01_redundant_vpc_site2site_vpn | `Failure` | 542.32 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Error` | 1185.66 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Error` | 469.65 | test_vpc_vpn.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud merged pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud merged PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud commented on a diff in pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1192510471


##########
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:
   I suppose we need to cover both cases, to check if we're deleting files inside a folder (like in vmware), but also for kvm where snapshots arne't in a folder. XenServer/XCP-ng we need to check.



-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1557670014

   @blueorangutan package


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1562515914

   @DaanHoogland a [LL] Trillian-Jenkins test job (rocky8 mgmt + vmware-67u3) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1566935545

   @blueorangutan LLpackage


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1563855497

   @shwstppr a [LL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud commented on a diff in pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#discussion_r1192510692


##########
services/secondary-storage/server/src/test/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java:
##########
@@ -91,4 +91,21 @@ public void testCleanupStagingNfs() throws Exception{
         testLogAppender.assertMessagesLogged();
 
     }
+
+    private void performGetSnapshotFilepathForDeleteTest(String expected, String path, String name) {
+        Assert.assertEquals("Incorrect resultant snapshot delete path", expected, resource.getSnapshotFilepathForDelete(path, name));
+    }
+
+    @Test
+    public void testGetSnapshotFilepathForDelete() {
+        performGetSnapshotFilepathForDeleteTest("/snapshots/2/10/somename",

Review Comment:
   👍 



-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545916711

   @blueorangutan test rocky8 vmware-67u3


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1545557762

   @blueorangutan package


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1557670606

   @shwstppr a [SF] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] shwstppr commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1563854802

   @blueorangutan LLpackage


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1563922747

   <b>[LL]Trillian test result (tid-6538)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
   Total time taken: 79542 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6538-vmware-67u3.zip
   Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_redundant_vpc_site2site_vpn | `Failure` | 3611.01 | test_vpc_vpn.py
   test_01_redundant_vpc_site2site_vpn | `Error` | 3611.09 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Failure` | 1808.77 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn_multiple_options | `Error` | 1808.82 | test_vpc_vpn.py
   test_01_vpc_remote_access_vpn | `Failure` | 1805.59 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Failure` | 1808.54 | test_vpc_vpn.py
   test_01_vpc_site2site_vpn | `Error` | 1808.59 | test_vpc_vpn.py
   test_01_cancel_host_maintenace_with_no_migration_jobs | `Error` | 1806.82 | test_host_maintenance.py
   test_02_cancel_host_maintenace_with_migration_jobs | `Error` | 1964.70 | test_host_maintenance.py
   test_03_cancel_host_maintenace_with_migration_jobs_failure | `Error` | 1898.01 | test_host_maintenance.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1570597588

   @rohityadavcloud a [SF] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1570595919

   
   @blueorangutan test matrix
   
   


-- 
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-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #7524: secondary-storage: delete backedup snapshot dir on delete

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7524:
URL: https://github.com/apache/cloudstack/pull/7524#issuecomment-1571316208

   <b>[SF] Trillian test result (tid-6633)</b>
   Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39331 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7524-t6633-xenserver-71.zip
   Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_cancel_host_maintenace_with_no_migration_jobs | `Error` | 308.14 | test_host_maintenance.py
   


-- 
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-unsubscribe@cloudstack.apache.org

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