strerror_r is not portable; on Gnu libc it returns char * and sometimes
does not fill in the supplied buffer. Use autoconf to test which
version this platform uses and adapt.
Clean up the random calls to strerror and strerror_r (along with all
their private little one-use buffers) and regularize the code to use
cpp_strerror almost everywhere. Where changed, any negation of the
error code is also removed, since cpp_strerror() will do that.
Note: some tools were using their own calls to strerror/strerror_r, so
will now get a (%d) in their output that wasn't there before; hence
the change to test/cli/monmaptool/print-nonexistent.t
Fixes: #8041
Signed-off-by: Dan Mick <dan.mick@inktank.com>
This avoids starting up logging, which is not appropriate when we are
examining the config state and not actually starting up the entity in
question.
Fixes: #7849
Signed-off-by: Sage Weil <sage@inktank.com>
We don't need to worry about pidfile because that is done by the fork
functions, which ceph-conf doesn't call.
Signed-off-by: Sage Weil <sage@inktank.com>
If you are querying the conf for an osd and it has a log configured, we
should not generate any log activity.
This isn't super pretty, but it is much less intrusive that wiring a 'do
not log' flag down into CephContext and a zillion other places.
Fixes: #7849
Signed-off-by: Sage Weil <sage@inktank.com>
Extends getomapval and getompaheader to take an output
file argument the same way 'get' does. Removes misleading
'-o' line from usage(), there doesn't appear to be any
such
option.
Signed-off-by: John Spray <john.spray@inktank.com>
Fix usage output of ceph_filestore_dump
Add missing error checking
Output full object name
Improve message consistency
Fix program exit value
Signed-off-by: David Zafman <david.zafman@inktank.com>
For exposing test/dev functionality which uses
the cephfs client interface.
Initially just provides lookup-by-ino.
Fixes: #3863
Signed-off-by: John Spray <john.spray@inktank.com>
CID 716865 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
1. check_return: Calling function "getchar()" without checking return
value. This library function may fail and return an error code.
2. unchecked_value: No check of the return value of "getchar()"
Check really for 'enter' as the user asked for.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CID 1100693 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter superblock of type OSDSuperblock
(size 240 bytes) by value.
CID 1100694 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter sb of type OSDSuperblock (size 240 bytes)
by value.
CID 1100695 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter sb of type OSDSuperblock (size 240 bytes)
by value.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
The version of TEMP_FAILURE_RETRY found on Linux has a GNU extension
that squashes the unused return value warning where applicable. This
adds a VOID_TEMP_FAILURE_RETRY to make the case explicit, casting the
expression value to void to avoid the warning.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
We may have multiple pg shards on the same osd for an
ec pool. Thus, replicas must be referred to by <osd, shard>
and pgs by <pgid, shard>.
Signed-off-by: Samuel Just <sam.just@inktank.com>
--test-map-pgs mode allows to map all pgs from either all pools or just
one pool. Mention it in usage output.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Commit 7f1b12f2ef ("osdmaptool: add --test-map-pgs mode") broke
--pool for --test-map-object mode. Fix it, and improve --pool option
handling for both modes while at it (report strict_strtol() errors,
check if specified pool exists).
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
A few places were not checking the return values of commands, since
they could not fail before timeouts were added.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This command will map all pgs from all pools (or just one pool) to osds
and summarize the placement and calculate the actual standard deviation and
the expected value.
Signed-off-by: Sage Weil <sage@inktank.com>
We do three things here:
- make cache-evict a CACHE instead of WR op, allowing us to submit it
on snaps (not just head)
- allow eviction of a snap
- verify that all snaps are missing before evicting a head
Signed-off-by: Sage Weil <sage@inktank.com>
* dump the crush tree created by --build at debug level 1.
* display a warning at debug level 1 if there is more than one root. In
most cases it is not what the user wants and it may be confusing
because the ruleset will only apply to the first of root and have less
devices under it as expected.
Signed-off-by: Loic Dachary <loic@dachary.org>
Instead of creating a ruleset from scratch, use the
OSDMap::build_simple_crush_rulesets helper. It is more likely to match
the user expecations.
Signed-off-by: Loic Dachary <loic@dachary.org>
When the number of args provided to --build is not a multiple of 3,
display the arguments which do not comply.
For instance the --debug_crush 0 option is not consumed by global_init
in crushtool because, unlike most ceph tools, the arguments are not
passed to global_init. As a result --debug_crush 0 become part of the
arguments and triggers the failure.
crushtool --debug_crush 0 --build --num_osds 320 node straw 4
remaining args: [--debug_crush,0,node,straw,4]
layers must be specified with 3-tuples of (name, buckettype, size)
Signed-off-by: Loic Dachary <loic@dachary.org>