Merge branch '4.14'

This commit is contained in:
nvazquez 2020-07-18 14:17:43 -03:00
commit 7e3b61b723
3 changed files with 15 additions and 1 deletions

View File

@ -71,4 +71,6 @@ StateDao<ObjectInDataStoreStateMachine.State, ObjectInDataStoreStateMachine.Even
List<SnapshotDataStoreVO> listAllByVolumeAndDataStore(long volumeId, DataStoreRole role);
List<SnapshotDataStoreVO> listByState(ObjectInDataStoreStateMachine.State... states);
SnapshotDataStoreVO findDestroyedReferenceBySnapshot(long snapshotId, DataStoreRole role);
}

View File

@ -461,6 +461,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
return listBy(sc, null);
}
@Override
public SnapshotDataStoreVO findDestroyedReferenceBySnapshot(long snapshotId, DataStoreRole role) {
SearchCriteria<SnapshotDataStoreVO> sc = snapshotSearch.create();
sc.setParameters("snapshot_id", snapshotId);
sc.setParameters("store_role", role);
sc.setParameters("state", State.Destroyed);
return findOneBy(sc);
}
private boolean isSnapshotChainingRequired(long volumeId) {
hypervisorsSupportingSnapshotsChaining.add(Hypervisor.HypervisorType.XenServer);

View File

@ -1393,8 +1393,11 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
_snapshotDao.remove(destroyedSnapshotStoreVO.getSnapshotId());
SnapshotDataStoreVO snapshotOnPrimary = _snapshotStoreDao.findBySnapshot(destroyedSnapshotStoreVO.getSnapshotId(), DataStoreRole.Primary);
SnapshotDataStoreVO snapshotOnPrimary = _snapshotStoreDao.findDestroyedReferenceBySnapshot(destroyedSnapshotStoreVO.getSnapshotId(), DataStoreRole.Primary);
if (snapshotOnPrimary != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Deleting snapshot on primary store reference DB entry: " + snapshotOnPrimary);
}
_snapshotStoreDao.remove(snapshotOnPrimary.getId());
}
_snapshotStoreDao.remove(destroyedSnapshotStoreVO.getId());