From 40c97b91b356db7e289e41ef076c1a9233bb14e8 Mon Sep 17 00:00:00 2001 From: Richael Zhuang Date: Mon, 29 Apr 2019 14:48:44 +0800 Subject: [PATCH] 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 --- src/vstart.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index e83dc379b27..e1e09cf52ab 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -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 < /dev/null; then