Commit Graph

142 Commits

Author SHA1 Message Date
Sage Weil
11496399ef ceph-disk: mount xfs with inode64 by default
We did this forever ago with mkcephfs, but ceph-disk didn't.  Note that for
modern XFS this option is obsolete, but for older kernels it was not the
default.

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
2014-09-15 15:29:08 -07:00
Alfredo Deza
dc611e864b Merge pull request #2247 from ceph/wip-ceph-disk
ceph-disk: fix various dmcrypt bugs

Reviewed-by: Alfredo Deza <adeza@redhat.com>
2014-08-15 19:40:15 -04:00
Alfredo Deza
d74ed9d53f ceph-disk: linter cleanup
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-08-13 17:00:33 -04:00
Sage Weil
6f7798e37e ceph-disk: warn about falling back to sgdisk (once)
This way the user knows something funny might be up if dmcrypt is in use.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-13 12:00:50 -07:00
Sage Weil
b1651afb34 ceph-disk: only fall back to sgdisk for 'list' if blkid seems old
If the blkid doesn't show us any ID_PART_ENTRY_* fields but we know it is
a GPT partition, *then* fallback.  Otherwise, don't bother.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-13 11:52:14 -07:00
Sage Weil
b75e8a340c ceph-disk: add get_partition_base() helper
Return the base devices/disk for a partition device.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-13 11:52:14 -07:00
Sage Weil
c7a1ceba44 ceph-disk: display information about dmcrypted data and journal volumes
Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-13 11:52:14 -07:00
Sage Weil
f80ed26d24 ceph-disk: move fs mount probe into a helper
Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-12 17:25:42 -07:00
Sage Weil
6c77f5f2f9 ceph-disk: use partition type UUIDs, and blkid
Use blkid to give us the GPT partition type.  This lets us distinguish
between dmcrypt and non-dmcrypt partitions.  Fake it if blkid doesn't
give us what we want and try with sgdisk.  This isn't perfect (it can't
tell between dmcrypt and not dmcrypt), but such is life, and we are better
off than before.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-12 17:25:10 -07:00
Sage Weil
1088d6cd11 ceph-disk: fix log syntax error
File "/usr/sbin/ceph-disk", line 303, in command_check_call
    LOG.info('Running command: %s' % ' '.join(arguments))
TypeError: sequence item 2: expected string, NoneType found

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-12 13:53:16 -07:00
Sage Weil
2edf01ffa4 Revert "Fix for bug #6700"
This reverts commit 673394702b.

This appears to break things when the journal and data disk are *not* the same.
And I can't seem to reproduce the original failure...

Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-11 15:58:15 -07:00
Sage Weil
d6e6ba198e ceph-disk: fix verify_no_in_use check
We only need to verify that partitions aren't in use when we want to
consume the whole device (osd data), not when we want to create an
additional partition for ourselves (osd journal).

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
2014-08-11 15:57:56 -07:00
Alfredo Deza
d0ccb1cbef make ceph-disk use the new init flag for cluster
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-08-07 11:11:57 -04:00
Alfredo Deza
9e08e3a779 when starting an OSD, pass in the cluster name
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-08-06 15:29:42 -04:00
Owen Synge
b4c80e31e3 Do not make directories by mistake.
Rational: I found I had created a series of OSD directories under "/dev/" when disks I thought existed did not exist.
Warning: This change will be noticed by end users and may effect deployment infrastructures.

Signed-off-by: Owen Synge <osynge@suse.com>
2014-08-05 17:28:16 +02:00
Alfredo Deza
420f0a471a set the default log level to WARNING
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-07-16 11:11:01 -04:00
Sage Weil
ad81a98e09 Revert "ceph-disk: Enable creating multiple osds per dev"
This reverts commit 200d0ae9c6.

This breaks ceph-disk.  See #8644.  Reverting for now.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-06-26 11:37:15 -07:00
Sage Weil
31721eef40 Merge pull request #2006 from ceph/wip-8603
log the command that is being run with subprocess

Reviewed-by: Sage Weil <sage@redhat.com>
2014-06-25 10:50:49 -07:00
Alfredo Deza
e189a66828 log the command that is being run with subprocess
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-06-20 11:14:25 -04:00
Alfredo Deza
ef8a128151 support dmcrypt partitions when activating
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-06-17 09:06:07 -04:00
Steve Taylor
673394702b Fix for bug #6700
When preparing OSD disks with colocated journals, the intialization process
fails when using dmcrypt. The kernel fails to re-read the partition table after
the storage partition is created because the journal partition is already in use
by dmcrypt. This fix unmaps the journal partition from dmcrypt and allows the
partition table to be read.

Signed-off-by: Stephen F Taylor <steveftaylor@gmail.com>
2014-06-10 12:42:55 -06:00
Sage Weil
624ae21833 Merge pull request #1859 from ceph/wip-multipartition
ceph-disk: Enable creating multiple osds per dev

Reviewed-by: Dan Mick <dan.mick@inktank.com>
2014-06-05 12:08:33 -07:00
Alfredo Deza
1ac3a503a1 better error reporting on incompatible device requirements
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2014-05-27 12:54:49 -04:00
John Spray
200d0ae9c6 ceph-disk: Enable creating multiple osds per dev
This is useful for demos and testing.  Enables
creation of lots of OSDs on a single block device
by simply running ceph-disk prepare more than once,
with a --data-size argument set.

Signed-off-by: John Spray <john.spray@inktank.com>
2014-05-23 18:38:21 +01:00
Alfredo Deza
fc263c3fc2 Merge pull request #1778 from ceph/wip-7157
ceph-disk: fix list for encrypted or corrupt volume

Reviewed-by: Alfredo Deza <alfredo.deza@inktank.com>
2014-05-08 12:13:58 -04:00
Sage Weil
0f196265f0 ceph-disk: partprobe before settle when preparing dev
Two users have reported this fixes a problem with using --dmcrypt.

Fixes: #6966
Tested-by: Eric Eastman <eric0e@aol.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2014-05-08 08:52:51 -07:00
Stuart Longland
09beebe3f1 ceph-disk: fix list for encrypted or corrupt volume
Continue gracefully if an fs type is not detected, either because it is
encrypted or because it is corrupted.

Signed-off-by: Sage Weil <sage@inktank.com>
2014-05-06 14:06:38 -07:00
Sébastien Han
855edc6e6b Fix typo ceph-disk
Fix typo

Signed-off-by: Sébastien Han <sebastien.han@enovance.com>
2014-03-02 23:51:17 +01:00
Alfredo Deza
9bcc42a3e6 alert the user about error messages from partx
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2014-02-10 15:09:39 -05:00
Alfredo Deza
42900ff9da use partx for red hat or centos instead of partprobe
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2014-02-10 15:09:18 -05:00
Loic Dachary
ad515bfec3 ceph-disk: support and test the absence of PATH
Although this is not exactly the context in which ceph-disk is run when
invoked by udev, it makes sure there is at least one sensible way of
using it when PATH is undefined.

Also make src/ceph.in not fail if PATH is not defined.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-30 20:11:02 +01:00
Josh Durgin
d7b0c7faaf ceph-disk: run the right executables from udev
When run by the udev rules, PATH is not defined. Thus,
ceph-disk-activate relies on its which() function to locate the
correct executable.  The which() function used os.defpath if none was
set, and this worked for anything using it.

ad6b4b4b08 added a new default value to
PATH, so only /usr/bin was checked by callers that did not use
which(). This resulted in the mount command not being found when
ceph-disk-activate was run by udev, and thus osds failing to start
after being prepared by ceph-deploy.

Make ceph-disk consistently use the existing helpers (command() and
command_check_call()) that use which(), so lack of PATH does not
matter. Simplify _check_output() to use command(),
another wrapper around subprocess.Popen.

Fixes: #7258
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2014-01-28 17:27:21 -08:00
Loic Dachary
a71025d336 ceph-disk: implement --sysconfdir as /etc/ceph
Replace hardcoded /etc/ceph with the SYSCONFDIR global variable and
implement the --sysconfdir option to override the default value.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:41 +01:00
Loic Dachary
ca713f48ae ceph-disk: implement --statedir as /var/lib/ceph
Replace hardcoded /var/lib/ceph with the STATEDIR global variable and
implement the --statedir option to override the default value.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:41 +01:00
Loic Dachary
51ee3c0477 ceph-disk: add copyright notice
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:41 +01:00
Loic Dachary
306b099ab0 ceph-disk: create the data directory if it does not exist
Instead of failing if the OSD data directory does not exist, create
it. Only do so if the data directory is not enforced to be a device via
the use of the --data-dev flag. The directory is not recursively created.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:41 +01:00
Loic Dachary
0fcc081858 ceph-disk: run ceph-osd when --mark-init=none
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
e773b68f4c ceph-disk: implement --mark-init=none
It is meant to be used when preparing and activating a directory that is
not to be used with init. No file is created to identify the init
system, no symbolic link is made to the directory in /var/lib/ceph
and the init scripts are not called.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
b65eb377f5 ceph-disk: fsid is a known configuration option
Use get_conf_with_default instead of get_conf because fsid is a known
ceph configuration option. It allows overriding via CEPH_ARGS which is
convenient for testing. Only options that are not found in config_opts.h
are fetch via get_conf.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
97f516a1dd ceph-disk: use CalledProcessError.returncode
CalledProcessError has no errno data member

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
d09af0fa50 ceph-disk: display the command output on OSD creation failure
The string form of a CalledProcessError instance does not include the
output datamember. Add it to the Error exception for debug purposes.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
2b935bbf60 ceph-disk: which() uses PATH first
Instead of relying on a hardcoded set of if paths. Although this has the
potential of changing the location of the binary being used by ceph-disk
on an existing installation, it is currently only used for sgdisk. It
could be disruptive for someone using a modified version of sgdisk but
the odds of this happening are very low.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
ad6b4b4b08 ceph-disk: add --prepend-to-path to control execution
/usr/bin is hardcoded in front of some ceph programs which makes it
impossible to control where they are located via the PATH.

The hardcoded path cannot be removed altogether because it will most
likely lead to unexpected and difficult to diagnose problems for
existing installations where the PATH finds the program elsewhere.

The --prepend-to-path flag is added and defaults to /usr/bin : it prepends
to the PATH environment variable. The hardcoded path is removed
and the PATH will be used: since /usr/bin is searched first, the
legacy behavior will not change.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
908348b804 ceph-disk: make exception handling terse in main_activate_journal
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
55ca7bb2da ceph-disk: do not hide main_activate() exceptions
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
324804a81c ceph-disk: fix activate() indent
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
de0050596b ceph-disk: remove noop try:
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
b82ccfbfa7 ceph-disk: fix Error() messages formatting
Mainly using % instead of ,

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-03 16:30:40 +01:00
Loic Dachary
7dfe550ce1 ceph-disk: prepare --data-dir must not override files
ceph-disk does nothing when given a device that is already prepared. If
given a directory that already contains a successfully prepared OSD, it
will however override it.

Instead of overriding the files in the osd data directory, return
immediately if the magic file exists. Make it so the magic file is
created last to accurately reflect the success of the OSD preparation.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-01-01 11:48:24 +01:00
Loic Dachary
07888ef3fd ceph-disk: zap needs at least one device
If given no argument, ceph-disk zap should display the usage instead of
silently doing nothing. Silence can be confused with "I zapped all the
disks".

http://tracker.ceph.com/issues/6981 fixes #6981

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-12-15 15:34:17 +01:00