]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
scripts: some additions to help with local testing
authorGreg Farnum <gfarnum@redhat.com>
Thu, 4 Mar 2021 02:41:03 +0000 (02:41 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Mon, 15 Mar 2021 18:38:52 +0000 (18:38 +0000)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
(cherry picked from commit 6489d276f6b5c30e1d1526824d08898bf6d8b3a1)

src/script/add_osd.sh [new file with mode: 0755]
src/script/extend_stretch_cluster.sh [new file with mode: 0755]
src/script/set_up_stretch_mode.sh

diff --git a/src/script/add_osd.sh b/src/script/add_osd.sh
new file mode 100755 (executable)
index 0000000..a8dff6b
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -ex
+
+CEPH_DEV_DIR=dev
+CEPH_BIN=bin
+ceph_adm=$CEPH_BIN/ceph
+osd=$1
+location=$2
+weight=.0990
+
+# DANGEROUS
+rm -rf $CEPH_DEV_DIR/osd$osd
+mkdir -p $CEPH_DEV_DIR/osd$osd
+
+uuid=`uuidgen`
+echo "add osd$osd $uuid"
+OSD_SECRET=$($CEPH_BIN/ceph-authtool --gen-print-key)
+echo "{\"cephx_secret\": \"$OSD_SECRET\"}" > $CEPH_DEV_DIR/osd$osd/new.json
+$CEPH_BIN/ceph osd new $uuid -i $CEPH_DEV_DIR/osd$osd/new.json
+rm $CEPH_DEV_DIR/osd$osd/new.json
+$CEPH_BIN/ceph-osd -i $osd $ARGS --mkfs --key $OSD_SECRET --osd-uuid $uuid
+
+key_fn=$CEPH_DEV_DIR/osd$osd/keyring
+cat > $key_fn<<EOF
+[osd.$osd]
+       key = $OSD_SECRET
+EOF
+echo adding osd$osd key to auth repository
+$CEPH_BIN/ceph -i "$key_fn" auth add osd.$osd osd "allow *" mon "allow profile osd" mgr "allow profile osd"
+
+$CEPH_BIN/ceph osd crush add osd.$osd $weight $location
+
+echo start osd.$osd
+$CEPH_BIN/ceph-osd -i $osd $ARGS $COSD_ARGS
diff --git a/src/script/extend_stretch_cluster.sh b/src/script/extend_stretch_cluster.sh
new file mode 100755 (executable)
index 0000000..f588636
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -ex
+
+../src/script/add_osd.sh 4 'host=host1-1 datacenter=site1 root=default'
+../src/script/add_osd.sh 5 'host=host1-2 datacenter=site1 root=default'
+../src/script/add_osd.sh 6 'host=host2-1 datacenter=site2 root=default'
+../src/script/add_osd.sh 7 'host=host2-2 datacenter=site2 root=default'
index 31ccfbdc9f5e24c8f5e2a5a34379595a459ea194..a9cfd7daa3b34c273d6e1122d3e54c2281f5963a 100755 (executable)
@@ -32,5 +32,5 @@ EOF
 ./bin/ceph mon set_location a datacenter=site1
 ./bin/ceph mon set_location b datacenter=site2
 ./bin/ceph mon set_location c datacenter=site3
-./bin/ceph osd pool create test_stretch1 replicated
+./bin/ceph osd pool create test_stretch1 1024 1024 replicated
 ./bin/ceph mon enable_stretch_mode c stretch_rule datacenter