Debian Codegraph @

bin/ct-add-osds

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 #set -x
3 source /usr/share/ceph-tools/_ct-commonscip-shell source . . `/usr/share/ceph-tools/_ct-common`.
4
5 help_msgscip-shell shell ceph-tools 0.0.40 help_msg(). () {
6 printfscip-shell system . . printf. """
7 usage: $0 [-h] $CT_HELP_DESCR HOSTS
8
9 Description Add OSDs on 3 servers
10
11 Optional
12 $CT_HELP_MSG
13 -p PREFIX, --PREFIX
14 Prefix off Host
15
16 Positional
17 HOSTS List of Hosts (must be equal to 3)
18
19 Example
20 $0 $CT_HELP_EXAMPLE -p bdb2-cephosd- {1..3}
21 """
22 }
23
24 declare -a Z1
25 declare -a Z2
26 declare -a Z3
27
28 get_osd_by_hostscip-shell shell ceph-tools 0.0.40 get_osd_by_host().() {
29 _OSDS=$(ceph osd status ${1} | grepscip-shell system . . grep. "new" | awkscip-shell system . . awk. '{print $2}')
30 for OSD in $_OSDS
31 do
32 OSDS="${OSDS} $OSD"
33 done
34 echoscip-shell system . . echo. $OSDS
35 }
36
37
38 PREFIX="bdb2-cephosd-"
39
40 ct_help_min $# 3
41 ct_help $@
42 shift $?
43 while [scip-shell system . . `[`. $# -ge 3 ]; do
44 key="$1"
45 case $key in
46 -p|--prefix)
47 PREFIX=$2
48 shift 2
49 ;;
50 *)
51 if [scip-shell system . . `[`. $# -ne 3 ]
52 then
53 echoscip-shell system . . echo. "The number of hosts must be equal to 3"
54 ct_on_exit 1
55 fi
56 Z1=($(get_osd_by_hostscip-shell shell ceph-tools 0.0.40 get_osd_by_host(). ${PREFIX}${1}))
57 Z2=($(get_osd_by_hostscip-shell shell ceph-tools 0.0.40 get_osd_by_host(). ${PREFIX}${2}))
58 Z3=($(get_osd_by_hostscip-shell shell ceph-tools 0.0.40 get_osd_by_host(). ${PREFIX}${3}))
59 break
60 ;;
61 esac
62 done
63
64 echoscip-shell system . . echo. ${1}: adding OSDs ${Z1[@]}
65 echoscip-shell system . . echo. ${2}: adding OSDs ${Z2[@]}
66 echoscip-shell system . . echo. ${3}: adding OSDs ${Z3[@]}
67
68 for o in ${!Z1[@]}; do
69 ct_healthy_wait
70 ID=${Z1[${o}]}
71 ceph osd in $ID
72 sleepscip-shell system . . sleep. 5
73 ID=${Z2[${o}]}
74 ceph osd in $ID
75 sleepscip-shell system . . sleep. 5
76 ID=${Z3[${o}]}
77 ceph osd in $ID
78 sleepscip-shell system . . sleep. 20
79 done
80 ct_healthy_wait
81 echoscip-shell system . . echo. End adding OSDs for hosts $@
82
83 ct_on_exit 0