Skip to content

vstart: make -k with optional mon_num (part 2) - #8305

Merged
dillaman merged 2 commits into
ceph:masterfrom
tchaikov:wip-fix-vstart
Apr 29, 2016
Merged

dillaman merged 2 commits into
ceph:masterfrom
tchaikov:wip-fix-vstart

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

vstart: use default CEPH_NUM_* if awk fails

see #8251

@tchaikov

Copy link
Copy Markdown
Contributor Author

@dillaman could you help take a look? thanks!

Comment thread src/vstart.sh Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

@dillaman dillaman self-assigned this Mar 30, 2016
@trociny

trociny commented Mar 30, 2016

Copy link
Copy Markdown
Contributor

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:

[client.vstart.sh]
  ceph num mon = 5
  ...

And parse it using ceph-conf:

MON=`ceph-conf -c $conf_fn --name client.vstart.sh ceph_num_mon`

@tchaikov

Copy link
Copy Markdown
Contributor Author

@trociny thanks for the suggestion! i will update this PR later on.

@tchaikov

Copy link
Copy Markdown
Contributor Author

changelog

  • store the number of {osd,mon,mds,rgw} as settings in the section of "[client.vstart.sh]"
  • read the remembered using ceph-conf instead of parsing the ceph.conf using awk.

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.

@dillaman

dillaman commented Apr 5, 2016

Copy link
Copy Markdown

My only comment is that perhaps given the distance between usages of "client.vstart.sh", should it use an environment variable "constant"?

@tchaikov

tchaikov commented Apr 5, 2016

Copy link
Copy Markdown
Contributor Author

changelog

  • use a variable for "client.vstart.sh" instead of hardwiring it to "client.vstart.sh" at two separated places

@tchaikov

Copy link
Copy Markdown
Contributor Author

@dillaman ping?

Comment thread src/vstart.sh Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor: s/can not/cannot/g

@tchaikov

Copy link
Copy Markdown
Contributor Author

changelog

  • s/can not/cannot/

@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 <[email protected]>
@tchaikov

Copy link
Copy Markdown
Contributor Author

@dillaman ping?

@dillaman
dillaman merged commit 4f3765c into ceph:master Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants