JoaoJandre commented on code in PR #9270: URL: https://github.com/apache/cloudstack/pull/9270#discussion_r1740953207
########## server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java: ########## @@ -394,11 +403,35 @@ public Snapshot revertSnapshot(Long snapshotId) { _resourceLimitMgr.decrementResourceCount(snapshot.getAccountId(), ResourceType.primary_storage, new Long(volume.getSize() - snapshot.getSize())); volume.setSize(snapshot.getSize()); _volsDao.update(volume.getId(), volume); + endSnapshotChainForVolume(snapshot.getVolumeId(), snapshot.getHypervisorType()); return snapshotInfo; } return null; } + /** + * Marks the snapshot chain as finished if the volume is on KVM. + * */ + @Override + public void endSnapshotChainForVolume(long volumeId, HypervisorType hypervisorType) { + if (!HypervisorType.KVM.equals(hypervisorType)) { + return; + } + + SnapshotDataStoreVO snapshotOnPrimary = _snapshotStoreDao.findLatestSnapshotForVolume(volumeId, DataStoreRole.Primary); + SnapshotDataStoreVO snapshotOnSecondary = _snapshotStoreDao.findLatestSnapshotForVolume(volumeId, DataStoreRole.Image); + + if (snapshotOnPrimary != null) { + snapshotOnPrimary.setEndOfChain(true); + _snapshotStoreDao.update(snapshotOnPrimary.getId(), snapshotOnPrimary); + } + + if (snapshotOnSecondary != null) { + snapshotOnSecondary.setEndOfChain(true); Review Comment: This is by intended, we should not try to continue the chain from the copy (as it would not be possible), only from the original. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org