]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph: restore context of osd mount path before mkfs
authorKefu Chai <kchai@redhat.com>
Fri, 9 Dec 2016 18:36:52 +0000 (02:36 +0800)
committerSage Weil <sage@redhat.com>
Wed, 14 Dec 2016 15:57:34 +0000 (10:57 -0500)
all newly created files and directories under the mount dir inherit the
SELinux type of their parent directory. so we need to set it before
mkfs.

Fixes: http://tracker.ceph.com/issues/16800
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 53225d5272a1d35d4183fcfa55a139f55f77e122)

tasks/ceph.py

index 466cd17d9d10ad2ae631c5411afca43805284bb5..c5227adb250ba188edde6595a38bef043dba09dd 100644 (file)
@@ -590,6 +590,12 @@ def cluster(ctx, config):
                         os.path.join('/var/lib/ceph/osd', 'ceph-{id}'.format(id=id_)),
                     ]
                 )
+                remote.run(
+                    args=[
+                        'sudo', '/sbin/restorecon', mnt_point,
+                    ],
+                    check_status=False,
+                )
                 if not remote in ctx.disk_config.remote_to_roles_to_dev_mount_options:
                     ctx.disk_config.remote_to_roles_to_dev_mount_options[remote] = {}
                 ctx.disk_config.remote_to_roles_to_dev_mount_options[remote][id_] = mount_options