]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/volumes: fix `subvolume group rm` error message
authorneeraj pratap singh <neerajpratapsingh@li-ff7f0d4c-3462-11b2-a85c-d4004c0fa1a0.ibm.com>
Mon, 25 Sep 2023 11:02:31 +0000 (16:32 +0530)
committerneeraj pratap singh <neerajpratapsingh@li-ff7f0d4c-3462-11b2-a85c-d4004c0fa1a0.ibm.com>
Wed, 11 Oct 2023 07:40:51 +0000 (13:10 +0530)
Currently, if we try to delete subvolumegroup using `fs subvolumegroup rm`
when there's one or more subvolume(s) present under that subvolumegroup we
see the error something like :
`Error ENOTEMPTY: error in rmdir /volumes/group1`
which causes confusion. Make it more descriptive

Fixes: https://tracker.ceph.com/issues/62968
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
src/pybind/mgr/volumes/fs/operations/group.py

index 8b40610332dce36c8263e2e339f1af8fd32e9c67..efc10e0797aa29377b469bef3105261787f27562 100644 (file)
@@ -269,6 +269,9 @@ def remove_group(fs, vol_spec, groupname):
     except cephfs.Error as e:
         if e.args[0] == errno.ENOENT:
             raise VolumeException(-errno.ENOENT, "subvolume group '{0}' does not exist".format(groupname))
+        elif e.args[0] == errno.ENOTEMPTY:
+            raise VolumeException(-errno.ENOTEMPTY, f"subvolume group {groupname} contains subvolume(s) "
+                                  "or retained snapshots of deleted subvolume(s)")
         raise VolumeException(-e.args[0], e.args[1])