Commit Graph

134 Commits

Author SHA1 Message Date
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
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
Alfredo Deza
897dfc113f use the new get_command helper in check_call
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2013-12-13 12:06:25 -05:00
Alfredo Deza
a9334a1c8c use the absolute path for executables if found
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2013-12-12 11:16:38 -05:00
Alfredo Deza
43561f7916 remove trailing semicolon
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2013-12-12 10:26:05 -05:00
Alfredo Deza
e19e38012b replace sgdisk subprocess calls with a helper
Signed-off-by: Alfredo Deza <alfredo@deza.pe>
2013-12-11 15:41:45 -05:00
Jonathan Davies
35011e0b01 Call --mbrtogpt on journal run of sgdisk should the drive require a GPT table.
Signed-off-by: Jonathan Davies <jonathan.davies@canonical.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Loic Dachary <loic@dachary.org>
2013-12-04 13:57:13 +00:00
Loic Dachary
6570197871 ceph-disk: blacklist /dev/fd0
blkid -s TYPE /dev/fd0 has been verified to hang forever on a
H8DMR-82 supermicro motherboard running

3.8.0-33-generic #48~precise1-Ubuntu SMP Thu Oct 24 16:28:06 UTC 2013
x86_64

It is unlikely that ceph will ever be used on floppy disks, they
can be blacklisted.

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

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-12-03 09:31:05 +01:00
git-harry
22f8325dbf Make fsid comparison case-insensitive
get_fsid and find_cluster_by_uuid are modified so ceph-disk activate and
ceph-disk activate-all will work if the fsid uses uppercase characters.

Signed-off-by: Harry Harrington <git-harry@live.co.uk>
2013-10-03 10:32:50 +01:00
Alfredo Deza
8fb7a47601 Merge pull request #678 from ceph/wip-5981
ceph-disk: make initial journal files 0 bytes
2013-10-02 11:13:43 -07:00