mirror of https://github.com/apache/cloudstack.git
Merge pull request #1168 from ustcweizhou/listSnapshots-Exception
CLOUDSTACK-8845: set isRevertable of snapshot to false if the volume is removedSome users encounter an exception when listSnapshots. We should set the isRevertable of snapshot to false if the original volume is removed, without checking if the snapshot is stored in primary store (the exception was thowned during the checking). * pr/1168: CLOUDSTACK-8845: set isRevertable of snapshot to false if the volume is removed Signed-off-by: Daan Hoogland <daan@onecht.net>
This commit is contained in:
commit
24113e425e
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue