]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: subvolume ls command crashes if groupname as '_nogroup' 46806/head
authorNikhilkumar Shelke <nshelke@redhat.com>
Sun, 12 Jun 2022 16:33:21 +0000 (22:03 +0530)
committerNikhilkumar Shelke <nshelke@redhat.com>
Thu, 23 Jun 2022 08:38:47 +0000 (14:08 +0530)
If --group_name=_nogroup is provided in the command then
throw error permission denied as it is internal group of ceph fs.

Fixes: https://tracker.ceph.com/issues/55759
Signed-off-by: Nikhilkumar Shelke <nshelke@redhat.com>
(cherry picked from commit dc4b0ee40502c34e483320e7a69b7c0e288294ae)

qa/tasks/cephfs/test_volumes.py

index 87f88cae2e736872006a29ed03b3a72206404d35..af86fd48f6c54fab3e3b73b4cb983f3aacf73296 100644 (file)
@@ -1946,6 +1946,41 @@ class TestSubvolumes(TestVolumesHelper):
         # verify trash dir is clean
         self._wait_for_trash_empty()
 
+    def test_subvolume_create_and_ls_providing_group_as_nogroup(self):
+        """
+        That a 'subvolume create' and 'subvolume ls' should throw
+        permission denied error if option --group=_nogroup is provided.
+        """
+
+        subvolname = self._generate_random_subvolume_name()
+
+        # try to create subvolume providing --group_name=_nogroup option
+        try:
+            self._fs_cmd("subvolume", "create", self.volname, subvolname, "--group_name", "_nogroup")
+        except CommandFailedError as ce:
+            self.assertEqual(ce.exitstatus, errno.EPERM)
+        else:
+            self.fail("expected the 'fs subvolume create' command to fail")
+
+        # create subvolume
+        self._fs_cmd("subvolume", "create", self.volname, subvolname)
+
+        # try to list subvolumes providing --group_name=_nogroup option
+        try:
+            self._fs_cmd("subvolume", "ls", self.volname, "--group_name", "_nogroup")
+        except CommandFailedError as ce:
+            self.assertEqual(ce.exitstatus, errno.EPERM)
+        else:
+            self.fail("expected the 'fs subvolume ls' command to fail")
+
+        # list subvolumes
+        self._fs_cmd("subvolume", "ls", self.volname)
+
+        self._fs_cmd("subvolume", "rm", self.volname, subvolname)
+
+        # verify trash dir is clean.
+        self._wait_for_trash_empty()
+
     def test_subvolume_expand(self):
         """
         That a subvolume can be expanded in size and its quota matches the expected size.