From 4a85c21996c4771bbebcfbeb3b6a42126370938a Mon Sep 17 00:00:00 2001 From: Matthew Heler Date: Mon, 7 Jan 2019 15:37:53 -0600 Subject: [PATCH] [CEPH] OSD directory permission fixes In the event the base image is changed, the uid of the ceph OSD directory may not align with the uid of the ceph user of the image. In this case we check permissions and set them correctly. Change-Id: I3bef7f6323d1de7c62320ccd423c929349bedb42 --- ceph-osd/templates/bin/osd/_block.sh.tpl | 5 +++++ ceph-osd/templates/bin/osd/_directory.sh.tpl | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ceph-osd/templates/bin/osd/_block.sh.tpl b/ceph-osd/templates/bin/osd/_block.sh.tpl index 9cfd34402..eed6a790c 100644 --- a/ceph-osd/templates/bin/osd/_block.sh.tpl +++ b/ceph-osd/templates/bin/osd/_block.sh.tpl @@ -99,6 +99,11 @@ if [ "${OSD_BLUESTORE:-0}" -ne 1 ]; then fi fi +# NOTE(supamatt): Just in case permissions do not align up, we recursively set them correctly. +if [ $(stat -c%U ${OSD_PATH}) != ceph ]; then + chown -R ceph. ${OSD_PATH}; +fi + if [ "${OSD_BLUESTORE:-0}" -ne 1 ]; then # NOTE(supamatt): This function is a workaround to Ceph upstream bug #21142 osd_pg_interval_fix diff --git a/ceph-osd/templates/bin/osd/_directory.sh.tpl b/ceph-osd/templates/bin/osd/_directory.sh.tpl index 00e504b9f..36b97bd9d 100644 --- a/ceph-osd/templates/bin/osd/_directory.sh.tpl +++ b/ceph-osd/templates/bin/osd/_directory.sh.tpl @@ -72,6 +72,11 @@ if [[ -n "$(find /var/lib/ceph/osd -prune -empty)" ]]; then crush_location fi +# NOTE(supamatt): Just in case permissions do not align up, we recursively set them correctly. +if [ $(stat -c%U ${OSD_PATH}) != ceph ]; then + chown -R ceph. ${OSD_PATH}; +fi + # NOTE(supamatt): This function is a workaround to Ceph upstream bug #21142 osd_pg_interval_fix