Hello All Dev User
I use CLOUDSTACK 4.14.0.0, KVMCEPH RBD primary storage and NFS secondary 
storage;

When creating a new VOLUME through a VOLUME snapshot,
Only the first snapshot of each VOLUME is successful;
No other snapshots of the same VOLUME can create a new VOLUME


Steps to reproduce:
1. Create a VOLUME snapshot;
2. Create VOLUME from the volume snapshot (successful);
3. Create a VOLUME snapshot;
4. Create VOLUME from volume snapshot (failure);

I looked at the code and found that when I was looking for storage through 
snapshots,
The snapshot ID and the VOLUME ID corresponding to the snapshot are used for 
query.

So I adjusted the query in the code:
apache-cloudstack-4.14.0.0-src/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.java
    @Override
    public SnapshotInfo getSnapshot(long snapshotId, DataStoreRole role) {
        SnapshotVO snapshot = snapshotDao.findById(snapshotId);
        SnapshotDataStoreVO snapshotStore = 
snapshotStoreDao.findBySnapshot(snapshotId, role);
        if (snapshotStore == null) {
            return null;
//            snapshotStore = 
snapshotStoreDao.findByVolume(snapshot.getVolumeId(), role);
//            if (snapshotStore == null) {
//                return null;
//            }
            //end
        }
        DataStore store = storeMgr.getDataStore(snapshotStore.getDataStoreId(), 
role);
        SnapshotObject so = SnapshotObject.getSnapshotObject(snapshot, store);
        return so;
    }

Does anyone have a better solution?

Thank you!


-Jerry

Reply via email to