]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart: support bluestore db/wal physical disk 50628/head
authorzhangjianwei2 <zhangjianwei2@cmss.chinamobile.com>
Wed, 22 Mar 2023 15:03:01 +0000 (15:03 +0000)
committerzhangjianwei2 <zhangjianwei2@cmss.chinamobile.com>
Wed, 22 Mar 2023 15:29:00 +0000 (15:29 +0000)
(1) block/db/wal share the same physical disk
MON=1 OSD=3 MGR=1 MDS=0 RGW=0 ../src/vstart.sh \
-b -X --without-dashboard -n \
--bluestore-devs /dev/sdax,/dev/sday,/dev/sdaz

(2) block/db/wal do not share the same physical disk
MON=1 OSD=3 MGR=1 MDS=0 RGW=0 ../src/vstart.sh \
-b -X --without-dashboard -n \
--bluestore-devs /dev/sdax,/dev/sday,/dev/sdaz \
--bluestore-db-devs /dev/sda1,/dev/sda2,/dev/sda3 \
--bluestore-wal-devs /dev/sda4,/dev/sda5,/dev/sda6

(3) combination of (1) and (2)
I> case (2) in the front of --bluestore-devs
II> case (1) in the back of --bluestore-devs
for example,
MON=1 OSD=4 MGR=1 MDS=0 RGW=0 ../src/vstart.sh \
-b -X --without-dashboard -n \
--bluestore-devs /dev/sdax,/dev/sday,/dev/sdaz,/dev/sdav \
--bluestore-db-devs /dev/sda1,/dev/sda2 \
--bluestore-wal-devs /dev/sda4,/dev/sda5
osd.0:sdax+sda1+sda4
osd.1:sday+sda2+sda5
osd.2:sdaz
osd.3:sdav

Signed-off-by: zhangjianwei2 <zhangjianwei2@cmss.chinamobile.com>
src/vstart.sh

index 8d16c630a6622b6f2a0378adf84ce05d70c41b22..025204a7cec03fde98014ad116913fd1ac47c704 100755 (executable)
@@ -186,6 +186,8 @@ with_mgr_restful=false
 filestore_path=
 kstore_path=
 declare -a block_devs
+declare -a bluestore_db_devs
+declare -a bluestore_wal_devs
 declare -a secondary_block_devs
 secondary_block_devs_type="SSD"
 
@@ -248,6 +250,8 @@ options:
        --crimson-foreground: use crimson-osd, but run it in the foreground
        --osd-args: specify any extra osd specific options
        --bluestore-devs: comma-separated list of blockdevs to use for bluestore
+       --bluestore-db-devs: comma-separated list of db-devs to use for bluestore
+       --bluestore-wal-devs: comma-separated list of wal-devs to use for bluestore
        --bluestore-zoned: blockdevs listed by --bluestore-devs are zoned devices (HM-SMR HDD or ZNS SSD)
        --bluestore-io-uring: enable io_uring backend
        --inc-osd: append some more osds into existing vcluster
@@ -282,6 +286,36 @@ parse_block_devs() {
     done
 }
 
+parse_bluestore_db_devs() {
+    local opt_name=$1
+    shift
+    local devs=$1
+    shift
+    local dev
+    IFS=',' read -r -a bluestore_db_devs <<< "$devs"
+    for dev in "${bluestore_db_devs[@]}"; do
+        if [ ! -b $dev ] || [ ! -w $dev ]; then
+            echo "All $opt_name must refer to writable block devices"
+            exit 1
+        fi
+    done
+}
+
+parse_bluestore_wal_devs() {
+    local opt_name=$1
+    shift
+    local devs=$1
+    shift
+    local dev
+    IFS=',' read -r -a bluestore_wal_devs <<< "$devs"
+    for dev in "${bluestore_wal_devs[@]}"; do
+        if [ ! -b $dev ] || [ ! -w $dev ]; then
+            echo "All $opt_name must refer to writable block devices"
+            exit 1
+        fi
+    done
+}
+
 parse_secondary_devs() {
     local opt_name=$1
     shift
@@ -542,6 +576,14 @@ case $1 in
         parse_block_devs --bluestore-devs "$2"
         shift
         ;;
+    --bluestore-db-devs)
+        parse_bluestore_db_devs --bluestore-db-devs "$2"
+        shift
+        ;;
+    --bluestore-wal-devs)
+        parse_bluestore_wal_devs --bluestore-wal-devs "$2"
+        shift
+        ;;
     --bluestore-zoned)
         zoned_enabled=1
         ;;
@@ -780,6 +822,12 @@ EOF
         bluestore block wal path = $CEPH_DEV_DIR/osd\$id/block.wal.file
         bluestore block wal size = 1048576000
         bluestore block wal create = true"
+            if [ ${#block_devs[@]} -gt 0 ] || \
+               [ ${#bluestore_db_devs[@]} -gt 0 ] || \
+               [ ${#bluestore_wal_devs[@]} -gt 0 ]; then
+                # when use physical disk, not create file for db/wal
+                BLUESTORE_OPTS=""
+            fi
         fi
         if [ "$zoned_enabled" -eq 1 ]; then
             BLUESTORE_OPTS+="
@@ -1041,6 +1089,14 @@ EOF
                     dd if=/dev/zero of=${block_devs[$osd]} bs=1M count=1
                     ln -s ${block_devs[$osd]} $CEPH_DEV_DIR/osd$osd/block
                 fi
+                if [ -n "${bluestore_db_devs[$osd]}" ]; then
+                    dd if=/dev/zero of=${bluestore_db_devs[$osd]} bs=1M count=1
+                    ln -s ${bluestore_db_devs[$osd]} $CEPH_DEV_DIR/osd$osd/block.db
+                fi
+                if [ -n "${bluestore_wal_devs[$osd]}" ]; then
+                    dd if=/dev/zero of=${bluestore_wal_devs[$osd]} bs=1M count=1
+                    ln -s ${bluestore_wal_devs[$osd]} $CEPH_DEV_DIR/osd$osd/block.wal
+                fi
                 if [ -n "${secondary_block_devs[$osd]}" ]; then
                     dd if=/dev/zero of=${secondary_block_devs[$osd]} bs=1M count=1
                     mkdir -p $CEPH_DEV_DIR/osd$osd/block.${secondary_block_devs_type}.1