From 04547c92c1424c3c17aa84c49bfbfe0ffe4ac781 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 5 Jul 2019 05:51:54 -0400 Subject: [PATCH] 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 --- src/pybind/mgr/volumes/fs/subvolume.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/volumes/fs/subvolume.py b/src/pybind/mgr/volumes/fs/subvolume.py index 39018b566b4..016b00fa69d 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 -- 2.39.5