CLOUDSTACK-8845: set isRevertable of snapshot to false if the volume is removed

This commit is contained in:
Wei Zhou 2015-12-04 08:18:09 +01:00
parent 9a21873c4a
commit 52412286c6
1 changed files with 6 additions and 7 deletions

View File

@ -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<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();