Project

General

Profile

Actions

Bug #5911

closed

ceph-deploy to Ubuntu targets touches sysvinit for mons and upstart for osds

Added by Mark Kirkwood over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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/
total 8
-rw-r--r-
1 root root 0 Aug 9 12:44 done
rw-r--r- 1 root root 77 Aug 9 12:44 keyring
drwxr-xr-x 2 root root 4096 Aug 9 12:49 store.db
rw-r--r- 1 root root 0 Aug 9 12:44 sysvinit

$ ls l /var/lib/ceph/osd/ceph-0/
total 52
-rw-r--r-
1 root root 481 Aug 9 12:45 activate.monmap
rw-r--r- 1 root root 3 Aug 9 12:45 active
rw-r--r- 1 root root 37 Aug 9 12:45 ceph_fsid
drwxr-xr-x 196 root root 8192 Aug 9 12:46 current
rw-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
-rw-r--r-
1 root root 37 Aug 9 12:45 journal_uuid
rw------ 1 root root 56 Aug 9 12:45 keyring
rw-r--r- 1 root root 21 Aug 9 12:45 magic
rw-r--r- 1 root root 6 Aug 9 12:45 ready
rw-r--r- 1 root root 4 Aug 9 12:45 store_version
rw-r--r- 1 root root 0 Aug 9 12:49 upstart
rw-r--r- 1 root root 2 Aug 9 12:45 whoami


Files

common.py.patch (881 Bytes) common.py.patch use lsb modude to get init Mark Kirkwood, 08/09/2013 11:12 PM
debian-mon-create.py.patch (1004 Bytes) debian-mon-create.py.patch use lsb module to get init Mark Kirkwood, 08/09/2013 11:12 PM
debian-mon-create.py-1.patch (1.26 KB) debian-mon-create.py-1.patch Really handle the possibility of additional init types Mark Kirkwood, 08/09/2013 11:42 PM
mon-create-lsb.patch (2.19 KB) mon-create-lsb.patch use lsb module in __init__.py to simplify get init logic Mark Kirkwood, 08/12/2013 06:35 PM
Actions #1

Updated by Ian Colle over 10 years ago

  • Assignee set to Alfredo Deza
Actions #2

Updated by Sage Weil over 10 years ago

  • Priority changed from Normal to Urgent
Actions #3

Updated by Ian Colle over 10 years ago

  • Project changed from Ceph to devops
Actions #4

Updated by Alfredo Deza over 10 years ago

  • Status changed from New to Fix Under Review
Actions #5

Updated by Sage Weil over 10 years ago

  • Status changed from Fix Under Review to Resolved
Actions #6

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?

Actions #7

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

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 :-)

Actions #9

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.

Actions #10

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.

Actions #11

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 :-)

Actions #12

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 :)

Actions #13

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!

Actions #14

Updated by Mark Kirkwood over 10 years ago

Ok here's my revised patch that hopefully incorporates what you were suggesting. Obviously feel free to editorialize as required :-)

Actions #15

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

Actions #16

Updated by Mark Kirkwood over 10 years ago

Looks good to me. Will see if I can accept pull request.

Actions

Also available in: Atom PDF