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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
/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>
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>
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/6981fixes#6981
Signed-off-by: Loic Dachary <loic@dachary.org>