]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr / volumes: wrap rmtree() call within try..except block
authorVenky Shankar <vshankar@redhat.com>
Fri, 5 Jul 2019 09:51:54 +0000 (05:51 -0400)
committerRamana Raja <rraja@redhat.com>
Wed, 17 Jul 2019 10:07:37 +0000 (15:37 +0530)
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 <vshankar@redhat.com>
(cherry picked from commit 04547c92c1424c3c17aa84c49bfbfe0ffe4ac781)

src/pybind/mgr/volumes/fs/subvolume.py

index 1c47e947716e77a64d85931cae7ca2bdf5892952..6abbc581c8a8309fd1adcd34d6ccf89dfd820b9f 100644 (file)
@@ -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