You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/12 13:18:00 UTC

[jira] [Commented] (CLOUDSTACK-10223) Snapshots are not getting deleted when domain is deleted

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577588#comment-16577588 ] 

ASF GitHub Bot commented on CLOUDSTACK-10223:
---------------------------------------------

rafaelweingartner closed pull request #2399: CLOUDSTACK-10223 delete snapshots when deleting domain
URL: https://github.com/apache/cloudstack/pull/2399
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
index a05dc1f560d..0fc217c700b 100644
--- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
+++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java
@@ -34,6 +34,8 @@
 
     List<VolumeVO> findByAccount(long accountId);
 
+    List<VolumeVO> findIncludingRemovedByAccount(long accountId);
+
     Pair<Long, Long> getCountAndTotalByPool(long poolId);
 
     Pair<Long, Long> getNonDestroyedCountAndTotalByPool(long poolId);
diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
index f691e30c743..529e8e66b8b 100644
--- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
@@ -99,6 +99,13 @@
         return listBy(sc);
     }
 
+    @Override
+    public List<VolumeVO> findIncludingRemovedByAccount(long accountId) {
+        SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
+        sc.setParameters("accountId", accountId);
+        return listIncludingRemovedBy(sc);
+    }
+
     @Override
     public List<VolumeVO> findByInstance(long id) {
         SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
diff --git a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index bd49c05f43e..f1adf0ae271 100755
--- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -715,7 +715,7 @@ public String getSecondaryStorageURL(SnapshotVO snapshot) {
     @Override
     public boolean deleteSnapshotDirsForAccount(long accountId) {
 
-        List<VolumeVO> volumes = _volsDao.findByAccount(accountId);
+        List<VolumeVO> volumes = _volsDao.findIncludingRemovedByAccount(accountId);
         // The above call will list only non-destroyed volumes.
         // So call this method before marking the volumes as destroyed.
         // i.e Call them before the VMs for those volumes are destroyed.


 

----------------------------------------------------------------
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:
users@infra.apache.org


> Snapshots are not getting deleted when domain is deleted
> --------------------------------------------------------
>
>                 Key: CLOUDSTACK-10223
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10223
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Sowjanya_Patha
>            Priority: Minor
>
> After domain deletion, snapshot taken by the domain remains undeleted.
> Steps to reproduce:
> -----------------------------------------------
> 1. Create a test domain
> 2. Create test account with admin privileges.
> 3. Login as "test" acoount.
> 4. Create 3 instances - few having root disk and rest with root and data disks both.
> 5. For 2 instances take snapshots of root and data disks
> 6. Expunge above instances from ACP UI.
> 7. Make sure that those vm's should not be shown in ACP UI.
> 8. Login as root user again
> 9. Delete the test account
> 10. Delete the test domain
> Snapshots taken for root volume in step 5 are not deleted.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)