CLOUDSTACK-7966:
remove snapshot_store_ref entry, in which role is Primary, during
storage GC

(cherry picked from commit 7175247c5e10eb6c152b2629e5496337e3287afd)
Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3006f5cc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3006f5cc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3006f5cc

Branch: refs/heads/4.4
Commit: 3006f5cc83f0ecd88cb51b30efeb839121ccbae9
Parents: 404a5e7
Author: Edison Su <[email protected]>
Authored: Mon Nov 24 14:25:29 2014 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Thu Dec 11 20:28:15 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3006f5cc/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java 
b/server/src/com/cloud/storage/StorageManagerImpl.java
index 1cdf54e..fafd002 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1150,6 +1150,10 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
                         }
 
                         
_snapshotDao.remove(destroyedSnapshotStoreVO.getSnapshotId());
+                        SnapshotDataStoreVO snapshotOnPrimary = 
_snapshotStoreDao.findBySnapshot(destroyedSnapshotStoreVO.getSnapshotId(), 
DataStoreRole.Primary);
+                        if (snapshotOnPrimary != null) {
+                            
_snapshotStoreDao.remove(snapshotOnPrimary.getId());
+                        }
                         
_snapshotStoreDao.remove(destroyedSnapshotStoreVO.getId());
                     }
 

Reply via email to