]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: auto-upgrade subvolume test 31763/head
authorVenky Shankar <vshankar@redhat.com>
Tue, 17 Dec 2019 05:55:35 +0000 (00:55 -0500)
committerVenky Shankar <vshankar@redhat.com>
Thu, 9 Jan 2020 11:33:31 +0000 (06:33 -0500)
Fixes: https://tracker.ceph.com/issues/43349
Signed-off-by: Venky Shankar <vshankar@redhat.com>
qa/tasks/cephfs/test_volumes.py

index 1247da956418ee7c12844e31d671adcd9a282544..4b166d00695289fd82ecc39a0d0bf972d648cf76 100644 (file)
@@ -1193,3 +1193,44 @@ class TestVolumes(CephFSTestCase):
         mgr = self.mgr_cluster.get_active_id()
         self.mgr_cluster.mgr_fail(mgr)
         self.wait_until_evicted(sessions[0]['id'])
+
+    def test_subvolume_upgrade(self):
+        """
+        poor man's upgrade test -- rather than going through a full upgrade cycle,
+        emulate subvolumes by going through the wormhole and verify if they are
+        accessible.
+        """
+        subvolume1, subvolume2 = self._generate_random_subvolume_name(2)
+        group = self._generate_random_group_name()
+
+        # emulate a old-fashioned subvolume -- one in the default group and
+        # the other in a custom group
+        createpath1 = os.path.join(".", "volumes", "_nogroup", subvolume1)
+        self.mount_a.run_shell(['mkdir', '-p', createpath1])
+
+        # create group
+        createpath2 = os.path.join(".", "volumes", group, subvolume2)
+        self.mount_a.run_shell(['mkdir', '-p', createpath2])
+
+        # this would auto-upgrade on access without anyone noticing
+        subvolpath1 = self._fs_cmd("subvolume", "getpath", self.volname, subvolume1)
+        self.assertNotEqual(subvolpath1, None)
+        subvolpath1 = subvolpath1.rstrip() # remove "/" prefix and any trailing newline
+
+        subvolpath2 = self._fs_cmd("subvolume", "getpath", self.volname, subvolume2, group)
+        self.assertNotEqual(subvolpath2, None)
+        subvolpath2 = subvolpath2.rstrip() # remove "/" prefix and any trailing newline
+
+        # and... the subvolume path returned should be what we created behind the scene
+        self.assertEqual(createpath1[1:], subvolpath1)
+        self.assertEqual(createpath2[1:], subvolpath2)
+
+        # remove subvolume
+        self._fs_cmd("subvolume", "rm", self.volname, subvolume1)
+        self._fs_cmd("subvolume", "rm", self.volname, subvolume2, group)
+
+        # verify trash dir is clean
+        self._wait_for_trash_empty()
+
+        # remove group
+        self._fs_cmd("subvolumegroup", "rm", self.volname, group)