Sage Weil [Mon, 30 Sep 2019 15:58:40 +0000 (10:58 -0500)]
mon/MonClient: interpret numeric mon target name as rank
This allows us to behave when a rank is passed to mon_command(..., target=),
which will call rados_mon_command_target() -> MonClient::start_mon_command
with a (string) target name.
We could make an integer variant of rados_mon_command_target, and do the
int vs string differentiation in python, but this is much easier.
Sage Weil [Fri, 27 Sep 2019 21:01:44 +0000 (16:01 -0500)]
mgr,mgr/MgrClient: use fsid to signal mon-mgr vs cli MCommands
We can't use the feature bit for the MCommand connection to tell whether
it is a tell or CLI command because new clients may have to send CLI
commands via MCommand for old clusters, and they don't always know whether
this mgr is new or old yet.
Prior to octopus, MCommand contained a mon/mgr CLI command, and did not
have the fsid field set. Start populating the fsid field, and use this
to signal whether a client is a new MgrClient that knows MCommand vs
MMgrCommand. If we get an MCommand with the fsid set, that means it is
a tell command; otherwise, it's an old client sending a CLI command.
Sage Weil [Thu, 19 Sep 2019 16:11:55 +0000 (11:11 -0500)]
common/admin_socket: pass Formatter from generic infrastructure
The implementation can choose to either use the provided Formatter, or
put something directly into outbl. The implementation may choose to
flush the formatter to the output buffer|stream, or let the caller do it
for them (usually the latter).
Lots of fiddling/cleanup in the implementations to make this build,
including dropping the (seeminlyg unused?) ostream& output mode for
the librbd asok implementations.
Sage Weil [Tue, 10 Sep 2019 15:21:39 +0000 (10:21 -0500)]
common/admin_socket: report error code as part of output string
This isn't ideal, but it's better than nothing.
Net behavior change here is that calling an non-existant command now
succeeds with an error message instead of exiting with an error code
and no informative output.
Sage Weil [Tue, 10 Sep 2019 21:41:18 +0000 (16:41 -0500)]
osdc/Objecter: resend OSD tell commands on EAGAIN
Request map *and* resend. We don't have map epoch info about when the
reply was sent, and the OSD isn't ordering with respect to epochs anyway.
So, resend now, just in case we already saw a map change, or because we
were suffering from a peering vs command race on the OSD side, and then
also request a new map from the mon, in case we are missing a map update.
Sage Weil [Tue, 10 Sep 2019 03:07:03 +0000 (22:07 -0500)]
osd: route tell commands to asok; migrate commands
- move items from _do_command to asok_command in OSD.cc
- update PG::do_command to take a std::function on_finish
- sprinkle in some osd_lock locking (_do_command implicitly locks osd_lock,
asok_command() does not; most commands don't need it)
Sage Weil [Fri, 6 Sep 2019 20:18:12 +0000 (15:18 -0500)]
mon/MonClient: send tell commands out of band via MCommand
The current tell mon command handling is pretty fragile and semi-broken:
we force the client to (exclusively) connect to the target mon, disrupting
other monclient business, and the retry logic is fragile.
Instead, use entirely independent connections for each tell command, and
tear them down when we get a reply. Implement independent and simple
error handling and timeouts.
Keep most of the old behavior alive so that we can still use tell against
pre-octopus mons.
Sage Weil [Fri, 6 Sep 2019 15:36:31 +0000 (10:36 -0500)]
common/admin_socket: return int from hook call()
Previously, call() returned a bool. Return an int instead so we can
wire this up to tell command return values.
The admin socket 'ceph daemon ...' unix domain socket protocol does not
pass a return code, only data, so we cannot pass these errors that way.
We have two choices: make error codes silently succeed when accessed via
asok (so that we get an error string etc), or make them fail without any
specific error code or string.
Unfortunately, there are several cases where an exception was caught and
what() returned as a string, or where error strings are returned. These
would "blindly" fail if we took the latter approach.
So, for the asok interface, -ENOSYS means a "hard" error that gives the
user no data and makes the 'ceph daemon ...' command return an error code.
Other error codes are interpreted as a success. This is ONLY for the
asok interface; the tell interface has full fidelity with error codes and
error strings.
Note that this means that 'net new' tell-style commands that we move over
to this handler will also appear to succeed via the 'ceph daemon'
interface when they return error codes.
Sage Weil [Fri, 6 Sep 2019 14:44:23 +0000 (09:44 -0500)]
mgr/DaemonServer: route MCommand (for octopus+) to asok commands
Send mgr 'tell' commands (if they originate from a octopus+ client that
knows the difference between MCommand and MMgrCommand) to the asok
comand queue.
Sage Weil [Tue, 10 Sep 2019 18:53:54 +0000 (13:53 -0500)]
pybind/ceph_argparse: disambiguate mgr tell and CLI commands
The mgr tell commands are somewhat special in that you can tell the mgr
with an empty id ('ceph tell mgr' or target ('mgr', '')) to get the
currently active mgr. This makes it hard to disabiguate between a tell
command and a CLI command.
Fix that by explicitly setting the target to 'mon-mgr' when a CLI command
is flagged as a mgr command.
Sage Weil [Thu, 5 Sep 2019 22:11:26 +0000 (17:11 -0500)]
common/admin_socket: simplify command routing
Back in e30e937c8962249af283a7571eb106ef444b79e3 we made it possible to
route a command via any prefix. This worked when we wanted to pass
arguments but were just dealing with a vector<string>. These days we have
an actual prefix followed by named arguments, so we don't need this
ad hoc routing.
Derive the prefix from the cmddesc at registration time, and match that
explicitly against the prefix at execution time.
mgr/dashboard: Bucket names cannot be formatted as IP address
In general, bucket names should follow domain name constraints:
- Bucket names must be unique.
- Bucket names cannot be formatted as IP address.
- Bucket names can be between 3 and 63 characters long.
- Bucket names must not contain uppercase characters or underscores.
- Bucket names must start with a lowercase letter or number.
- Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.). Bucket names can contain lowercase letters, numbers, and hyphens. Each label must start and end with a lowercase letter or a number.
On IBM Z the Boost tagged pointer implementation cannot use
"pointer compression" as there are no unused bits in an address;
the whole 64-bit address space is available to user space code.
Instead, Boost uses 16-byte atomics. This is always supported
on IBM Z, but depending on the particular compiler (version)
it may require linking against libatomic. The existing checks
in CheckCxxAtomic.cmake do not catch this, however, as they only
test for (up to) 8-byte atomic support.
Fixed by adding a test for 16-byte atomic support on IBM Z.
The 'osd_op_queue_cut_off' config option determines which level of
high priority ops should use strict priority ordering and may change
from time to time. Since the main strategy of 'osd_kick_recovery_op_priority'
is to simply follow up 'osd_op_queue_cut_off', we can instead make a direct
use of 'osd_op_queue_cut_off' to achieve the same thing explicitly.