]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/FSCommands: Fix 'fs new' command 34774/head
authorRamana Raja <rraja@redhat.com>
Tue, 14 Apr 2020 11:13:33 +0000 (16:43 +0530)
committerRamana Raja <rraja@redhat.com>
Mon, 27 Apr 2020 15:36:58 +0000 (21:06 +0530)
After creating a filesystem using the 'fs new' command, the value
of the 'data' and 'metadata' key of the datapool and metadatapool's
application tag 'cephfs' should be the filesystem's name. This
didn't happen when the data or metadata pool's application metadata
'cephfs' was enabled before the pool was used in the 'fs new' command.
Fix this during the handling of the 'fs new' command by setting the
value of the key of the pool's application metadata 'cephfs' to the
filesystem's name even when the application metadata 'cephfs' is
already enabled or set.

Fixes: https://tracker.ceph.com/issues/43761
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit 2f45558eb84782e334d997e2c545fd99ab455783)

qa/tasks/cephfs/test_admin.py
src/mon/FSCommands.cc

index ba1cd9ac731876ef5f527938f7177a0195435f68..6f55296e7b8ee4705897ca1d181a5869262c41b4 100644 (file)
@@ -133,6 +133,24 @@ class TestAdminCommands(CephFSTestCase):
         else:
             raise RuntimeError("expected failure")
 
+    def test_fs_new_pool_application_metadata(self):
+        """
+        That the application metadata set on the pools of a newly created filesystem are as expected.
+        """
+        self.fs.delete_all_filesystems()
+        fs_name = "test_fs_new_pool_application"
+        keys = ['metadata', 'data']
+        pool_names = [fs_name+'-'+key for key in keys]
+        mon_cmd = self.fs.mon_manager.raw_cluster_cmd
+        for p in pool_names:
+            mon_cmd('osd', 'pool', 'create', p, str(self.fs.pgs_per_fs_pool))
+            mon_cmd('osd', 'pool', 'application', 'enable', p, 'cephfs')
+        mon_cmd('fs', 'new', fs_name, pool_names[0], pool_names[1])
+        for i in range(2):
+            self._check_pool_application_metadata_key_value(
+                pool_names[i], 'cephfs', keys[i], fs_name)
+
+
 class TestConfigCommands(CephFSTestCase):
     """
     Test that daemons and clients respond to the otherwise rarely-used
index e2099bea81df8b83e80aa9b7ae43aab6ce3127b1..78b2e0826222192671fe3a2ac21741c07195b2d2 100644 (file)
@@ -255,10 +255,10 @@ class FsNewHandler : public FileSystemCommandHandler
     }
     mon->osdmon()->do_application_enable(data,
                                         pg_pool_t::APPLICATION_NAME_CEPHFS,
-                                        "data", fs_name);
+                                        "data", fs_name, true);
     mon->osdmon()->do_application_enable(metadata,
                                         pg_pool_t::APPLICATION_NAME_CEPHFS,
-                                        "metadata", fs_name);
+                                        "metadata", fs_name, true);
     mon->osdmon()->do_set_pool_opt(metadata,
                                   pool_opts_t::RECOVERY_PRIORITY,
                                   static_cast<int64_t>(5));