Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
osd_volume_activate: open encrypted legacy parts
Browse files Browse the repository at this point in the history
When managing legacy ceph-disk based OSD with ceph-volume then we need
to open the encrypted partitions before running the ceph-volume simple
scan command otherwise the scan will fail.
This situation happens after a reboot because all encrypted partitions
are closed.

$ ceph-volume simple scan /dev/sdb1 --force
(...)
--> broken symlink found /tmp/tmpept0ox2j/block -> /dev/mapper/457d7196-4015-40fe-aa83-a160477450f7

$ ceph-volume.log
(...)
[ceph_volume.util.system][INFO  ] /dev/sdb1 was not found as mounted
[ceph_volume.util.encryption][WARNING] failed to detect device mapper information
[ceph_volume.util.encryption][WARNING] failed to detect device mapper information
[ceph_volume.devices.simple.scan][WARNING] broken symlink found /tmp/tmpept0ox2j/block -> /dev/mapper/457d7196-4015-40fe-aa83-a160477450f7
[ceph_volume.devices.simple.scan][ERROR ] skipping due to IOError on file: /tmp/tmpept0ox2j/block
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ceph_volume/devices/simple/scan.py", line 118, in scan_directory
    if system.is_binary(file_path):
  File "/usr/lib/python3.6/site-packages/ceph_volume/util/system.py", line 116, in is_binary
    with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpept0ox2j/block'
[ceph_volume.util.encryption][WARNING] failed to detect device mapper information
[ceph_volume.devices.simple.scan][INFO  ] skipping binary file: /tmp/tmpept0ox2j/block_dmcrypt

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1792122

Signed-off-by: Dimitri Savineau <[email protected]>
(cherry picked from commit d07436a)
  • Loading branch information
dsavineau committed Jun 18, 2020
1 parent 5168cd5 commit b16b869
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/daemon/osd_scenarios/osd_volume_activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ function osd_volume_simple {
# Scan devices with ceph data partition
for device in ${DEVICES}; do
if parted --script "${device}" print | grep -qE '^ 1.*ceph data'; then
if [[ "${device}" =~ ^/dev/(cciss|nvme|loop) ]]; then
device+="p"
OSD_DEVICE=${device}
DATA_PART=$(dev_part "${OSD_DEVICE}" 1)
MOUNTED_PART=${DATA_PART}
if [[ ${OSD_DMCRYPT} -eq 1 ]] && [[ ${OSD_FILESTORE} -eq 1 ]]; then
get_dmcrypt_filestore_uuid || true
mount_lockbox "$DATA_UUID" "$LOCKBOX_UUID"
MOUNTED_PART="/dev/mapper/${DATA_UUID}"
open_encrypted_parts_filestore
elif [[ ${OSD_DMCRYPT} -eq 1 ]] && [[ ${OSD_BLUESTORE} -eq 1 ]]; then
get_dmcrypt_bluestore_uuid || true
mount_lockbox "$DATA_UUID" "$LOCKBOX_UUID"
MOUNTED_PART="/dev/mapper/${DATA_UUID}"
open_encrypted_parts_bluestore
fi
ceph-volume simple scan ${device}1 --force || true
ceph-volume simple scan ${DATA_PART} --force || true
fi
done

Expand Down

0 comments on commit b16b869

Please sign in to comment.