-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add various bits of setup automation #61
Conversation
Add ceph-setup role Add automated osd preparation Fix role search bug
|
||
if node['ceph']['config']['fsid'].nil? | ||
Log.info("ceph-setup: ceph fsid not set - generating a new fsid") | ||
fsid = Mixlib::ShellOut.new("uuidgen").run_command.stdout.strip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use pure-ruby instead (cleaner I think):
fsid = SecureRandom.uuid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feedback, thanks. Done!
if node["ceph"]["osd_autoprepare"] and !node["ceph"]["osd_devices"].nil? | ||
node["ceph"]["osd_devices"].each do |osd_device| | ||
Log.info("ceph-osd: Erasing #{osd_device['device']} to prepare it as an osd") | ||
system 'sgdisk', '-oZ', "#{osd_device['device']}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixlib::ShellOut
Is better than "system". ;)
.error!
raise an exception :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good tip - I've pushed an update.
This patches are good for me. Maybe (but that can not be true), there is too many "Log.info", "Log.debug" can be good sometimes. |
pgp_num pool["pgp_num"] | ||
min_size pool["min_size"] | ||
action :create | ||
not_if "ceph osd lspools | grep #{pool["name"]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With grep, you may have false positive, for instance if a pool foobar exist and you want to create foo.
Re-running ceph osd pool create is safe, or you could test if the pool exists with, for instance, ceph osd pool name get size. If this doesn't return ENOENT, the pool exists.
Is this PR always good for you (regard of current master)? |
@guilhem I'll have to refactor a lot of it to bring it in line with the current changes. There's a lot of work there which was duplicated here. I think it's best that I close this PR and do some new ones, focusing on only doing small changes per PR and making use of the new LWRP's. |
@odyssey4me ok for me. :) |
Add ceph-setup role
Add automated osd preparation and configuration
Add mds setup automation
Resolves #56 and #48
Note: My testing is being done with dumpling. I can't guarantee this will work with anything more than an n-1 version.