From bb8df22e4ae851d858b081a47f063a1f33b4d0c9 Mon Sep 17 00:00:00 2001 From: songweibin Date: Mon, 25 Feb 2019 14:58:44 +0800 Subject: [PATCH] rbd/pybind: add __enter__ and __exit__ for class Group Fixes: http://tracker.ceph.com/issues/38468 Signed-off-by: songweibin --- src/pybind/rbd/rbd.pyx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx index 452ef3b7c34..2ff57b3f738 100644 --- a/src/pybind/rbd/rbd.pyx +++ b/src/pybind/rbd/rbd.pyx @@ -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. -- 2.39.5