mirror of
https://github.com/ceph/ceph
synced 2024-12-26 05:25:09 +00:00
test/fio: create superblock on mkfs to provide proper tools functioning
E.g. ceph-objectstore-tool requires that Signed-off-by: Igor Fedotov <ifedotov@suse.com>
This commit is contained in:
parent
9f8ae668c1
commit
7f768dbf62
@ -189,6 +189,30 @@ int init_collections(std::unique_ptr<ObjectStore>& 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);
|
||||
|
Loading…
Reference in New Issue
Block a user