os/bluestore: Implemented create-bdev-label#62148
Conversation
9f628c1 to
d8cc39b
Compare
src/os/bluestore/bluestore_tool.cc
Outdated
| bool is_multi = false; | ||
| int64_t epoch = -1; | ||
|
|
||
| int r = BlueStore::read_bdev_label(cct.get(), devs.front(), &label, |
There was a problem hiding this comment.
We want to create new bdev label; we cannot fail if there isn't one.
There was a problem hiding this comment.
Addressed the Change
src/os/bluestore/bluestore_tool.cc
Outdated
| "bluefs", "ceph_fsid", "ceph_version_when_created", "created_at", | ||
| "elastic_shared_blobs", "fsid", "keyring", "kv_backend", "magic", | ||
| "mkfs_done", "osd_key", "ready", "require_osd_release", "type", "whoami" | ||
| }; |
There was a problem hiding this comment.
List of metas is a good idea.
It is almost certain that we will add more metas in the future.
I think we should have some warning when there is a file (potentially meta) in the dir that we are not putting to bdev label.
However, ignoring those extra files is OK overall.
If they are needed in meta one can always use CBT to set additional meta.
src/os/bluestore/bluestore_tool.cc
Outdated
| } | ||
| if (action == "create-bdev-label") { | ||
| if (path.empty()) { | ||
| cerr << "must specify bluestore path *or* raw device(s)" << std::endl; |
There was a problem hiding this comment.
We cannot go without "path", we need to read files from there.
76262e3 to
e64c3cb
Compare
src/os/bluestore/bluestore_tool.cc
Outdated
| for (const auto& file : metadata_files) { | ||
| std::ifstream infile(path + "/" + file); | ||
| if (infile) { | ||
| std::string value((std::istreambuf_iterator<char>(infile)), std::istreambuf_iterator<char>()); |
src/os/bluestore/bluestore_tool.cc
Outdated
| } | ||
|
|
||
| bool wrote_at_least_one = false; | ||
| for (uint64_t position : valid_positions) { |
There was a problem hiding this comment.
If we didn't read any labels "-ENOENT" than valid_positions is empty.
I agree we do not want to go into multi, but we should at least write bdev_label at offset 0.
| } else { | ||
| cerr << "Warning: unable to read metadata file: " << file << std::endl; | ||
| } | ||
| } |
There was a problem hiding this comment.
There are fields in bluestore_bdev_label_t that should be set too, for example bluestore_bdev_label_t::description.
There was a problem hiding this comment.
Addressed the Change
fb8ceb5 to
18fed8c
Compare
79df7a2 to
21247ec
Compare
21247ec to
c46245d
Compare
02b15a3 to
0c0ea1b
Compare
|
Also verified by https://tracker.ceph.com/issues/71503. |
|
jenkins test make check arm64 |
0c0ea1b to
d879d56
Compare
|
|
||
| :command:`create-bdev-labels` --path *osd path* --dev *device* | ||
|
|
||
| Writes a bdev label to BlueStore devices that originally did not support labeling. |
There was a problem hiding this comment.
What manner of device did originally not support labeling?
There was a problem hiding this comment.
@anthonyeleven None. In bluestore meaning label is first 4K of device.
But due to some misguided thinking or something we pretended that NVME and PMEM devices might not support label.
d879d56 to
ea601c4
Compare
|
jenkins test windows |
|
jenkins test make check arm64 |
Introduces a helper function create_bdev_label() and a new command create-bdev-label to write essential OSD metadata (e.g., fsid, whoami) directly into the device label at offset 0, for use on devices where support_bdev_label == false. Usage: ./bin/ceph-bluestore-tool --path dev/osd0 --dev dev/osd0/block create-bdev-label If a label already exists, the function throws an error to avoid overwriting. This lays the groundwork for eventually removing duplicated metadata from the OSD directory for devices that don’t support native bdev labels Signed-off-by: Jaya Prakash <jayaprakash@ibm.com>
ea601c4 to
f2faf3e
Compare
os/bluestore: Implemented create_bdev_label
Introduces a helper function create_bdev_label() and a new command create-bdev-label
to write essential OSD metadata (e.g., fsid, whoami) directly into the device label
at offset 0, for use on devices where support_bdev_label == false.
Usage:
./bin/ceph-bluestore-tool --path dev/osd0 --dev dev/osd0/block create-bdev-labelIf a label already exists, the function throws an error to avoid overwriting.
This lays the groundwork for eventually removing duplicated metadata from
the OSD directory for devices that don’t support native bdev labels
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job Definition