Repository: cloudstack
Updated Branches:
  refs/heads/master edf4fe951 -> dbe57c3e5


CLOUDSTACK-9538: FIX failure in Deleting Snapshot From Primary Storage RBD 
Storage if vm has been removed


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

Branch: refs/heads/master
Commit: 784c33585fbce93b363543c362d7b821e5896be8
Parents: 2ebf949
Author: Wei Zhou <[email protected]>
Authored: Thu Oct 13 11:54:43 2016 +0200
Committer: Wei Zhou <[email protected]>
Committed: Mon Oct 17 08:25:34 2016 +0200

----------------------------------------------------------------------
 .../cloudstack/storage/snapshot/XenserverSnapshotStrategy.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/784c3358/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
index 2544484..5771d9f 100644
--- 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
+++ 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
@@ -268,7 +268,9 @@ public class XenserverSnapshotStrategy extends 
SnapshotStrategyBase {
                 SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
                 if (snapshotOnPrimary != null) {
                     SnapshotInfo snapshotOnPrimaryInfo = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
-                    if 
(((PrimaryDataStoreImpl)snapshotOnPrimaryInfo.getDataStore()).getPoolType() == 
StoragePoolType.RBD) {
+                    long volumeId = snapshotOnPrimary.getVolumeId();
+                    VolumeVO volumeVO = volumeDao.findById(volumeId);
+                    if 
(((PrimaryDataStoreImpl)snapshotOnPrimaryInfo.getDataStore()).getPoolType() == 
StoragePoolType.RBD && volumeVO != null) {
                         snapshotSvr.deleteSnapshot(snapshotOnPrimaryInfo);
                     }
                     snapshotOnPrimary.setState(State.Destroyed);

Reply via email to