This introduces a new `ceph orch device replace` command in order to
improve the user experience when it comes to replacing the underlying
device of an OSD.
```
ceph_volume/util/disk.py:1374: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
```
Adam Kupczyk [Tue, 15 Oct 2024 12:41:22 +0000 (12:41 +0000)]
os/bluestore: Fix repair of multilabel when collides with BlueFS
The problem was that BDEV_FIRST_LABEL_POSITION was removed from
bdev_label_valid_locations set.
Now, if label at BDEV_FIRST_LABEL_POSITION is valid, it is in the set.
Fixes: https://tracker.ceph.com/issues/68528 Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
Afreen Misbah [Fri, 11 Oct 2024 15:28:56 +0000 (20:58 +0530)]
mgr/dashboard: Adapt gateway group changes in nvmeof UI
- Added gateway group param in namespace request - GET, POST, PATCH, DELETE
- Added gateway group param in Listeners request - GET
- Added gateway group param in Initiators - GET, POST, DELETE
Max Kellermann [Tue, 15 Oct 2024 15:52:45 +0000 (17:52 +0200)]
CodingStyle: allow C++ forward declarations
The Google coding guide opposes to forward declarations, but I
disagree with that opinion. In my opinion, forward declarations are
useful. Ceph build times are miserable due to header dependency bloat
and template bloat, both of which can be reduced using forward
declarations.
All cons listed in https://google.github.io/styleguide/cppguide.html
> Forward declarations can hide a dependency, allowing user code to
> skip necessary recompilation when headers change.
That is a pro, not a con. Skipping (unnecessary) recompilation is a
good thing, it's the goal of forward declarations.
> A forward declaration as opposed to an #include statement makes it
> difficult for automatic tooling to discover the module defining the
> symbol.
That certainly depends on the tools one uses, but I cannot imagine
today's IDEs are limited to one compilation unit.
> A forward declaration may be broken by subsequent changes to the
> library.
True, and that will lead to a compiler error.
> Forward declarations of functions and templates can prevent the
> header owners from making otherwise-compatible changes to their
> APIs, such as widening a parameter type, adding a template parameter
> with a default value, or migrating to a new namespace.
Forward declarations do not prevent any of that. But if you change
the "real" declaration, all incompatible forward declarations will
cause a compiler error.
Sad, but true. But that is not an argument against forward
declarations for Ceph's own types.
> It can be difficult to determine whether a forward declaration or a
> full #include is needed.
If it compiles without the `#include`, then the forward declaration is
fine. (Or the primary header happened to be already included by
somebody else.)
> Replacing an #include with a forward declaration can silently change
> the meaning of code: [...] If the #include was replaced with forward
> decls for B and D, test() would call f(void*).
True, but this is a contrived example, and is bad coding style because
it is error prone. Casts to `void*` can and should be avoided. There
are rare examples where such casts are necessary (boundary to C APIs),
and then it's very unusual to pass derived incomplete types.
> Forward declaring multiple symbols from a header can be more verbose
> than simply #includeing the header.
True, but that misses the point of forward declarations.
> Structuring code to enable forward declarations (e.g., using pointer
> members instead of object members) can make the code slower and more
> complex.
True, but that is not a property of forward declarations. I don't
suggest doing such a thing.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Redouane Kachach [Tue, 15 Oct 2024 11:34:32 +0000 (13:34 +0200)]
mgr/cephadm: disabling nginx buffering for grafana location
Disabling Nginx buffering for Grafana, as it may lead to errors or
delays while loading the main Grafana page, particularly when
receiving JavaScript files.
* pthread name is saved in a thread_local storage
* the thread_local name is copied into Entry object's ctor
* Log::dump_recent() reads the thread name from the Entry
object's data member when dumping logs
Anoop C S [Tue, 27 Aug 2024 10:20:44 +0000 (15:50 +0530)]
client: Resolve symlink from dirfd for empty pathname
man readlinkat(2)[1] points at a special case for readlinkat() syscall
as follows:
. . .
Since Linux 2.6.39, pathname can be an empty string, in which case the
call operates on the symbolic link referred to by dirfd (which should
have been obtained using open(2) with the O_PATH and O_NOFOLLOW flags).
. . .
man open(2)[2] further explains the need for such a special case when
a symlink is opened with O_PATH and O_NOFOLLOW:
. . .
If pathname is a symbolic link and the O_NOFOLLOW flag is also
specified, then the call returns a file descriptor referring to the
symbolic link. This file descriptor can be used as the dirfd argument
in calls to fchownat(2), fstatat(2), linkat(2), and readlinkat(2) with
an empty pathname to have the calls operate on the symbolic link.
. . .
Accordingly have a check to resolve symlinks out of dirfd when empty
pathnames are encountered within readlinkat(). In addition to that
match the standard file system behavior to return ENOENT instead of
EINVAL when the inode pointed to by dirfd is not a symbolic link with
empty pathnames.
Anoop C S [Thu, 29 Aug 2024 06:23:44 +0000 (11:53 +0530)]
client: Fix symlink open with O_PATH and O_NOFOLLOW
man open(2)[1] says the following for O_PATH:
. . .
If pathname is a symbolic link and the O_NOFOLLOW flag is also
specified, then the call returns a file descriptor referring to the
symbolic link. This file descriptor can be used as the dirfd argument
in calls to fchownat(2), fstatat(2), linkat(2), and readlinkat(2) with
an empty pathname to have the calls operate on the symbolic link.
. . .
symlink check within may_open() failed to consider the O_PATH flag
resulting in a ELOOP error to the client. In order to return a valid
file descriptor we introduce a check for the presence of O_PATH in
the client provided flags.
These are intended to replace do_osd_ops*. The implementation
is simpler and does not involve passing success and failure
callbacks. It also moves responsibility for dealing with
the MOSDOpReply and client related error handling over to
ClientRequest.
do_osd_op* will be removed once users are switched over.
Samuel Just [Fri, 20 Sep 2024 02:39:08 +0000 (19:39 -0700)]
crimson: PG::submit_error_log returns eversion_t rather than optional
It seems like the motivation here was to allow do_osd_ops_execute to
communicate that it didn't submit an error log by making
maybe_submit_error_log a std::optional<eversion_t>. However,
submit_error_log itself always returns a version. Fix submit_error_log
and compensate in do_osd_ops_execute.
Samuel Just [Fri, 20 Sep 2024 02:23:47 +0000 (02:23 +0000)]
crimson: futures from flush_changes_n_do_ops_effects must not fail
The return signature previously suggested that the second future
returned could be an error. This seemed necessary due to how
effects are handled:
template <typename MutFunc>
OpsExecuter::rep_op_fut_t
OpsExecuter::flush_changes_n_do_ops_effects(
const std::vector<OSDOp>& ops,
SnapMapper& snap_mapper,
OSDriver& osdriver,
MutFunc mut_func) &&
{
...
all_completed =
std::move(all_completed).then_interruptible([this, pg=this->pg] {
// let's do the cleaning of `op_effects` in destructor
return interruptor::do_for_each(op_effects,
[pg=std::move(pg)](auto& op_effect) {
return op_effect->execute(pg);
});
However, all of the actual execute implementations (created via
OpsExecuter::with_effect_on_obc) return a bare seastar::future and
cannot fail.
In a larger sense, it's actually critical that neither future returned
from flush_changes_n_do_ops_effects may fail -- they represent applying
the transaction locally and remotely. If either portion fails, there
would need to be an interval change to recover.
Samuel Just [Thu, 19 Sep 2024 00:59:21 +0000 (00:59 +0000)]
crimson: remove the eagain error from PG::do_osd_ops
The idea here is that PG::do_osd_ops propogates an eagain after starting
a repair upon encountering an eio to indicate that the op should restart
from the top of ClientRequest::process_op.
However, InternalClientRequest's handler for this error simply ignores
it. ClientRequest's handling, while superficially reasonable, doesn't
actually work. Re-calling process_op would mean reentering previous
stages. This is problematic for at least a few reasons:
1. Reentering a prior stage with the same handler doesn't actually work
since the corresponding event entries will already be populated.
2. There might be other ops on the same object waiting on the process
stage. They'd need to be sent back as well in order to preserve
ordering.
Because this mechanism doesn't really seem to be fully baked, let's
remove it for now and try to reintroduce it later after
do_osd_ops[_execute] are a bit simpler.
Samuel Just [Mon, 16 Sep 2024 22:16:37 +0000 (22:16 +0000)]
crimson/osd: move pipelines to osd_operation.h
Each of the two existing pipelines are shared across multiple
ops. Rather than defining them in a specific op or in
osd_operations/common/pg_pipeline.h, just declare them in
osd_operation.h.
Casey Bodley [Mon, 14 Oct 2024 20:07:38 +0000 (16:07 -0400)]
osdc: remove unused overloads for async::Completion
ea67f3dee2a3f8fcdcbb0bc0e80e38ec70378f05 switched to
asio::any_completion_handler<> for completions, but left some converting
overloads behind for compatibility. none of those overloads appear to be
used, so remove them