mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix for an issue introduced in this commit: 336df84f1787de962a67d0a34551f9027303040e
(cherry picked from commit c57f556966ab68b5bd91bb0d009a5ae170402e26) Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
This commit is contained in:
parent
ed376fcad6
commit
ccb68e13a7
@ -62,6 +62,7 @@ import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
||||
import org.apache.cloudstack.storage.image.store.TemplateObject;
|
||||
@ -398,9 +399,27 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
s_logger.info("Volume " + vo.getId() + " is not referred anywhere, remove it from volumes table");
|
||||
volDao.remove(vo.getId());
|
||||
}
|
||||
|
||||
SnapshotDataStoreVO snapStoreVo = _snapshotStoreDao.findByVolume(vo.getId(), DataStoreRole.Primary);
|
||||
if(snapStoreVo != null){
|
||||
_snapshotStoreDao.remove(snapStoreVo.getId());
|
||||
|
||||
if (snapStoreVo != null) {
|
||||
long storagePoolId = snapStoreVo.getDataStoreId();
|
||||
StoragePoolVO storagePoolVO = storagePoolDao.findById(storagePoolId);
|
||||
|
||||
if (storagePoolVO.isManaged()) {
|
||||
DataStore primaryDataStore = dataStoreMgr.getPrimaryDataStore(storagePoolId);
|
||||
Map<String, String> mapCapabilities = primaryDataStore.getDriver().getCapabilities();
|
||||
|
||||
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
|
||||
Boolean supportsStorageSystemSnapshots = new Boolean(value);
|
||||
|
||||
if (!supportsStorageSystemSnapshots) {
|
||||
_snapshotStoreDao.remove(snapStoreVo.getId());
|
||||
}
|
||||
}
|
||||
else {
|
||||
_snapshotStoreDao.remove(snapStoreVo.getId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vo.processEvent(Event.OperationFailed);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user