From: Venky Shankar Date: Fri, 5 Jul 2019 09:51:54 +0000 (-0400) Subject: mgr / volumes: wrap rmtree() call within try..except block X-Git-Tag: v15.1.0~2189^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=04547c92c1424c3c17aa84c49bfbfe0ffe4ac781;p=ceph.git mgr / volumes: wrap rmtree() call within try..except block This will be invoked by purge threads, so be sure to catch all exceptions and return proper error codes appropriately. Signed-off-by: Venky Shankar --- diff --git a/src/pybind/mgr/volumes/fs/subvolume.py b/src/pybind/mgr/volumes/fs/subvolume.py index 39018b566b4e..016b00fa69da 100644 --- a/src/pybind/mgr/volumes/fs/subvolume.py +++ b/src/pybind/mgr/volumes/fs/subvolume.py @@ -159,7 +159,11 @@ class SubVolume(object): self.fs.rmdir(root_path) trashpath = spec.trash_path - rmtree(trashpath) + # catch any unlink errors + try: + rmtree(trashpath) + except cephfs.Error as e: + raise VolumeException(-e.args[0], e.args[1]) def get_subvolume_path(self, spec): path = spec.subvolume_path