On Mon, Apr 29, 2019 at 04:39:40PM +0200, Michal Privoznik wrote:
When cloning an RBD volume we try to find a snapshot which is
not different to the image we're trying to clone. This boils down
to calling rbd_diff_iterate() or rbd_diff_iterate2() on systems
with newer ceph. These two are passed a callback -
virStorageBackendRBDIterateCb() which sets @diff to 1 and returns
-1. The idea is to stop iterating as soon as possible (i.e. we're
iterating over a snapshot with some deltas). Unfortunately,
returning a negative value from the callback means that iterate()
function fails and thus we report an error:
virsh # vol-clone --pool rbd_image_root coreos_2023 coreos00.disk
error: Failed to clone vol from coreos_2023
error: failed to iterate RBD snapshot coreos_2023@base: Operation not
permitted
Therefore, report an error if and only if it doesn't originates
in the callback.
Reported on libvirt-users list:
https://www.redhat.com/archives/libvirt-users/2019-April/msg00060.html
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- Ignore error as suggested by Jason as it allows us to exit iteration
early.
src/storage/storage_backend_rbd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano