Browse Source

Fix bluestore disk naming format in kolla

The current bluestore disk label naming is inconsistent with the
filestore. The filestore naming format is that the disk prefixes
belonging to the same osd are the same and the suffixes are
different.

This patch keeps the bluestore's disk naming as well.

Change-Id: I090cf055ebedc555b5ada35e140b7a7bb2a4cf8f
changes/42/596642/2
wangwei 3 years ago
parent
commit
0f14b3d7e0
  1. 16
      docker/ceph/ceph-osd/extend_start.sh
  2. 39
      docker/kolla-toolbox/find_disks.py
  3. 4
      specs/kolla-ceph-bluestore.rst

16
docker/ceph/ceph-osd/extend_start.sh

@ -85,29 +85,29 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
ceph-osd -i "${OSD_ID}" --mkkey
echo "bluestore" > "${OSD_DIR}"/type
if [ -n "${OSD_BS_BLK_DEV}" ] && [ "${OSD_BS_BLK_DEV}" != "${OSD_BS_DEV}" ] && [ -n "${OSD_BS_BLK_PARTNUM}" ]; then
sgdisk "--change-name="${OSD_BS_BLK_PARTNUM}":KOLLA_CEPH_DATA_BS_B_${OSD_ID}" "--typecode="${OSD_BS_BLK_PARTNUM}":${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_BLK_DEV}"
sgdisk "--change-name="${OSD_BS_BLK_PARTNUM}":KOLLA_CEPH_DATA_BS_${OSD_ID}_B" "--typecode="${OSD_BS_BLK_PARTNUM}":${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_BLK_DEV}"
else
sgdisk "--change-name=2:KOLLA_CEPH_DATA_BS_B_${OSD_ID}" "--typecode=2:${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_DEV}"
sgdisk "--change-name=2:KOLLA_CEPH_DATA_BS_${OSD_ID}_B" "--typecode=2:${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_DEV}"
fi
if [ -n "${OSD_BS_WAL_DEV}" ] && [ "${OSD_BS_BLK_DEV}" != "${OSD_BS_WAL_DEV}" ] && [ -n "${OSD_BS_WAL_PARTNUM}" ]; then
sgdisk "--change-name="${OSD_BS_WAL_PARTNUM}":KOLLA_CEPH_DATA_BS_W_${OSD_ID}" "--typecode="${OSD_BS_WAL_PARTNUM}":${CEPH_OSD_BS_WAL_TYPE_CODE}" -- "${OSD_BS_WAL_DEV}"
sgdisk "--change-name="${OSD_BS_WAL_PARTNUM}":KOLLA_CEPH_DATA_BS_${OSD_ID}_W" "--typecode="${OSD_BS_WAL_PARTNUM}":${CEPH_OSD_BS_WAL_TYPE_CODE}" -- "${OSD_BS_WAL_DEV}"
fi
if [ -n "${OSD_BS_DB_DEV}" ] && [ "${OSD_BS_BLK_DEV}" != "${OSD_BS_DB_DEV}" ] && [ -n "${OSD_BS_DB_PARTNUM}" ]; then
sgdisk "--change-name="${OSD_BS_DB_PARTNUM}":KOLLA_CEPH_DATA_BS_D_${OSD_ID}" "--typecode="${OSD_BS_DB_PARTNUM}":${CEPH_OSD_BS_DB_TYPE_CODE}" -- "${OSD_BS_DB_DEV}"
sgdisk "--change-name="${OSD_BS_DB_PARTNUM}":KOLLA_CEPH_DATA_BS_${OSD_ID}_D" "--typecode="${OSD_BS_DB_PARTNUM}":${CEPH_OSD_BS_DB_TYPE_CODE}" -- "${OSD_BS_DB_DEV}"
fi
partprobe || true
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_B_"${OSD_ID}" "${OSD_DIR}"/block
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_"${OSD_ID}"_B "${OSD_DIR}"/block
if [ -n "${OSD_BS_WAL_DEV}" ] && [ "${OSD_BS_BLK_DEV}" != "${OSD_BS_WAL_DEV}" ] && [ -n "${OSD_BS_WAL_PARTNUM}" ]; then
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_W_"${OSD_ID}" "${OSD_DIR}"/block.wal
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_"${OSD_ID}"_W "${OSD_DIR}"/block.wal
fi
if [ -n "${OSD_BS_DB_DEV}" ] && [ "${OSD_BS_BLK_DEV}" != "${OSD_BS_DB_DEV}" ] && [ -n "${OSD_BS_DB_PARTNUM}" ]; then
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_D_"${OSD_ID}" "${OSD_DIR}"/block.db
ln -sf /dev/disk/by-partlabel/KOLLA_CEPH_DATA_BS_"${OSD_ID}"_D "${OSD_DIR}"/block.db
fi
ceph-osd -i "${OSD_ID}" --mkfs -k "${OSD_DIR}"/keyring --osd-uuid "${OSD_UUID}"
@ -156,7 +156,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# Setting partition name based on ${OSD_ID}
if [[ "${OSD_STORETYPE}" == "bluestore" ]]; then
sgdisk "--change-name=${OSD_PARTITION_NUM}:KOLLA_CEPH_BSDATA_${OSD_ID}" "--typecode=${OSD_PARTITION_NUM}:${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_DEV}"
sgdisk "--change-name=${OSD_PARTITION_NUM}:KOLLA_CEPH_DATA_BS_${OSD_ID}" "--typecode=${OSD_PARTITION_NUM}:${CEPH_OSD_TYPE_CODE}" -- "${OSD_BS_DEV}"
else
sgdisk "--change-name=${OSD_PARTITION_NUM}:KOLLA_CEPH_DATA_${OSD_ID}" "--typecode=${OSD_PARTITION_NUM}:${CEPH_OSD_TYPE_CODE}" -- "${OSD_DEV}"
sgdisk "--change-name=${JOURNAL_PARTITION_NUM}:KOLLA_CEPH_DATA_${OSD_ID}_J" "--typecode=${JOURNAL_PARTITION_NUM}:${CEPH_JOURNAL_TYPE_CODE}" -- "${JOURNAL_DEV}"

39
docker/kolla-toolbox/find_disks.py

@ -202,23 +202,23 @@ def extract_disk_info_bs(ct, dev, name, use_udev):
if dev.get('DEVTYPE', '') == 'partition':
actual_name = get_id_part_entry_name(dev, use_udev)
if (('BOOTSTRAP_BS' in name or 'BSDATA' in name)
if (('BOOTSTRAP_BS' in name or 'DATA_BS' in name)
and name in actual_name):
if '_BS_B' in actual_name:
if actual_name.endswith("_B"):
kwargs['partition_usage'] = 'block'
kwargs['bs_blk_partition_num'] = \
re.sub(r'.*[^\d]', '', dev.device_node)
kwargs['bs_blk_device'] = dev.find_parent('block').device_node
kwargs['bs_blk_label'] = actual_name
return kwargs
if '_BS_D' in actual_name:
if actual_name.endswith("_D"):
kwargs['partition_usage'] = 'block.db'
kwargs['bs_db_partition_num'] = \
re.sub(r'.*[^\d]', '', dev.device_node)
kwargs['bs_db_device'] = dev.find_parent('block').device_node
kwargs['bs_db_label'] = actual_name
return kwargs
if '_BS_W' in actual_name:
if actual_name.endswith("_W"):
kwargs['partition_usage'] = 'block.wal'
kwargs['bs_wal_partition_num'] = \
re.sub(r'.*[^\d]', '', dev.device_node)
@ -262,15 +262,15 @@ def combine_info(disks):
idx_osd = idx
elif (item['partition_usage'] == 'block' and
item['bs_blk_label'] ==
osds['block_label'][osd_id].replace('_BS', '_BS_B')):
osds['block_label'][osd_id] + "_B"):
idx_blk = idx
elif (item['partition_usage'] == 'block.wal' and
item['bs_wal_label'] ==
osds['block_label'][osd_id].replace('_BS', '_BS_W')):
osds['block_label'][osd_id] + "_W"):
idx_wal = idx
elif (item['partition_usage'] == 'block.db' and
item['bs_db_label'] ==
osds['block_label'][osd_id].replace('_BS', '_BS_D')):
osds['block_label'][osd_id] + "_D"):
idx_db = idx
idx = idx + 1
@ -338,33 +338,10 @@ def main():
ret = list()
ct = pyudev.Context()
for dev in find_disk(ct, name, match_mode, use_udev):
if '_BSDATA' in name:
if '_BS' in name:
info = extract_disk_info_bs(ct, dev, name, use_udev)
if info:
ret.append(info)
elif '_BS' in name:
info = extract_disk_info_bs(ct, dev, name, use_udev)
if info:
ret.append(info)
info = extract_disk_info_bs(ct, dev,
name.replace('_BS', '_BS_B'),
use_udev)
if info:
ret.append(info)
info = extract_disk_info_bs(ct, dev,
name.replace('_BS', '_BS_W'),
use_udev)
if info:
ret.append(info)
info = extract_disk_info_bs(ct, dev,
name.replace('_BS', '_BS_D'),
use_udev)
if info:
ret.append(info)
else:
for info in extract_disk_info(ct, dev, name, use_udev):
if info:

4
specs/kolla-ceph-bluestore.rst

@ -52,9 +52,9 @@ Indicate block, block.wal and block.db belonging to the same Ceph OSD according
to the partition labels, it keeps the same method used in Kolla Ceph filestore.
* ``KOLLA_CEPH_OSD_BOOSTRAP_BS_xxx`` is the block volume label of one bluestore
OSD
* ``KOLLA_CEPH_OSD_BOOSTRAP_BS_W_xxx`` is the block.wal volume label of one
* ``KOLLA_CEPH_OSD_BOOSTRAP_BS_xxx_W`` is the block.wal volume label of one
bluestore OSD
* ``KOLLA_CEPH_OSD_BOOSTRAP_BS_D_xxx`` is the block.db volume label of one
* ``KOLLA_CEPH_OSD_BOOSTRAP_BS_xxx_D`` is the block.db volume label of one
bluestore OSD
Here, ``xxx`` is the suffix used to indicate the above volumes belong to the
same Ceph OSD.

Loading…
Cancel
Save