]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add symbolic link synchronization test for cephfs-mirror 40004/head
authorVenky Shankar <vshankar@redhat.com>
Wed, 10 Mar 2021 13:40:40 +0000 (08:40 -0500)
committerVenky Shankar <vshankar@redhat.com>
Fri, 12 Mar 2021 08:53:42 +0000 (03:53 -0500)
Fixes: http://tracker.ceph.com/issues/49711
Signed-off-by: Venky Shankar <vshankar@redhat.com>
qa/tasks/cephfs/mount.py
qa/tasks/cephfs/test_mirroring.py

index 50cd378fa005f2afce1fd4df9ffe2cb4d69a9d92..8ce59bf29a86c9b06e6d01627a05f2f59b054ff1 100644 (file)
@@ -1306,8 +1306,10 @@ class CephFSMount(object):
             "available": int(avail)
         }
 
-    def dir_checksum(self, path=None):
+    def dir_checksum(self, path=None, follow_symlinks=False):
         cmd = ["find"]
+        if follow_symlinks:
+            cmd.append("-L")
         if path:
             cmd.append(path)
         cmd.extend(["-type", "f", "-exec", "md5sum", "{}", "+"])
index feaf864187ede23b6abd5319135a26851aad506c..13c0de6cd119abfb2c9384b4c087b7d4527f06f5 100644 (file)
@@ -172,10 +172,12 @@ class TestMirroring(CephFSTestCase):
         snap_list = self.mount_b.ls(path=f'{dir_name}/.snap')
         self.assertTrue(snap_name in snap_list)
 
-        source_res = self.mount_a.dir_checksum(path=f'{dir_name}/.snap/{snap_name}')
+        source_res = self.mount_a.dir_checksum(path=f'{dir_name}/.snap/{snap_name}',
+                                               follow_symlinks=True)
         log.debug(f'source snapshot checksum {snap_name} {source_res}')
 
-        dest_res = self.mount_b.dir_checksum(path=f'{dir_name}/.snap/{snap_name}')
+        dest_res = self.mount_b.dir_checksum(path=f'{dir_name}/.snap/{snap_name}',
+                                             follow_symlinks=True)
         log.debug(f'destination snapshot checksum {snap_name} {dest_res}')
         self.assertTrue(source_res == dest_res)
 
@@ -806,3 +808,38 @@ class TestMirroring(CephFSTestCase):
         self.peer_remove(self.primary_fs_name, self.primary_fs_id, "client.mirror_peer_bootstrap@site-remote")
         # disable mirroring
         self.disable_mirroring(self.primary_fs_name, self.primary_fs_id)
+
+    def test_cephfs_mirror_symlink_sync(self):
+        log.debug('reconfigure client auth caps')
+        self.mds_cluster.mon_manager.raw_cluster_cmd_result(
+            'auth', 'caps', "client.{0}".format(self.mount_b.client_id),
+                'mds', 'allow rw',
+                'mon', 'allow r',
+                'osd', 'allow rw pool={0}, allow rw pool={1}'.format(
+                    self.backup_fs.get_data_pool_name(), self.backup_fs.get_data_pool_name()))
+
+        log.debug(f'mounting filesystem {self.secondary_fs_name}')
+        self.mount_b.umount_wait()
+        self.mount_b.mount(cephfs_name=self.secondary_fs_name)
+
+        # create a bunch of files w/ symbolic links in a directory to snap
+        self.mount_a.run_shell(["mkdir", "d0"])
+        self.mount_a.create_n_files('d0/file', 10, sync=True)
+        self.mount_a.run_shell(["ln", "-s", "./file_0", "d0/sym_0"])
+        self.mount_a.run_shell(["ln", "-s", "./file_1", "d0/sym_1"])
+        self.mount_a.run_shell(["ln", "-s", "./file_2", "d0/sym_2"])
+
+        self.enable_mirroring(self.primary_fs_name, self.primary_fs_id)
+        self.add_directory(self.primary_fs_name, self.primary_fs_id, '/d0')
+        self.peer_add(self.primary_fs_name, self.primary_fs_id, "client.mirror_remote@ceph", self.secondary_fs_name)
+
+        # take a snapshot
+        self.mount_a.run_shell(["mkdir", "d0/.snap/snap0"])
+
+        time.sleep(30)
+        self.check_peer_status(self.primary_fs_name, self.primary_fs_id,
+                               "client.mirror_remote@ceph", '/d0', 'snap0', 1)
+        self.verify_snapshot('d0', 'snap0')
+
+        self.remove_directory(self.primary_fs_name, self.primary_fs_id, '/d0')
+        self.disable_mirroring(self.primary_fs_name, self.primary_fs_id)