From 52412286c657d384f86441095f5cbef510dd8763 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 4 Dec 2015 08:18:09 +0100 Subject: [PATCH] CLOUDSTACK-8845: set isRevertable of snapshot to false if the volume is removed --- .../snapshot/StorageSystemSnapshotStrategy.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java index 2c71525aad5..d1470e43596 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java @@ -442,6 +442,12 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase { public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) { long volumeId = snapshot.getVolumeId(); VolumeVO volumeVO = _volumeDao.findById(volumeId); + if (SnapshotOperation.REVERT.equals(op)) { + if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat())) + return StrategyPriority.DEFAULT; + else + return StrategyPriority.CANT_HANDLE; + } long storagePoolId; @@ -459,13 +465,6 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase { storagePoolId = volumeVO.getPoolId(); } - if (SnapshotOperation.REVERT.equals(op)) { - if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat())) - return StrategyPriority.DEFAULT; - else - return StrategyPriority.CANT_HANDLE; - } - DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); Map mapCapabilities = dataStore.getDriver().getCapabilities();