From: Igor Fedotov Date: Fri, 9 Feb 2018 11:58:15 +0000 (+0300) Subject: test/fio: create superblock on mkfs to provide proper tools functioning X-Git-Tag: v13.0.2~298^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7f768dbf6241482b455bc86cac8ec7ab3dd944ac;p=ceph.git test/fio: create superblock on mkfs to provide proper tools functioning E.g. ceph-objectstore-tool requires that Signed-off-by: Igor Fedotov --- diff --git a/src/test/fio/fio_ceph_objectstore.cc b/src/test/fio/fio_ceph_objectstore.cc index d6250044d3f5..4236197d3ffd 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);