osd: include peer_info in pg query

This can be very useful when diagnosing peering problems.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/PG: move some pg stat update into a helper

When we publish PG stats to the monitor, we fill in a bunch of fields
with information about degraded objects, scrub timestamps, and other
sundry.

Move this into a helper that we will re-use shortly.

Note that we do *not* move anything that is semantically related to
the stats being published (like the 'reported' field).

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: update pg stat fields when they are queried

When we query a PG, fill in (most of) the same fields that get
populated when the stats are reported to the mon.

Fixes: #6988
Signed-off-by: Sage Weil <sage@inktank.com>
autoconf: trim duplicated headers

And sort the header list to help maintain uniqueness.

Signed-off-by: Loic Dachary <loic@dachary.org>
Fix typos in erasure code documents

Signed-off-by: Kun Huang <academicgareth@gmail.com>
Be more explicit how to discover available API calls

I believe it cannot hurt to be slightly more explicit about how
to retrieve API calls and provide examples.

Signed-off-by: David Moreau Simard <dmsimard@iweb.com>
librbd: better error when unprotect fails on unprotected snap

This will show up on the command line and logs, making it more
clear than EINVAL.

Fixes #6851 and #4045
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
rbd: return 0 and an empty list when pool is entirely empty

rbd_list will return -ENOENT when no rbd_directory object
exists. Handle this in the cli tool and interpret it as success with
an empty list.

Add this to the release notes since it changes command line behavior.

Fixes: #6693
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
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>
mon: do not use the keyring if auth = none

The Monitor::is_keyring_required() predicate is defined to be used in
the mkfs code path and not require the keyring to be set unless it is
actually going to be used.

If authentication is turned on later on existing monitors, the keyring
files will have to be set by an external tool in the mon data directory
and the mon restarted.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: fix indentation

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: implement --key for --mkfs

Allow --key to be used as an alternative to --keyring when ceph-mon
--mkfs runs. The key is wrapped inline into

     [mon.]
	key = AQDUS79S0AF9FRAA2cgRLFscVce0gROn/s9WMg==
	caps mon = "allow *"

and parsed with KeyRing::decode_plaintext which is made public.

Signed-off-by: Loic Dachary <loic@dachary.org>
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>
osdc: = is not a delimiter in --crush-location

When parsing the crush location

     --crush-location 'root=default host=hostA'

it must create the vector

     [ 'root=default', 'host=hostA' ]

but the default list of separators of get_str_vec includes = which will
create

     [ 'root', 'default', 'host', 'hostA' ]

instead. Set the list of delimiters to exclude = instead.

Signed-off-by: Loic Dachary <loic@dachary.org>
Merge pull request #1025 from pyKun/fix_typos

Fix typos in erasure code documents

Reviewed-by: Loic Dachary <loic@dachary.org>
Merge pull request #1028 from ceph/wip-empty-rbd-ls

rbd: return 0 and an empty list when pool is entirely empty

Reviewed-by: Sage Weil <sage@inktank.com>
common: CEPH_ARGS should trim whitespaces

CEPH_ARGS when parsed by env_to_vec did not trim trailing and leading
whitespaces: they would unexpectedly be parsed as empty arguments and
lead to confusing errors such as :

    CEPH_ARGS=' --id 3' ceph-conf --lookup mon-data
    unable to parse option: ''

The parsing code is replaced with str_vec(). It also resolves the
problem of the hard limit to 1000 characters imposed by the static
buffer that would silently truncate any CEPH_ARGS content.

Signed-off-by: Loic Dachary <loic@dachary.org>
ceph-conf: display arguments when an option cannot be parsed

   unable to parse option: ''

Is difficult to figure out. It is much better if shown in the context in
which it was found:

   ceph-conf --help ''
   unable to parse option: ''
   args: '--help' ''

Signed-off-by: Loic Dachary <loic@dachary.org>
Merge pull request #950 from ceph/wip-pg-stat

update pg stats when they are queried; share peer_info on query too

Reviewed-by: Loic Dachary <loic@dachary.org>