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: v14.2.3~168^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b17eee937d93a08e8960da0066678bfa5cb3fc78;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 (cherry picked from commit 04547c92c1424c3c17aa84c49bfbfe0ffe4ac781) --- diff --git a/src/pybind/mgr/volumes/fs/subvolume.py b/src/pybind/mgr/volumes/fs/subvolume.py index 1c47e947716..6abbc581c8a 100644 --- a/src/pybind/mgr/volumes/fs/subvolume.py +++ b/src/pybind/mgr/volumes/fs/subvolume.py @@ -183,7 +183,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