From f511e94dccaacf239b4011048366f230a064ed32 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 18 Jul 2019 17:11:51 -0400 Subject: [PATCH] entrypoint: Allow to map dmcrypt data partitions In order to get the OSD ids with ceph-disk list command, we need first to map the dmcrypt data partitions (mount the lockbox partition and then open the encrypted partition). Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1670734 Signed-off-by: Dimitri Savineau (cherry picked from commit 3a5e7c80ba9934f1b5fc8e6ee607cd01f943fbb8) --- src/daemon/common_functions.sh | 12 ++++++++++++ src/daemon/entrypoint.sh.in | 4 ++++ src/daemon/variables_entrypoint.sh | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/daemon/common_functions.sh b/src/daemon/common_functions.sh index 942ced180..374c33007 100755 --- a/src/daemon/common_functions.sh +++ b/src/daemon/common_functions.sh @@ -517,3 +517,15 @@ function ami_privileged { # lsblk is not able to get device mappers path and is complaining. # That's why stderr is suppressed in /dev/null } + +# Map dmcrypt data device +function dmcrypt_data_map() { + for lockbox in $(blkid -t PARTLABEL="ceph lockbox" -o device | tr '\n' ' '); do + OSD_DEVICE=${lockbox:0:-1} + DATA_PART=$(dev_part "${OSD_DEVICE}" 1) + DATA_UUID=$(get_part_uuid "$(dev_part "${OSD_DEVICE}" 1)") + LOCKBOX_UUID=$(get_part_uuid "$(dev_part "${OSD_DEVICE}" 5)") + mount_lockbox "${DATA_UUID}" "${LOCKBOX_UUID}" + ceph-disk --setuser ceph --setgroup disk activate --dmcrypt --no-start-daemon ${DATA_PART} || true + done +} diff --git a/src/daemon/entrypoint.sh.in b/src/daemon/entrypoint.sh.in index 1e3224560..678aed62f 100755 --- a/src/daemon/entrypoint.sh.in +++ b/src/daemon/entrypoint.sh.in @@ -112,6 +112,10 @@ case "$CEPH_DAEMON" in source osd_volume_activate.sh osd_volume_activate ;; + osd_ceph_disk_dmcrypt_data_map) + # TAG: osd_ceph_disk_dmcrypt_data_map + dmcrypt_data_map + ;; mds) # TAG: mds source start_mds.sh diff --git a/src/daemon/variables_entrypoint.sh b/src/daemon/variables_entrypoint.sh index c3c6a4530..c0e9699a9 100755 --- a/src/daemon/variables_entrypoint.sh +++ b/src/daemon/variables_entrypoint.sh @@ -5,7 +5,7 @@ # LIST OF ALL SCENARIOS AVAILABLE # ################################### -ALL_SCENARIOS="populate_kvstore mon osd osd_directory osd_directory_single osd_ceph_disk osd_ceph_disk_prepare osd_ceph_disk_activate osd_ceph_disk_activate_only osd_ceph_activate_journal mds rgw rgw_user restapi nfs zap_device mon_health mgr disk_introspection demo disk_list tcmu_runner rbd_target_api rbd_target_gw" +ALL_SCENARIOS="populate_kvstore mon osd osd_directory osd_directory_single osd_ceph_disk osd_ceph_disk_prepare osd_ceph_disk_activate osd_ceph_disk_activate_only osd_ceph_activate_journal osd_ceph_disk_dmcrypt_data_map mds rgw rgw_user restapi nfs zap_device mon_health mgr disk_introspection demo disk_list tcmu_runner rbd_target_api rbd_target_gw" #########################