pybind/rbd: handle non-existent groups properly in list_snaps()
Calling `list_snaps()` on a non-existent group crashed the entire Python process with a `free(): invalid pointer` error. This happened because an unexpected `-ENOENT` error returned by `rbd_group_snap_list2` and the exception was raised without updating the num_group_snaps to 0 from 10. Later the Cython `__dealloc__` wrapper attempted to free garbage of uninitialized pointer spaces resulting in a crash. Fix this behavior by resetting `self.num_group_snaps` to 0 inside `GroupSnapIterator` before raising exception to prevent memory corruption and accessing uninitialized pointers during cleanup call Now `list_snaps()` consistently raise an `ObjectNotFound` error when invoked on a non-existent group. Also Extended the `TestGroups` test fixture with `self.dne_group` to validate the expected error path for `list_snaps()`. Fixes: https://tracker.ceph.com/issues/78034 Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
V
VinayBhaskar-V committed
56bcf706cf91f0734899ae9de378c459a9b5af50
Parent: 27060dc