You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by li jerry <di...@hotmail.com> on 2020/10/28 00:31:58 UTC

回复: Failed to create VOLUME from snapshot

Hi Nicolas Vazquez

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

-Jerry

发件人: Nicolas Vazquez<ma...@shapeblue.com>
发送时间: 2020年10月27日 23:37
收件人: dev@cloudstack.apache.org<ma...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 10:58 AM
To: dev@cloudstack.apache.org <de...@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.Vazquez@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
@shapeblue




Re: Failed to create VOLUME from snapshot

Posted by Rakesh Venkatesh <ww...@gmail.com>.
I was able to reproduce it as well

If the setting snapshot.backup.to.secondary = false then only one entry
will be stored in snapshot_store_ref with primary datarole and
secondary(Image) datarole will not be stored.
So in the volume orchestrator, it tries to get the driver capability map
and that returns DataRole.Image as the option. Since that doesnt exist, it
cant get the path and NPE is thrown

On Wed, Oct 28, 2020 at 4:38 PM Nicolas Vazquez <
Nicolas.Vazquez@shapeblue.com> wrote:

> 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 <di...@hotmail.com>
> Sent: Wednesday, October 28, 2020 1:55 AM
> To: dev@cloudstack.apache.org <de...@cloudstack.apache.org>
> Subject: 回复: Failed to create VOLUME from snapshot
>
> Please look here https://github.com/apache/cloudstack/issues/4433
>
>
> -----邮件原件-----
> 发件人: Nicolas Vazquez <Ni...@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 <di...@hotmail.com>
> Sent: Tuesday, October 27, 2020 9:31 PM
> To: dev@cloudstack.apache.org <de...@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<ma...@shapeblue.com>
> 发送时间: 2020年10月27日 23:37
> 收件人: dev@cloudstack.apache.org<ma...@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 <di...@hotmail.com>
> Sent: Tuesday, October 27, 2020 10:58 AM
> To: dev@cloudstack.apache.org <de...@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.Vazquez@shapeblue.com
> www.shapeblue.com<http://www.shapeblue.com>
> 3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
> @shapeblue
>
>
>
>
> Nicolas.Vazquez@shapeblue.com
> www.shapeblue.com<http://www.shapeblue.com>
> 3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
> @shapeblue
>
>
>
>
> Nicolas.Vazquez@shapeblue.com
> www.shapeblue.com
> 3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
> @shapeblue
>
>
>
>

-- 
Thanks and regards
Rakesh venkatesh

Re: Failed to create VOLUME from snapshot

Posted by Nicolas Vazquez <Ni...@shapeblue.com>.
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 <di...@hotmail.com>
Sent: Wednesday, October 28, 2020 1:55 AM
To: dev@cloudstack.apache.org <de...@cloudstack.apache.org>
Subject: 回复: Failed to create VOLUME from snapshot

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


-----邮件原件-----
发件人: Nicolas Vazquez <Ni...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 9:31 PM
To: dev@cloudstack.apache.org <de...@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<ma...@shapeblue.com>
发送时间: 2020年10月27日 23:37
收件人: dev@cloudstack.apache.org<ma...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 10:58 AM
To: dev@cloudstack.apache.org <de...@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.Vazquez@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK @shapeblue




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




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


回复: Failed to create VOLUME from snapshot

Posted by li jerry <di...@hotmail.com>.
Please look here https://github.com/apache/cloudstack/issues/4433


-----邮件原件-----
发件人: Nicolas Vazquez <Ni...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 9:31 PM
To: dev@cloudstack.apache.org <de...@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<ma...@shapeblue.com>
发送时间: 2020年10月27日 23:37
收件人: dev@cloudstack.apache.org<ma...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 10:58 AM
To: dev@cloudstack.apache.org <de...@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.Vazquez@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK @shapeblue




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


Re: Failed to create VOLUME from snapshot

Posted by Nicolas Vazquez <Ni...@shapeblue.com>.
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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 9:31 PM
To: dev@cloudstack.apache.org <de...@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<ma...@shapeblue.com>
发送时间: 2020年10月27日 23:37
收件人: dev@cloudstack.apache.org<ma...@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 <di...@hotmail.com>
Sent: Tuesday, October 27, 2020 10:58 AM
To: dev@cloudstack.apache.org <de...@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.Vazquez@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
@shapeblue




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