AlienStore::~AlienStore() = default;
-seastar::future<> AlienStore::mount()
+AlienStore::mount_ertr::future<> AlienStore::mount()
{
logger().debug("{}", __func__);
assert(tp);
return tp->submit([this] {
return store->mount();
- }).then([] (int r) {
- assert(r == 0);
- return seastar::now();
+ }).then([] (const int r) -> mount_ertr::future<> {
+ if (r != 0) {
+ return crimson::stateful_ec{
+ std::error_code(-r, std::generic_category()) };
+ } else {
+ return mount_ertr::now();
+ }
});
}
seastar::future<> start() final;
seastar::future<> stop() final;
- seastar::future<> mount() final;
+ mount_ertr::future<> mount() final;
seastar::future<> umount() final;
mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final;
};
};
-seastar::future<> CyanStore::mount()
+CyanStore::mount_ertr::future<> CyanStore::mount()
{
+ static const char read_file_errmsg[]{"read_file"};
ceph::bufferlist bl;
std::string fn = path + "/collections";
std::string err;
if (int r = bl.read_file(fn.c_str(), &err); r < 0) {
- throw std::runtime_error("read_file");
+ return crimson::stateful_ec{ singleton_ec<read_file_errmsg>() };
}
std::set<coll_t> collections;
std::string fn = fmt::format("{}/{}", path, coll);
ceph::bufferlist cbl;
if (int r = cbl.read_file(fn.c_str(), &err); r < 0) {
- throw std::runtime_error("read_file");
+ return crimson::stateful_ec{ singleton_ec<read_file_errmsg>() };
}
boost::intrusive_ptr<Collection> c{new Collection{coll}};
auto p = cbl.cbegin();
coll_map[coll] = c;
used_bytes += c->used_bytes();
}
- return seastar::now();
+ return mount_ertr::now();
}
seastar::future<> CyanStore::umount()
seastar::future<> stop() final {
return seastar::now();
}
- seastar::future<> mount() final;
+ mount_ertr::future<> mount() final;
seastar::future<> umount() final;
mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final;
return seastar::now();
}
virtual seastar::future<> stop() = 0;
- virtual seastar::future<> mount() = 0;
+
+ using mount_ertr = crimson::errorator<crimson::stateful_ec>;
+ virtual mount_ertr::future<> mount() = 0;
virtual seastar::future<> umount() = 0;
using mkfs_ertr = crimson::errorator<crimson::stateful_ec>;
return seastar::now();
}
-seastar::future<> SeaStore::mount()
+SeaStore::mount_ertr::future<> SeaStore::mount()
{
return segment_manager->mount(
).safe_then([this] {
~SeaStore();
seastar::future<> stop() final;
- seastar::future<> mount() final;
+ mount_ertr::future<> mount() final;
seastar::future<> umount() final;
mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final;
std::exit(EXIT_FAILURE);
}));
}).then([this] {
- return store.mount();
+ return store.mount().handle_error(
+ crimson::stateful_ec::handle([] (const auto& ec) {
+ logger().error("error mounting object store in {}: ({}) {}",
+ local_conf().get_val<std::string>("osd_data"),
+ ec.value(), ec.message());
+ std::exit(EXIT_FAILURE);
+ }));
}).then([cluster_fsid, this] {
superblock.cluster_fsid = cluster_fsid;
superblock.osd_fsid = store.get_fsid();
startup_time = ceph::mono_clock::now();
return store.start().then([this] {
- return store.mount();
+ return store.mount().handle_error(
+ crimson::stateful_ec::handle([] (const auto& ec) {
+ logger().error("error mounting object store in {}: ({}) {}",
+ local_conf().get_val<std::string>("osd_data"),
+ ec.value(), ec.message());
+ std::exit(EXIT_FAILURE);
+ }));
}).then([this] {
return store.open_collection(coll_t::meta());
}).then([this](auto ch) {
virtual seastar::future<> _teardown() = 0;
virtual FuturizedStore::mkfs_ertr::future<> _mkfs() = 0;
- virtual seastar::future<> _mount() = 0;
+ virtual FuturizedStore::mount_ertr::future<> _mount() = 0;
void restart() {
_teardown().get0();
destroy();
static_cast<segment_manager::EphemeralSegmentManager*>(&*segment_manager)->remount();
init();
- _mount().get0();
+ _mount().handle_error(crimson::ct_error::assert_all{}).get0();
}
seastar::future<> tm_setup() {
);
}
- virtual seastar::future<> _mount() {
+ virtual FuturizedStore::mount_ertr::future<> _mount() {
return tm->mount(
).handle_error(
crimson::ct_error::assert_all{"Error in mount"}
});
}
- virtual seastar::future<> _mount() final {
+ virtual FuturizedStore::mount_ertr::future<> _mount() final {
return seastore->mount();
}