Thanks Jerry,

I was able to reproduce the issue under NFS as well. Thanks for creating the 
issue on Github, it can be then assigned to a PR to fix in the next 4.14.1 
version.


Regards,

Nicolas Vazquez

________________________________
From: li jerry <div...@hotmail.com>
Sent: Wednesday, October 28, 2020 1:55 AM
To: dev@cloudstack.apache.org <dev@cloudstack.apache.org>
Subject: 回复: Failed to create VOLUME from snapshot

Please look here https://github.com/apache/cloudstack/issues/4433


-----邮件原件-----
发件人: Nicolas Vazquez <nicolas.vazq...@shapeblue.com>
发送时间: 2020年10月28日 12:35
收件人: dev@cloudstack.apache.org
主题: Re: Failed to create VOLUME from snapshot

Thanks Jerry,

I would like to understand in which part of the code the failure was, can you 
post the management server error stack trace before your fix? I think that 
instead of commenting out the findByVolume search you could try evaluating the 
global setting value and branch the code, so you don't break the compatibility 
when the setting is set to true.


Regards,

Nicolas Vazquez

________________________________
From: li jerry <div...@hotmail.com>
Sent: Tuesday, October 27, 2020 9:31 PM
To: dev@cloudstack.apache.org <dev@cloudstack.apache.org>
Subject: 回复: Failed to create VOLUME from snapshot

Hi Nicolas Vazquez

Forget to add
My global snapshot.backup.to.secondary = false

-Jerry

发件人: Nicolas Vazquez<mailto:nicolas.vazq...@shapeblue.com>
发送时间: 2020年10月27日 23:37
收件人: dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>
主题: Re: Failed to create VOLUME from snapshot

Hi Jerry,

I currently don't have a Ceph setup to reproduce the issue, but I guess the 
issue was caused by some NullPointerException around the code you have 
commented out? Can you open a new pull request with your changes along with the 
error stack trace from the management server log?


Regards,

Nicolas Vazquez

________________________________
From: li jerry <div...@hotmail.com>
Sent: Tuesday, October 27, 2020 10:58 AM
To: dev@cloudstack.apache.org <dev@cloudstack.apache.org>
Subject: Failed to create VOLUME from snapshot

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


nicolas.vazq...@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK @shapeblue




nicolas.vazq...@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK @shapeblue




nicolas.vazq...@shapeblue.com 
www.shapeblue.com
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
@shapeblue
  
 

Reply via email to