mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
Merge pull request #43355 from rzarzynski/wip-crimson-write_meta
crimson/osd: write the 'osd_key' meta on OSD::mkfs(). Reviewed-by: Chunmei Liu <chunmei.liu@intel.com> Reviewed-by: Samuel Just <sjust@redhat.com> Reviewed-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
commit
96edb523c1
@ -39,6 +39,7 @@
|
||||
|
||||
#include "crimson/admin/osd_admin.h"
|
||||
#include "crimson/admin/pg_commands.h"
|
||||
#include "crimson/common/buffer_io.h"
|
||||
#include "crimson/common/exception.h"
|
||||
#include "crimson/mon/MonClient.h"
|
||||
#include "crimson/net/Connection.h"
|
||||
@ -170,7 +171,9 @@ seastar::future<> OSD::mkfs(uuid_d osd_uuid, uuid_d cluster_fsid)
|
||||
}).then([cluster_fsid, this] {
|
||||
return when_all_succeed(
|
||||
store.write_meta("ceph_fsid", cluster_fsid.to_string()),
|
||||
store.write_meta("whoami", std::to_string(whoami)));
|
||||
store.write_meta("whoami", std::to_string(whoami)),
|
||||
_write_key_meta(),
|
||||
store.write_meta("ready", "ready"));
|
||||
}).then_unpack([cluster_fsid, this] {
|
||||
fmt::print("created object store {} for osd.{} fsid {}\n",
|
||||
local_conf().get_val<std::string>("osd_data"),
|
||||
@ -215,6 +218,33 @@ seastar::future<> OSD::_write_superblock()
|
||||
});
|
||||
}
|
||||
|
||||
// this `to_string` sits in the `crimson::osd` namespace, so we don't brake
|
||||
// the language rule on not overloading in `std::`.
|
||||
static std::string to_string(const seastar::temporary_buffer<char>& temp_buf)
|
||||
{
|
||||
return {temp_buf.get(), temp_buf.size()};
|
||||
}
|
||||
|
||||
seastar::future<> OSD::_write_key_meta()
|
||||
{
|
||||
|
||||
if (auto key = local_conf().get_val<std::string>("key"); !std::empty(key)) {
|
||||
return store.write_meta("osd_key", key);
|
||||
} else if (auto keyfile = local_conf().get_val<std::string>("keyfile");
|
||||
!std::empty(keyfile)) {
|
||||
return read_file(keyfile).then([this] (const auto& temp_buf) {
|
||||
// it's on a truly cold path, so don't worry about memcpy.
|
||||
return store.write_meta("osd_key", to_string(temp_buf));
|
||||
}).handle_exception([keyfile] (auto ep) {
|
||||
logger().error("_write_key_meta: failed to handle keyfile {}: {}",
|
||||
keyfile, ep);
|
||||
ceph_abort();
|
||||
});
|
||||
} else {
|
||||
return seastar::now();
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
entity_addrvec_t pick_addresses(int what) {
|
||||
entity_addrvec_t addrs;
|
||||
|
@ -145,6 +145,7 @@ public:
|
||||
|
||||
private:
|
||||
seastar::future<> _write_superblock();
|
||||
seastar::future<> _write_key_meta();
|
||||
seastar::future<> start_boot();
|
||||
seastar::future<> _preboot(version_t oldest_osdmap, version_t newest_osdmap);
|
||||
seastar::future<> _send_boot();
|
||||
|
Loading…
Reference in New Issue
Block a user