Bug #5911
closedceph-deploy to Ubuntu targets touches sysvinit for mons and upstart for osds
0%
Description
Testing ceph-deploy from git master (checked out 6 Aug ad1f3f3689e8b060a13f715e7ac3735f91e9c546) for Ubuntu 12.04 targets, after deploying I see that the mons have a 'sysvinit' startup file and the osds an 'upstart' one (see listings below).
While the system does start up ok, this seems like a situation bound to confuse at some point (earlier versions of ceph-deploy were consistently making an 'upstart' file)
$ initctl list|grep ceph
ceph-mds-all-starter stop/waiting
ceph-mds-all start/running
ceph-osd-all start/running
ceph-osd-all-starter stop/waiting
ceph-all start/running
ceph-mon-all start/running
ceph-mon-all-starter stop/waiting
ceph-mon stop/waiting
ceph-create-keys stop/waiting
ceph-osd (ceph/1) start/running, process 1512
ceph-mds stop/waiting
$ ls l /var/lib/ceph/mon/ceph-ceph1/ 1 root root 0 Aug 9 12:44 done
total 8
-rw-r--r-rw-r--r- 1 root root 77 Aug 9 12:44 keyring
drwxr-xr-x 2 root root 4096 Aug 9 12:49 store.dbrw-r--r- 1 root root 0 Aug 9 12:44 sysvinit
$ ls l /var/lib/ceph/osd/ceph-0/ 1 root root 481 Aug 9 12:45 activate.monmap
total 52
-rw-r--r-rw-r--r- 1 root root 3 Aug 9 12:45 activerw-r--r- 1 root root 37 Aug 9 12:45 ceph_fsid
drwxr-xr-x 196 root root 8192 Aug 9 12:46 currentrw-r--r- 1 root root 37 Aug 9 12:45 fsid
lrwxrwxrwx 1 root root 58 Aug 9 12:45 journal > /dev/disk/by-partuuid/59669bd7-96f1-4b06-ab9a-a7e1ca554493 1 root root 37 Aug 9 12:45 journal_uuid
-rw-r--r-rw------ 1 root root 56 Aug 9 12:45 keyringrw-r--r- 1 root root 21 Aug 9 12:45 magicrw-r--r- 1 root root 6 Aug 9 12:45 readyrw-r--r- 1 root root 4 Aug 9 12:45 store_versionrw-r--r- 1 root root 0 Aug 9 12:49 upstartrw-r--r- 1 root root 2 Aug 9 12:45 whoami
Files
Updated by Alfredo Deza over 10 years ago
- Status changed from New to Fix Under Review
Opened pull request: https://github.com/ceph/ceph-deploy/pull/36
Updated by Sage Weil over 10 years ago
- Status changed from Fix Under Review to Resolved
Updated by Mark Kirkwood over 10 years ago
Well that was a fast turnaround!
A minor niggle - I note the osd code does:
init = lsb.choose_init(distro, codename)
to get the right init type - would it not make sense to use the same logic for the mons too?
Updated by Mark Kirkwood over 10 years ago
In fact like this seems to work:
diff --git a/ceph_deploy/hosts/common.py b/ceph_deploy/hosts/common.py index f5e3b8a..de6fdbf 100644 --- a/ceph_deploy/hosts/common.py +++ b/ceph_deploy/hosts/common.py @@ -3,6 +3,7 @@ from ceph_deploy.util.wrappers import check_call from ceph_deploy.util.context import remote from ceph_deploy import conf from StringIO import StringIO +from .. import lsb def ceph_version(conn, logger): @@ -31,10 +32,7 @@ def mon_create(distro, logger, args, monitor_keyring, hostname): logger.debug('remote hostname: %s' % hostname) path = paths.mon.path(args.cluster, hostname) done_path = paths.mon.done(args.cluster, hostname) - if distro.name.lower() == 'ubuntu': - init = 'upstart' - else: - init = 'sysvinit' + init = lsb.choose_init(distro.name, distro.codename) init_path = paths.mon.init(args.cluster, hostname, init)
Updated by Mark Kirkwood over 10 years ago
- File common.py.patch common.py.patch added
- File debian-mon-create.py.patch debian-mon-create.py.patch added
I notice I should have used "from ceph_deploy import lsb" in the above. Having said that - there is another place when a similar piece of logic is used to decide whether to use upstart or not. It seems to me that both of those are copying the logic that already exists in lsb - and we really should reuse that (so - ahem - if Ububntu change their init method again we only have to change the code in lsb to cope)!
patches attached :-)
Updated by Mark Kirkwood over 10 years ago
Sorry - was a bit keen with the 'submit' button! That mon create patch does is not really doing what it should, especially given what I wrote in the previous comment. So here is a revision that hopefully does. It also puts back some nice comments remininding us that Ubuntu currently uses upstart etc.
Updated by Alfredo Deza over 10 years ago
Mark,
Are you sure you are able to replicate this with the latest release of ceph-deploy?
This commit fixed that: https://github.com/ceph/ceph-deploy/commit/1d2d9881f93df6383d99720c84d6e7397a04bba0
The reason we are no longer using lsb for this is because we are deliberately wanting to use that abstraction in one place: ceph_deploy/hosts/__init__.py (although it does not use lsb.choose_init)
I am OK though accepting the patch to use lsb.choose_init. But I am still curious if you were able to replicate this problem without these changes and the latest release.
Updated by Mark Kirkwood over 10 years ago
With your commit 1d2d9881f93df6383d99720c84d6e7397a04bba0 the problem is solved. Absolutely. I was merely thinking that it made sense to use the logic in lsb rather than sprinkling "if distro == "ubuntu" in the actual mon code. Also makes the on code look like the osd code, that made sense too.
Given the origin of this bug, I was thinking that the fewer places logic to do with choosing which init was duplicated the better.
I like the idea of pushing that sort of logic into ceph_deploy/hosts/__init__.py - so maybe you should use lsb.choose_init there?
Yeah - no pressure for using my patches, I was just wanting to illustrate that using lsb was actually pretty tidy :-)
Updated by Alfredo Deza over 10 years ago
Mark, you are spot on.
I will create a new ticket so I can fix this and apply your branch, unless you want to submit a pull request?
That way I am not taking credit for your (much better) implementation :)
Updated by Mark Kirkwood over 10 years ago
Lol - I think opening a new ticket is fine. You can mention that you have discussed the proposed change with me.
Hmm - I don't currently have a (remote) branch setup, I'm just hacking away on master :-)
I'll have a think about how to adapt the patch(es) above to the idea or moving the init deciding to init.py, and if I get anything interesting happening there I'll note it on the (new) ticket!
Updated by Mark Kirkwood over 10 years ago
- File mon-create-lsb.patch mon-create-lsb.patch added
Ok here's my revised patch that hopefully incorporates what you were suggesting. Obviously feel free to editorialize as required :-)
Updated by Alfredo Deza over 10 years ago
I created a branch and applied your patch with one (minor) change which was to use `distro.init` for the RuntimeError instead of `init` (init was never defined)
Can you take a look and comment (and/or accept the pull request) ?
Pull Request: https://github.com/ceph/ceph-deploy/pull/40
Updated by Mark Kirkwood over 10 years ago
Looks good to me. Will see if I can accept pull request.