]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/ceph_manager: fix movement of cot exports with cephadm 32986/head
authorSage Weil <sage@redhat.com>
Thu, 30 Jan 2020 13:39:32 +0000 (07:39 -0600)
committerSage Weil <sage@redhat.com>
Fri, 31 Jan 2020 23:26:10 +0000 (17:26 -0600)
I think this will finally work...

Signed-off-by: Sage Weil <sage@redhat.com>
qa/tasks/ceph_manager.py

index 0832265252b921f90750a6ca0e72ff00869c4000..906b183b33f141a1f3b8b83403dd6b3ee092ea33 100644 (file)
@@ -319,15 +319,8 @@ class OSDThrasher(Thrasher):
                     "exp.{pg}.{id}".format(
                         pg=pg,
                         id=exp_osd))
-                exp_host_path_dirs = [
-                    os.path.join(
-                        '/var/log/ceph',
-                        self.ceph_manager.ctx.ceph[self.ceph_manager.cluster].fsid),
-                    '/var/log/ceph',
-                ]
             else:
                 exp_host_path = exp_path
-                exp_host_path_dirs = ['/var/log/ceph']
 
             # export
             # Can't use new export-remove op since this is part of upgrade testing
@@ -382,11 +375,20 @@ class OSDThrasher(Thrasher):
                         self.log("Transfer export file from {srem} to {trem}".
                                  format(srem=exp_remote, trem=imp_remote))
                         # just in case an upgrade make /var/log/ceph unreadable by non-root,
-                        for d in exp_host_path_dirs:
-                            exp_remote.run(args=['sudo', 'chmod', '777', d])
-                            imp_remote.run(args=['sudo', 'chmod', '777', d])
-                        tmpexport = Remote.get_file(exp_remote, exp_host_path)
-                        Remote.put_file(imp_remote, tmpexport, exp_host_path)
+                        exp_remote.run(args=['sudo', 'chmod', '777',
+                                             '/var/log/ceph'])
+                        imp_remote.run(args=['sudo', 'chmod', '777',
+                                             '/var/log/ceph'])
+                        tmpexport = Remote.get_file(exp_remote, exp_host_path,
+                                                    sudo=True)
+                        if exp_host_path != exp_path:
+                            # push to /var/log/ceph, then rename (we can't
+                            # chmod 777 the /var/log/ceph/$fsid mountpoint)
+                            Remote.put_file(imp_remote, tmpexport, exp_path)
+                            imp_remote.run(args=[
+                                'sudo', 'mv', exp_path, exp_host_path])
+                        else:
+                            Remote.put_file(imp_remote, tmpexport, exp_host_path)
                         os.remove(tmpexport)
                 else:
                     # Can't move the pg after all