Clean up for registration and deregistration code#4034
Conversation
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
|
@jbaublitz Looks like the format test failure is real, could you fix? The clippy failure is real too. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughThis PR centralizes D-Bus pool component registration and cleanup: ChangesPool registration and unregistration centralization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/dbus/manager/manager_3_9/methods.rs (1)
114-121:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winRemove redundant conversion and fix formatting to pass CI.
Two pipeline failures on this block:
- Clippy error (Line 118):
OwnedObjectPath::from(pool_path)is a useless conversion sincepool_pathis alreadyOwnedObjectPath(assigned at line 99).- Rustfmt (Line 114): The tuple formatting should be compacted.
🐛 Proposed fix
( - ( - true, - ( - OwnedObjectPath::from(pool_path), - dev_paths, - fs_paths, - ), - ), + (true, (pool_path, dev_paths, fs_paths)), DbusErrorEnum::OK as u16, OK_STRING.to_string(), )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/dbus/manager/manager_3_9/methods.rs` around lines 114 - 121, Remove the redundant OwnedObjectPath::from(pool_path) conversion and compact the tuple formatting: replace the tuple arm that currently uses OwnedObjectPath::from(pool_path) with just pool_path (since pool_path is already an OwnedObjectPath) and reformat the tuple to a single-line/compact form containing (true, (pool_path, dev_paths, fs_paths)) so Clippy and rustfmt pass; look for this pattern in methods.rs around the tuple containing pool_path, dev_paths, and fs_paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/dbus/manager/manager_3_6/methods.rs`:
- Line 62: The line with the awaited call to unregister_pool is misformatted for
rustfmt; reflow the if-let expression so the call arguments or the .await are on
their own line(s) to satisfy rustfmt—for example, break the call across lines:
split the argument list to multiple lines or move .await to a new line while
keeping the pattern if let Err(e) = ... so locate the call to
unregister_pool(connection, manager, &pool.as_ref(), &fs_uuids,
&dev_uuids).await and reflow it into a multi-line call expression (preserving
the same parameters and variable names) so rustfmt passes.
In `@src/dbus/pool/mod.rs`:
- Around line 14-23: This file fails rustfmt; run cargo fmt (or rustfmt) and
reformat src/dbus/pool/mod.rs so the import block and surrounding module code
adhere to rustfmt rules—fix spacing/commas/indentation in the dbus::{
unregister_blockdev, consts, filesystem::unregister_filesystem,
register_blockdev, register_filesystem, Manager }, engine::{ DevUuid, Engine,
FilesystemUuid, Lockable, PoolIdentifier, PoolUuid } and stratis::{
StratisError, StratisResult } groups and any subsequent blocks that reference
PoolUuid/PoolIdentifier so the file passes CI formatting checks, then re-commit.
---
Outside diff comments:
In `@src/dbus/manager/manager_3_9/methods.rs`:
- Around line 114-121: Remove the redundant OwnedObjectPath::from(pool_path)
conversion and compact the tuple formatting: replace the tuple arm that
currently uses OwnedObjectPath::from(pool_path) with just pool_path (since
pool_path is already an OwnedObjectPath) and reformat the tuple to a
single-line/compact form containing (true, (pool_path, dev_paths, fs_paths)) so
Clippy and rustfmt pass; look for this pattern in methods.rs around the tuple
containing pool_path, dev_paths, and fs_paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 489a35c2-7529-4b97-9192-07693121f691
📒 Files selected for processing (7)
src/dbus/manager/manager_3_0/methods.rssrc/dbus/manager/manager_3_2/methods.rssrc/dbus/manager/manager_3_4/methods.rssrc/dbus/manager/manager_3_6/methods.rssrc/dbus/manager/manager_3_8/methods.rssrc/dbus/manager/manager_3_9/methods.rssrc/dbus/pool/mod.rs
4403b5c to
ac44d5e
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
mulkieran
left a comment
There was a problem hiding this comment.
I'm not done review yet, but I wanted to note one significant concern in the comment.
|
|
||
| if let Ok(StopAction::Stopped(_) | StopAction::Partial(_)) = action { | ||
| if let Err(e) = unregister_pool(connection, manager, &pool).await { | ||
| if let Err(e) = unregister_pool(connection, manager, &pool, &fs_uuids, &dev_uuids).await { |
There was a problem hiding this comment.
The fs_uuids_rem values in the removed code address a particular scenario where a pool is partially stopped; the pool begins tearing down the filesystem devices but then encounters a situation where the filesystem is still mounted, and stops. So the pool is partially torn down, but filesystems are still remaining and the pool should not be unregistered. I don't think it can remove, but I also think that combining the action taken on Stopped and Partial results is probably mistaken and should also be fixed. The same objection holds for the r6 implementation.
ac44d5e to
a0ab412
Compare
a0ab412 to
7b71847
Compare
Assisted-by: Claude <noreply@anthropic.com>
7b71847 to
ae19fb5
Compare
Closes #4028
I manually tested with dbus-monitor and did a little bit of additional cleanup to make registration and deregistration consistent.
Summary by CodeRabbit