]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: subvolume ls command crashes if groupname as '_nogroup' 46636/head
authorNikhilkumar Shelke <nshelke@redhat.com>
Sun, 12 Jun 2022 16:33:21 +0000 (22:03 +0530)
committerNikhilkumar Shelke <nshelke@redhat.com>
Tue, 14 Jun 2022 07:04:51 +0000 (12:34 +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>
qa/tasks/cephfs/test_volumes.py

index 2ae4674dbca71343bc8ac7de448c3961e4626277..4705eaae6c754af463fc6ee42ca69bae612e478c 100644 (file)
@@ -1214,6 +1214,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.