Commit Graph

66 Commits

Author SHA1 Message Date
Yan, Zheng
69e2060f17 init-ceph: replace 'echo -n' with printf
'echo -n' is no portable. On OSX, output of 'echo -n' can be '-n'

Signed-off-by: Yan, Zheng <zyan@redhat.com>
2015-08-31 16:00:24 +08:00
Alfredo Deza
3fb25c28e8 use name in /var/lib/ceph paths
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-08-06 15:30:09 -04:00
Sage Weil
6a7e20147c init-ceph: continue after failure doing osd data mount
If we are starting many daemons and hit an error, we normally note it and
move on.  Do the same when doing the pre-mount step.

Fixes: #8554
Signed-off-by: Sage Weil <sage@inktank.com>
2014-06-08 20:18:49 -07:00
Josh Durgin
5e34beb61b init, upstart: prevent daemons being started by both
There can be only one init system starting a daemon. If there is a
host entry in ceph.conf for a daemon, sysvinit would try to start it
even if the daemon's directory did not include a sysvinit file. This
preserves backwards compatibility with older installs using sysvinit,
but if an upstart file is present in the daemon's directory, upstart
will try to start them, regardless of host entries in ceph.conf.

If there's an upstart file in a daemon's directory and a host entry
for that daemon in ceph.conf, both sysvinit and upstart would attempt
to manage it.

Fix this by only starting daemons if the marker file for the other
init system is not present. This maintains backwards compatibility
with older installs using neither sysvinit or upstart marker files,
and does not break any valid configurations. The only configuration
that would break is one with both sysvinit and upstart files present
for the same daemon.

Backport: emperor, dumpling
Reported-by: Tim Spriggs <tims@uahirise.org>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-12-03 15:28:05 -08:00
Sage Weil
87c98e92d1 sysvinit, upstart: handle symlinks to dirs in /var/lib/ceph/*
Match a symlink to a dir, not just dirs.  This fixes the osd case of e.g.,
creating an osd in /data/osd$id in which ceph-disk makes a symlink from
/var/lib/ceph/osd/ceph-$id.

Fix proposed by Matt Thompson <matt.thompson@mandiant.com>; extended to
include the upstart users too.

Fixes: #5490
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2013-07-02 14:43:17 -07:00
Sage Weil
c80c6a032c sysvinit: fix enumeration of local daemons when specifying type only
- prepend $local to the $allconf list at the top
- remove $local special case for all case
- fix the type prefix checks to explicitly check for prefixes

Fugly bash, but works!

Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2013-05-16 20:39:32 -07:00
Sage Weil
d395aa521e init-ceph: do not stop start on first failure
When starting we often loop over many daemon instances.  Currently we stop
on the first error and do not try to start other daemons.

Instead, try them all, but return a failure if anything did not start.

Fixes: #2545
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
2013-04-19 13:05:43 -07:00
Danny Al-Gaaf
0c43ac32a2 ceph_common.sh: fix typo in comment
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-27 14:37:49 +01:00
Gary Lowell
ce7ee72792 ceph_common.sh: Fix sed regex in get_local_daemon_list
In get_local_daemon_list() the sed expression trimming the cluster
name from the host name was trimming too much if the host name
contained hyphens.

Signed-off-by: Gary Lowell  <gary.lowell@inktank.com>
2013-03-14 10:02:14 -07:00
Dan Mick
c7aa897ce0 ceph_common.sh: add warning if 'host' contains dots
This is a common error and there's no reason the script can't
at least tell you it's a really bad idea.  One might argue it
could even successfully proactively truncate the host parameter
at the first dot, but that's a little controlling, perhaps.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2013-03-08 17:10:11 -08:00
Sage Weil
95a379aa73 ceph_common.sh: tolerate missing mds, mon, osds in conf
With set -e this seems to fail (at least on some machines) if, say, there
is no MDS in the conf file.  This fixes it.

Tested-by: Mark Nelson <mark.nelson@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2013-02-26 11:10:44 -08:00
Sage Weil
dd007db3ca ceph_common.sh: fix iteration of items in ceph.conf
This broke in c8f528a407.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-02-21 17:30:06 -08:00
Sage Weil
28e7212d38 ceph_common: fix check for defined/undefined entities in conf
Signed-off-by: Sage Weil <sage@inktank.com>
2013-02-17 10:39:44 -08:00
Danny Al-Gaaf
aa4cae66f0 ceph_common.sh: check if $sshdir exist, otherwise create it
Check if $sshdir exist. If not, create it before cd to the
directory.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-02-14 18:12:30 +01:00
Sage Weil
c8f528a407 init-ceph: iterate/locate local sysvinit-tagged directories
Search /var/lib/ceph/$type/ceph-$id and start/stop those daemons if
present and tagged with the sysvinit file.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-02-13 12:30:22 -08:00
Sage Weil
b8aa4769a6 init-ceph: consider sysvinit-tagged dirs as local
If there is a 'sysvinit' file in the daemon directory in the default
location (/var/lib/ceph/$type/ceph-$id), consider it sysvinit-managed.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-02-13 12:30:22 -08:00
Sage Weil
671c4c32f4 ceph_common.sh: 'hostname -s' (instead of cut ...)
This will also match up with the instructions in the docs.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-20 10:12:30 -07:00
Tommi Virtanen
6a9bcc09a3 mkcephfs, init-ceph: Warn if hostname "localhost" is seen in ceph.conf.
Given a ceph.conf that looks like

  [osd.42]
  host = localhost

mkcephfs used to exit with an obscure error message:

  cat: /tmp/mkcephfs.MCBIHvn4Ru/key.*: No such file or directory

"localhost" was never intended to be a valid hostname to use there.
Warn if we see it, and skip the entry. You should use the proper short
hostname of the box.

As init-ceph and mkcephfs share this library, this change affects the
sysvinit scripts too. The behavior *shouldn't* change there (localhost
entries were ignored earlier, too), but you may see this extra
warning. Which is good.

Closes: #3001
Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-08-20 17:16:41 -07:00
Sage Weil
288635843a init-ceph: ignore sections without 'host' defined
This will make it easier for sysvinit and upstart to coexist.

We will break existing users who have a separate .conf for each node and
didn't add host lines.  We'll need to make note of that in the release
notes.

Fixes: #2404
Signed-off-by: Sage Weil <sage@inktank.com>
2012-05-16 16:36:52 -07:00
Tommi Virtanen
29c01f2511 ceph_common.sh: Remove dead code.
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
2012-03-30 11:57:51 -07:00
Sage Weil
6f8f140350 c* -> ceph-*
Hopefully I didn't miss too much...

Signed-off-by: Sage Weil <sage@newdream.net>
2011-09-22 15:08:25 -07:00
Tommi Virtanen
d64237a6a5 ceph_common.sh: Do not sudo to root unless needed
Using do_root_cmd() doesn't really need to sudo to root
if you're already root.

Commit 71dc75bdaf causes a regression:
when system "foo" has a sudoers config that requires a tty,
init-ceph now fails like this:
  sudo: sorry, you must have a tty to run sudo

when it is invoked by root with something like this:
   ssh foo /etc/init.d/init-ceph start

Signed-off-by: Jim Schutt <jaschut@sandia.gov>
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
2011-09-19 09:47:11 -07:00
Tommi Virtanen
71dc75bdaf mkcephfs: Config $user is irrelevant when we want to run as root.
It used to just not sudo if $user was empty, on non-ssh do_root_cmd's.
This bug was exposed by commit 47b09e2f04.

Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
2011-09-06 15:57:17 -07:00
Sage Weil
c9154c0968 mkcephfs, init-ceph: tolerate complete lack of a type
We were bailing out of mkcephfs with a config with no mds's defined
(because we set -e and grep returns an error here).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-04-15 14:03:59 -07:00
Sage Weil
a373a3d5cc mkcephfs: some fixes
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-03-11 16:22:19 -08:00
Sage Weil
d0abd58e4c mkcephfs: modularize
The goal is to support the old "ssh to everything" mode and also a
piecewise mode that lets the administrator do each step and handle
data copying and remote execution themselves.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-03-10 08:11:05 -08:00
Colin Patrick McCabe
8e3abf3ce3 Don't use -i to set id for non-daemons
Due to conflicts, don't use -i to set id except for daemons.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-03-10 07:49:03 -08:00
Colin Patrick McCabe
713f9a11dd cconf: remove second argument to cconf --lookup
Everyone uses get_conf to get configuration values. So the logic for
defaulting to some value if we can't find the requested key should live
there. Also fix a case in cconf where we could encounter a usage error
and keep on going.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-23 10:17:30 -08:00
Colin Patrick McCabe
29b6439104 ceph_common.sh: remove get_val, get_val_bool
get_val and get_val_bool are unused.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-23 10:17:30 -08:00
Sage Weil
a7deada229 init-ceph: DTRT when cconf returns host = localhost
cconf behavior was just changed by bcf1bdef56

Signed-off-by: Sage Weil <sage@newdream.net>
2010-10-07 07:28:58 -07:00
Sage Weil
3733b177ee initscripts: fix type.id check in ceph.conf 2010-07-23 16:05:20 -07:00
Sage Weil
d665d4949d initscripts: use $type.$id, not $name, when possible 2010-07-22 14:27:08 -07:00
Sage Weil
de9262e995 initscripts: accept osd0 or osd.0, regardless of what conf uses 2010-07-22 14:26:49 -07:00
Fred Ar
6cca139f0a shell script fixes 2010-07-07 07:47:57 -07:00
Sage Weil
ae90ba1828 initscripts: fix verbose output for root commands 2010-06-18 13:56:24 -07:00
Sage Weil
ba5a0d1ff6 fetch_config: enable fetching ceph.conf from a remote location
fetch_config: always fetch if script exists and is executable

fetch_config: make /etc/ceph/sample.fetch_config +x

Makefile: fix whitespace
2010-04-20 16:38:48 -07:00
Sage Weil
51081fa307 init-ceph: return success error code on missing ceph.conf if no -c
This will avoid errors when installing/removing the unconfigured
package.
2010-03-03 14:40:31 -08:00
Sage Weil
72d7117771 init-ceph: print 'already started' instead of failing to start 2010-02-12 14:20:02 -08:00
Sage Weil
28783e35af ceph_common: sudo su, not su 2010-02-11 15:37:27 -08:00
Sage Weil
0a6e4ed38a mkcephfs: misc cephx fixes 2010-02-05 14:11:49 -08:00
Sage Weil
9a7fdb22a9 initscripts: do what we can to run as user specified in the conf 2009-07-13 10:38:23 -07:00
Sage Weil
5bb2968985 initscripts: substitute in proper autoconf paths
Based on
http://www.gnu.org/software/hello/manual/autoconf/Installation-Directory-Variables.html
2009-07-13 10:30:43 -07:00
Sage Weil
4583506404 initscripts: fix do_root_cmd
sudo bash -c "echo foo" works, sudo "echo foo" does not.
2009-06-30 12:16:54 -07:00
Sage Weil
c0892b20cc initscripts: do mount/mkfs as root, otherwise as any user
We want cosd to run unprivileged if possible.
2009-06-25 14:03:44 -07:00
Sage Weil
35ac86ee27 initscripts: allow 'user' option, defaults to current user 2009-06-25 10:22:33 -07:00
Sage Weil
d020419ba7 initscript: fix instance check, again 2009-05-29 17:07:29 -07:00
Sage Weil
f8d48369a6 initscript: fix instance check 2009-05-27 14:03:46 -07:00
Sage Weil
82031ad9e0 initscript: fix instance check 2009-05-19 10:18:16 -07:00
Sage Weil
de0611c260 initscript: make sure cmdline instance exists 2009-05-18 12:01:21 -07:00
Sage Weil
b33f706551 initscript: cleanup debug 2009-04-23 16:48:53 -07:00