vstart: make -k with optional mon_num (part 2)#8305
Conversation
|
@dillaman could you help take a look? thanks! |
src/vstart.sh
Outdated
| CEPH_NUM_OSD=`awk -F= '/CEPH_NUM_OSD/{print $2}' $conf_fn` | ||
| CEPH_NUM_MDS=`awk -F= '/CEPH_NUM_MDS/{print $2}' $conf_fn` | ||
| CEPH_NUM_RGW=`awk -F= '/CEPH_NUM_RGW/{print $2}' $conf_fn` | ||
| MON=`awk -F= '/CEPH_NUM_MON/{print $2}' $conf_fn` |
There was a problem hiding this comment.
Can you just do something like: CEPH_NUM_MON=awk -F= '/CEPH_NUM_MON/{print $2}' $conf_fn before line 79? If the awk fails, it will fall back to the defaults.
There was a problem hiding this comment.
if we go this way, we will always continue with whatever CEPH_NUM_{MON,OSD,MDS,RGW} the last vstart run used, even if "-k" is not passed in. in other words,
$ MON=1 OSD=1 MDS=0 ./vstart.sh
$ ./stop
$ MON=1 OSD=2 MDS=0 ./vstart.sh
# what? we have only 1 OSD?if we move these lines after line 91, we overwrite the options for a non "-k" vstart cluster.
|
This comment is rather for the initial PR (part 1) and can be freely ignored... Anyway, I don't not like very much when sed/awk/... is used to extract values from files like this (that can be parsed by a specialized parser). E.g. the current awk parsing will break when ceph.conf happens to include CEPH_NUM_MON word more than one time. Instead, we could add e.g. "client.vstart.sh" section to the generated ceph.conf: And parse it using |
|
@trociny thanks for the suggestion! i will update this PR later on. |
7ef3995 to
ed769ef
Compare
|
changelog
hope this is okay to introduce the dependency on ceph-conf. but guess we don't use "-k" in our testing, so it's relatively safe. |
|
My only comment is that perhaps given the distance between usages of "client.vstart.sh", should it use an environment variable "constant"? |
|
changelog
|
|
@dillaman ping? |
src/vstart.sh
Outdated
| ;; | ||
| -k ) | ||
| if [ ! -r $conf_fn ]; then | ||
| echo "can not use old configuration: $conf_fn not readable." >&2 |
f0ced37 to
7907ae7
Compare
|
changelog
@dillaman thanks for the review, fixed and repushed. |
add a section named "client.vstart.sh" for storing the
num_{osd,mon,mds,rgw} settings. and read them using
ceph-conf if the "-k" option is passed in. if we fail to do so, fall
back to the default settings.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
7907ae7 to
bd02331
Compare
|
@dillaman ping? |
vstart: use default CEPH_NUM_* if awk fails
see #8251