crimson: Set device class during spawn of a crimson osd#60747
crimson: Set device class during spawn of a crimson osd#60747
Conversation
|
jenkins test make check |
Matan-B
left a comment
There was a problem hiding this comment.
looks good so far, left a few comments.
I would also suggest trying to use coroutines in OSD::_add_device_class() as it can make the implementation easier to read.
| //TODO In case of classic memstore we are always | ||
| // returning hdd so for the timebeing we are skipping |
There was a problem hiding this comment.
Let's return empty string, no need for TODO with CyanStore for now.
src/crimson/osd/osd.cc
Outdated
| seastar::future<> OSD::_add_device_class() | ||
| { | ||
| LOG_PREFIX(OSD::_add_device_class); | ||
| if (!local_conf().get_val<bool>("osd_crush_update_on_start")) { |
There was a problem hiding this comment.
osd_class_update_on_start should be used here
src/crimson/osd/osd.cc
Outdated
| }).handle_exception([FNAME](std::exception_ptr e) { | ||
| ERROR("Failed to get device class: ", e); | ||
| return seastar::make_ready_future<std::string>(""); | ||
| }); |
There was a problem hiding this comment.
Are we expecting an thrown exception here?
For expected errors in Crimson we use errorator, see dev/crimson/error-handling.
There was a problem hiding this comment.
I have changed the code now, please let me know if it is ok now.
src/crimson/osd/osd.cc
Outdated
| string cmd = string("{\"prefix\": \"osd crush set-device-class\", ") + | ||
| string("\"class\": \"") + device_class + string("\", ") + | ||
| string("\"ids\": [\"") + stringify(whoami) + string("\"]}"); |
There was a problem hiding this comment.
Let's switch to fmt::format here
src/crimson/osd/osd.cc
Outdated
| }); | ||
| }; | ||
|
|
||
| return get_device_class().then([FNAME, this](auto device_class) { |
There was a problem hiding this comment.
We should check that device_class is not an empty string before using it
src/crimson/osd/osd.cc
Outdated
| [[maybe_unused]] auto [code, message, out] = std::move(command_result); | ||
| if (code) { | ||
| WARN("fail to set device_class : {} ({})", message, code); | ||
| throw std::runtime_error("fail to add to crush"); |
There was a problem hiding this comment.
"fail to set device_class"
|
makecheck: |
|
jenkins test make check |
ea5684f to
29d8312
Compare
|
jenkins test make check |
src/crimson/osd/osd.cc
Outdated
| auto get_device_class = [FNAME, this]() -> seastar::future<std::string> { | ||
| try { | ||
| std::string device_class = co_await store.get_default_device_class(); | ||
| co_return device_class; | ||
| } catch (const std::exception& e) { | ||
| ERROR("Failed to get device class: ", e.what()); | ||
| co_return ""; | ||
| } | ||
| }; |
There was a problem hiding this comment.
There's no need for try/catch we discarding exceptions as we handle error with Crimson's errorator concept.
See TEST_F(coroutine_test_t, test_ertr_coroutine_error)
There was a problem hiding this comment.
We can skip the get_device_class wrapper:
std::string device_class = co_await store.get_default_device_class();
src/crimson/osd/osd.cc
Outdated
| } catch (const std::exception& e) { | ||
| ERROR("Failed to add device class: ", e.what()); | ||
| throw; | ||
| } |
There was a problem hiding this comment.
I have changed the code
src/crimson/osd/osd.cc
Outdated
| device_class, stringify(whoami) | ||
| ); | ||
|
|
||
| auto [code, message, out] = co_await monc->run_command(std::move(cmd), {}); |
src/crimson/osd/osd.cc
Outdated
| auto [code, message, out] = co_await monc->run_command(std::move(cmd), {}); | ||
| if (code) { | ||
| WARN("fail to set device_class : {} ({})", message, code); | ||
| throw std::runtime_error("fail to set device_class"); |
There was a problem hiding this comment.
nit:
// to be caught by crimson/osd/main.cc
throw std::runtime_error("fail to set device_class");
29d8312 to
39305b2
Compare
Matan-B
left a comment
There was a problem hiding this comment.
lgtm! Left final comments
src/crimson/osd/osd.cc
Outdated
| co_return; | ||
| } | ||
|
|
||
| INFO("device_class is {} whoami: {}", device_class, whoami); |
There was a problem hiding this comment.
The osd id would be printed as a prefix, whoami is redundant
src/crimson/osd/osd.cc
Outdated
| WARN("fail to set device_class : {} ({})", message, code); | ||
| throw std::runtime_error("fail to set device_class"); | ||
| } else { | ||
| INFO("newly added to crush: {}", message); |
There was a problem hiding this comment.
"device_class was set: {}"
Implement a wrapper for different backend storage to set device_class during spawn of a process. Fixes: https://tracker.ceph.com/issues/66627 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
39305b2 to
d2ee4c1
Compare
|
jenkins test make check |
|
jenkins test make check |
Please also include "dead" jobs. Merging, thank you! |
Dead job links, it seems both jobs are dead due to some issue at infra level. |
|
jenkins test make check |
There seems to be something off with Crimson and cbt (perf suite). As mentioned earlier these failures also appear in main so I'll merge once CI passes. |
|
jenkins test make check |
Implement a wrapper for different backend storage to set device_class during spawn of a process
Fixes: https://tracker.ceph.com/issues/66627
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 retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e