mds: always store backtrace xattr in the default pool

when creating file in non-default pool, we need to store a backtrace
in the default pool in addition to the specified pool. Otherwise the
'lookup-by-ino' function will consider backtrace for file is missing.

Fixes: #6914
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: don't allow changing layout for non-regular file

layout is meaningless for non-regular file. using non-default layout
may make backtrace less efficiency.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Merge pull request #1029 from ceph/wip-6914

Wip 6914

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1012 from dachary/wip-mon-mkfs

unit tests for ceph-mon --mkfs
init-ceph: pass config file path when adjust crush position

Fixes: #6591
Reported-by: Sean Noonan <sean.noonan@twosigma.com>
Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk: fix Error() messages formatting

Mainly using % instead of ,

Signed-off-by: Loic Dachary <loic@dachary.org>
ceph-disk: remove noop try:

Signed-off-by: Loic Dachary <loic@dachary.org>
ceph-disk: fix activate() indent

Signed-off-by: Loic Dachary <loic@dachary.org>
ceph-disk: do not hide main_activate() exceptions

Signed-off-by: Loic Dachary <loic@dachary.org>
ceph-disk: make exception handling terse in main_activate_journal

Signed-off-by: Loic Dachary <loic@dachary.org>
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>
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>
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>
ceph-disk: use CalledProcessError.returncode

CalledProcessError has no errno data member

Signed-off-by: Loic Dachary <loic@dachary.org>
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>
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>
ceph-disk: run ceph-osd when --mark-init=none

Signed-off-by: Loic Dachary <loic@dachary.org>
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>
ceph-disk: add copyright notice

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