New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring dbus up when we can #1067
Conversation
), | ||
dbus::Error, | ||
> { | ||
pub fn connect<'a>(engine: Rc<RefCell<Engine>>) -> Result<DbusConnectionData<'a>, dbus::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this change removes the type complexity, it ought to be able to remove the allow(type_complexity)
directive as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will update
src/bin/stratisd.rs
Outdated
} | ||
|
||
#[cfg(feature = "dbus_enabled")] | ||
let poll_timeout = timeout(dbus_handle.is_none(), eventable.is_none()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing that all the arguments to timeout above and below have the wrong values, except for the literal false
. Assuming false
is a correct argument, then it makes sense for the first argument to evaluate to false
if D-Bus is not enabled. So, in the call to timeout above, it makes more sense for the first argument to be dbus_handle.is_some()
, which will evaluate to true if stratisd has a D-Bus connection, but false otherwise. I think that a similar argument holds for the second argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arguments are correct and the function is doing the correct thing based on them. However, I can see the confusion. The timeout
function simply selects the returned value in a prioritized order of shorter poll when dbus is compiled in but not available vs. an engine that isn't eventable. When dbus_handle.is_none()
is true
dbus is not available, thus we want to the time out to be shorter, 1 second. When dbus_handle.is_none()
is false, then we evaluate if engine is eventable. If eventable.is_none()
is true then the engine isn't eventable and we want the timeout to be 10 seconds. However, I need to ask @agrover why this was selected as the comments indicate that when we aren't eventable that the call to the engine is a no-op. Lastly when both dbus and eventable are both false
we return -1 which is to wait forever on socket activity.
Obviously I need to re-work this to make it less confusing, so I'll see what I can do. Passing in the reverse and negating the comparisons in timeout
may be better.
src/bin/stratisd.rs
Outdated
@@ -157,6 +157,18 @@ fn trylock_pid_file() -> StratisResult<File> { | |||
} | |||
} | |||
|
|||
/// Return desired timeout based on if dbus timeout should be selected, non-eventable timeout | |||
/// selected or default selected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this function should be better documented, to explain the meaning of the arguments and also the reason behind the choices of the return values. This will help understand if it is called correctly and also inform any subequent revisions of the values that may become necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Andy's comment at the meeting, I think we can make this much simpler in that we don't require a separate timeout for eventable.
d6c7a1d
to
f80c668
Compare
Reduced poll timeout calculation complexity and removed type complexity allow. Also rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source looks fine to me.
However, it would be tidier if you started a new PR with all commits squashed into one, or with two commits, one for the refactoring change which changed the return type of connect
, and one for all the rest of the changes.
Agreed, I can certainly squash. I've been leaving things as separate commits to allow easier review of subsequent changes. However, with the auto merge thing, I guess that's not really appropriate. |
f80c668
to
72762cc
Compare
Squashed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine w/ this PR as it is.
But to be clear, I had requested that this PR be closed, and a new PR, with changes squashed, be put up for review, not that the commits in this PR just be squashed.
I posed this question on IRC and @agrover really said there isn't a defacto process to follow. What in your opinion is the advantage of creating a new PR which is squashed vs. squashing the existing PR? |
For PRs that are being changed due to review, and are fairly complex, it makes sense just to add change commits to the end of the PR. I can explain the reasoning behind this more fully if necessary. For PRs that are actually committed to the repo, it makes sense to separate the PR into distinct and coherent individual commits, as far as is possible and within limits of difficulty of the task. I can expand on this more fully if necessary. It makes sense to make these two PRs separate because:
|
We want stratisd to come up before filesystems get mounted, so that a user can use Stratis backed filesystems in fstab. However, dbus is not available at this time and we need to be able to start and run without dbus. When this happens we will periodically check to see if we can bring up the dbus API. Signed-off-by: Tony Asleson <tasleson@redhat.com>
72762cc
to
f2a1236
Compare
Re-based to correct merge conflict induced by merge of 9b720f9 |
It is not clear to me why stratis-cli tests managed to succeed with this change, as they failed on my machine with this change. NOTE: I can not reliably reproduce the problem on my own machine, so at this time I am giving up. |
We want stratisd to come up before filesystems get mounted, so
that a user can use Stratis backed filesystems in fstab. However,
dbus is not available at this time and we need to be able to start
and run without dbus. When this happens we will periodically
check to see if we can bring up the dbus API.
Fixes: #846