mirror of
https://github.com/ceph/ceph
synced 2025-03-31 07:53:23 +00:00
Merge pull request #26622 from Songweibin/wip-fix-rbd-group
rbd: fix segmentation fault when rbd_group_image_list() getting -ENOENT Reviewed-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
commit
a0014efaa3
src
@ -5882,6 +5882,7 @@ extern "C" int rbd_group_image_list(rados_ioctx_t group_p,
|
||||
|
||||
if (r == -ENOENT) {
|
||||
tracepoint(librbd, group_image_list_exit, 0);
|
||||
*image_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2531,6 +2531,12 @@ cdef class Group(object):
|
||||
self._ioctx = convert_ioctx(ioctx)
|
||||
self._name = name
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, type_, value, traceback):
|
||||
return False
|
||||
|
||||
def add_image(self, image_ioctx, image_name):
|
||||
"""
|
||||
Add an image to a group.
|
||||
|
@ -2024,6 +2024,16 @@ class TestGroups(object):
|
||||
self.group.add_image(ioctx, image_name)
|
||||
eq([image_name], [img['name'] for img in self.group.list_images()])
|
||||
|
||||
def test_group_image_list_move_to_trash(self):
|
||||
eq([], list(self.group.list_images()))
|
||||
with Image(ioctx, image_name) as image:
|
||||
image_id = image.id()
|
||||
self.group.add_image(ioctx, image_name)
|
||||
eq([image_name], [img['name'] for img in self.group.list_images()])
|
||||
RBD().trash_move(ioctx, image_name, 0)
|
||||
eq([], list(self.group.list_images()))
|
||||
RBD().trash_restore(ioctx, image_id, image_name)
|
||||
|
||||
def test_group_image_many_images(self):
|
||||
eq([], list(self.group.list_images()))
|
||||
self.group.add_image(ioctx, image_name)
|
||||
|
Loading…
Reference in New Issue
Block a user