mirror of
https://github.com/ceph/ceph
synced 2025-01-01 16:42:29 +00:00
Merge pull request #44317 from aclamk/aclamk-fix-bluefs-import
Fix ceph-bluestore-tool bluefs-import command Reviewed-by: Igor Fedotov <igor.fedotov@croit.io>
This commit is contained in:
commit
eb5290f690
@ -6373,6 +6373,11 @@ int BlueStore::close_db_environment()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* gets access to bluefs supporting RocksDB */
|
||||
BlueFS* BlueStore::get_bluefs() {
|
||||
return bluefs;
|
||||
}
|
||||
|
||||
int BlueStore::_prepare_db_environment(bool create, bool read_only,
|
||||
std::string* _fn, std::string* _kv_backend)
|
||||
{
|
||||
|
@ -2688,6 +2688,7 @@ public:
|
||||
|
||||
int open_db_environment(KeyValueDB **pdb, bool to_repair);
|
||||
int close_db_environment();
|
||||
BlueFS* get_bluefs();
|
||||
|
||||
int write_meta(const std::string& key, const std::string& value) override;
|
||||
int read_meta(const std::string& key, std::string *value) override;
|
||||
|
@ -240,8 +240,14 @@ static void bluefs_import(
|
||||
cerr << "open " << input_file.c_str() << " failed: " << cpp_strerror(r) << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::unique_ptr<BlueFS> bs{open_bluefs_readonly(cct, path, devs)};
|
||||
BlueStore bluestore(cct, path);
|
||||
KeyValueDB *db_ptr;
|
||||
r = bluestore.open_db_environment(&db_ptr, false);
|
||||
if (r < 0) {
|
||||
cerr << "error preparing db environment: " << cpp_strerror(r) << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
BlueFS* bs = bluestore.get_bluefs();
|
||||
|
||||
BlueFS::FileWriter *h;
|
||||
fs::path file_path(dest_file);
|
||||
@ -261,7 +267,7 @@ static void bluefs_import(
|
||||
f.close();
|
||||
bs->fsync(h);
|
||||
bs->close_writer(h);
|
||||
bs->umount();
|
||||
bluestore.close_db_environment();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user