]> 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)
committerVenky Shankar <vshankar@redhat.com>
Mon, 8 Jul 2019 03:58:16 +0000 (23:58 -0400)
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>
src/pybind/mgr/volumes/fs/subvolume.py

index 39018b566b4e95a77d10fe917674f5f71c3d4d4a..016b00fa69daf33be277aafba80e4dbd68d64bf3 100644 (file)
@@ -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