vstart.sh: enable creating multiple OSDs backed by spdk backend

Currently vstart.sh only support deploying one OSD based on NVMe SSD.
The following two cases will cause errors:
1.There are 2 more NVMe SSDs from the same vendor on the machine
2.Trying to deploy 2 more OSDs if we only get 1 pci_id available

Add the support for allowing deploying multiple OSDs on a machine with
multiple NVME SSDs.

Change-Id: I6016435c1438bb4d16aff31f4575e03ccd3c9b3d

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
This commit is contained in:
Richael Zhuang 2019-04-29 14:48:44 +08:00
parent f2bafe4b03
commit 40c97b91b3

View File

@ -484,7 +484,12 @@ wconf() {
}
get_pci_selector() {
lspci -mm -n -D -d $pci_id | cut -d ' ' -f 1
which_pci=$1
lspci -mm -n -D -d $pci_id | cut -d ' ' -f 1 | sed -n $which_pci'p'
}
get_pci_selector_num() {
lspci -mm -n -D -d $pci_id | cut -d' ' -f 1 | wc -l
}
prepare_conf() {
@ -575,8 +580,12 @@ EOF
fi
if [ "$objectstore" == "bluestore" ]; then
if [ "$spdk_enabled" -eq 1 ]; then
if [ "$(get_pci_selector)" == "" ]; then
echo "Not find the specified NVME device, please check."
if [ "$(get_pci_selector_num)" -eq 0 ]; then
echo "Not find the specified NVME device, please check." >&2
exit
fi
if [ $(get_pci_selector_num) -lt $CEPH_NUM_OSD ]; then
echo "OSD number ($CEPH_NUM_OSD) is greater than NVME SSD number ($(get_pci_selector_num)), please check." >&2
exit
fi
BLUESTORE_OPTS=" bluestore_block_db_path = \"\"
@ -585,8 +594,7 @@ EOF
bluestore_block_wal_path = \"\"
bluestore_block_wal_size = 0
bluestore_block_wal_create = false
bluestore_spdk_mem = 2048
bluestore_block_path = spdk:$(get_pci_selector)"
bluestore_spdk_mem = 2048"
else
BLUESTORE_OPTS=" bluestore block db path = $CEPH_DEV_DIR/osd\$id/block.db.file
bluestore block db size = 1073741824
@ -754,10 +762,15 @@ start_osd() {
for osd in `seq 0 $(($CEPH_NUM_OSD-1))`
do
if [ "$new" -eq 1 ]; then
wconf <<EOF
wconf <<EOF
[osd.$osd]
host = $HOSTNAME
EOF
if [ "$spdk_enabled" -eq 1 ]; then
wconf <<EOF
bluestore_block_path = spdk:$(get_pci_selector $((osd+1)))
EOF
fi
rm -rf $CEPH_DEV_DIR/osd$osd || true
if command -v btrfs > /dev/null; then