From 7f768dbf6241482b455bc86cac8ec7ab3dd944ac Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 9 Feb 2018 14:58:15 +0300 Subject: [PATCH] test/fio: create superblock on mkfs to provide proper tools functioning E.g. ceph-objectstore-tool requires that Signed-off-by: Igor Fedotov --- src/test/fio/fio_ceph_objectstore.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/test/fio/fio_ceph_objectstore.cc b/src/test/fio/fio_ceph_objectstore.cc index d6250044d3f..4236197d3ff 100644 --- a/src/test/fio/fio_ceph_objectstore.cc +++ b/src/test/fio/fio_ceph_objectstore.cc @@ -189,6 +189,30 @@ int init_collections(std::unique_ptr& os, const int split_bits = cbits(count - 1); + { + // propagate Superblock object to ensure proper functioning of tools that + // need it. E.g. ceph-objectstore-tool + coll_t cid(coll_t::meta()); + bool exists = os->collection_exists(cid); + if (!exists) { + auto ch = os->create_new_collection(cid); + + OSDSuperblock superblock; + bufferlist bl; + encode(superblock, bl); + + ObjectStore::Transaction t; + t.create_collection(cid, split_bits); + t.write(cid, OSD_SUPERBLOCK_GOBJECT, 0, bl.length(), bl); + int r = os->apply_transaction(ch, std::move(t)); + + if (r < 0) { + derr << "Failure to write OSD superblock: " << cpp_strerror(-r) << dendl; + return r; + } + } + } + for (uint32_t i = 0; i < count; i++) { auto pg = spg_t{pg_t{i, pool}}; coll_t cid(pg); -- 2.39.5