]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd/api/Mirror: return EINVAL from image_get_mode()
authorRamana Raja <rraja@redhat.com>
Mon, 5 May 2025 17:31:34 +0000 (13:31 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 23 Jun 2025 07:35:55 +0000 (09:35 +0200)
commite5269a6f2acd66b0637b0d1183fa06e314a53b21
tree5594cff8ba338342e167eb7f77824636bc40aaa0
parent283ba2e6c88470f52bee765ea96c40ac66f26f36
librbd/api/Mirror: return EINVAL from image_get_mode()

... when the image is disabled for mirroring.

When an image is disabled for mirroring, fetching the image's
mirroring mode is invalid. So, modify the Mirror::image_get_mode()
internal API to return EINVAL instead of success when mirroring is
disabled.

The Mirror::image_get_mode() method is called by the public C++, C, and
Python APIs that fetch the mirroring mode of an image. The behavior of
these public APIs will change. They will return an error code or raise
an exception indicating that it's an invalid operation to fetch the
image's mirroring mode when mirroring is disabled.

Fixes: https://tracker.ceph.com/issues/71226
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit 479014e372a994813d8820e59f69479acc7ea06b)
PendingReleaseNotes
src/librbd/api/Mirror.cc
src/test/librbd/test_librbd.cc
src/test/librbd/test_mirroring.cc
src/test/pybind/test_rbd.py