Skip to content
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

Add an OV re-registration window option when using DB storage #643

Merged
merged 6 commits into from
Apr 4, 2024

Conversation

7flying
Copy link
Contributor

@7flying 7flying commented Mar 8, 2024

This allows the users to specify an OV re-registration window in the Owner server. When an OV is about to be de-registered in the rendezvous server within the specified time window, the owner will trigger a re-registration.

Fixes #193
Obsoletes #207

@7flying 7flying force-pushed the re-run-to0-before-expiration branch 2 times, most recently from 48cf742 to eb44859 Compare March 8, 2024 16:03
@7flying 7flying force-pushed the re-run-to0-before-expiration branch from eb44859 to c65a922 Compare March 21, 2024 17:39
7flying added 3 commits March 22, 2024 11:45
This adds the required function signature to the trait which
will query ovs in the trait implementors.

Signed-off-by: Irene Diez <idiez@redhat.com>
Implements the `query_ovs_db_to2_performed_to0_less_than`
trait in the Owner database types.

Signed-off-by: Irene Diez <idiez@redhat.com>
In the directory this trait is not available, so we return
the specific `StoreError::MethodNotAvailable` error.

Signed-off-by: Irene Diez <idiez@redhat.com>
@7flying 7flying force-pushed the re-run-to0-before-expiration branch from c65a922 to 0f47b00 Compare March 22, 2024 14:10
@7flying 7flying marked this pull request as ready for review March 22, 2024 14:10
@7flying 7flying force-pushed the re-run-to0-before-expiration branch from 0f47b00 to 54cbc0e Compare March 22, 2024 14:20
djach7
djach7 previously approved these changes Mar 22, 2024
Copy link
Contributor

@djach7 djach7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, reviewed for English conventions with limited rust knowledge.

admin-tool/src/aio/configure.rs Show resolved Hide resolved
owner-onboarding-server/src/main.rs Outdated Show resolved Hide resolved
owner-onboarding-server/src/main.rs Show resolved Hide resolved
Copy link
Contributor

@mmartinv mmartinv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to implement query_ovs_db_to2_performed_to0_less_than function 6 times in which only 2 of them are "real" implementations and 4 just throw an error feels very wrong to me. Imagine we need to implement another database backend (e.g. mysql), now we have 9 implementations: 3 real, 6 throwing errors. I think we need to revisit the whole thing sooner than later.

admin-tool/src/aio/configure.rs Outdated Show resolved Hide resolved
admin-tool/src/aio/configure.rs Outdated Show resolved Hide resolved
Comment on lines 404 to 448
// Voucher registration times
let ov_registration_period = match settings.ov_registration_period {
Some(value) => {
if value == 0 {
bail!("ov_registration_period cannot be 0");
}
value
}
None => {
log::info!(
"Setting a default ov_registration_period of {DEFAULT_REGISTRATION_PERIOD} seconds"
);
DEFAULT_REGISTRATION_PERIOD
}
};
let ov_re_registration_window = match settings.ov_re_registration_window {
Some(value) => {
if value == 0 {
bail!("ov_re_registration_window cannot be 0");
}
value
}
None => {
log::info!("Setting a default ov_re_registration_window of {DEFAULT_RE_REGISTRATION_WINDOW} seconds");
DEFAULT_RE_REGISTRATION_WINDOW
}
};

if ov_re_registration_window >= ov_registration_period {
bail!(
"ov_re_registration_window ({ov_re_registration_window}) must be smaller than ov_registration_period ({ov_registration_period})");
} else {
log::info!("Server configured with an OV registration period of {ov_registration_period} seconds, OV re-registration window set to {ov_re_registration_window} seconds")
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an enhancement this might be moved to a validation function so it can be used to validate clap arguments also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmartinv I'm guessing that this is it, let me explain since I did not comment.
I have a pending issue to add sqlite support as an optional argument when running aio (#642 ), as part of that I would have to change the passed arguments to the aio command, and it makes sense to add a way to configure other things (such as this new registration window there), so, yeah I made a mental note of this but did not comment. My apologies.

owner-onboarding-server/src/main.rs Show resolved Hide resolved
@7flying
Copy link
Contributor Author

7flying commented Mar 25, 2024

Having to implement query_ovs_db_to2_performed_to0_less_than function 6 times in which only 2 of them are "real" implementations and 4 just throw an error feels very wrong to me. Imagine we need to implement another database backend (e.g. mysql), now we have 9 implementations: 3 real, 6 throwing errors. I think we need to revisit the whole thing sooner than later.

I do agree, we should get rid of the directory storage method, which is the one that defines the trait that we need to implement and doesn't fit at all with the DB stuff.

@7flying 7flying force-pushed the re-run-to0-before-expiration branch from 54cbc0e to e01aebc Compare March 25, 2024 13:57
@7flying 7flying force-pushed the re-run-to0-before-expiration branch from e01aebc to 240e267 Compare April 3, 2024 08:54
7flying added 3 commits April 3, 2024 18:45
This adds the ability to trigger a rendezvous re-registration
when an OV is close to its de-registration timeout. A re-registration
window is added so that when the remaining registration period
of the OV reaches that window, a re-registration is triggered.
This feature is only available when using database storage
drivers.

Signed-off-by: Irene Diez <idiez@redhat.com>
This adds the configuration options for OV
re-registration window checks in aio.

Signed-off-by: Irene Diez <idiez@redhat.com>
Signed-off-by: Irene Diez <idiez@redhat.com>
@7flying 7flying force-pushed the re-run-to0-before-expiration branch from 240e267 to 626488d Compare April 3, 2024 16:47
Copy link
Contributor

@mmartinv mmartinv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just a nitpick: you marked a conversation as resolved after an ack but you didn't take action on it. If you are not willing to implement the suggested change because it was described as an enhancement and you considered it as not important just say it, do not just resolve the conversation without further explanation, it feels awkard.

@mergify mergify bot merged commit 5c865fc into fdo-rs:main Apr 4, 2024
26 checks passed
@7flying
Copy link
Contributor Author

7flying commented Apr 4, 2024

Looks good to me. Just a nitpick: you marked a conversation as resolved after an ack but you didn't take action on it. If you are not willing to implement the suggested change because it was described as an enhancement and you considered it as not important just say it, do not just resolve the conversation without further explanation, it feels awkard.

I missed that, let me review and create an issue so that it is not forgotten

@7flying
Copy link
Contributor Author

7flying commented Apr 4, 2024

Looks good to me. Just a nitpick: you marked a conversation as resolved after an ack but you didn't take action on it. If you are not willing to implement the suggested change because it was described as an enhancement and you considered it as not important just say it, do not just resolve the conversation without further explanation, it feels awkard.

I missed that, let me review and create an issue so that it is not forgotten

OK, commented in the review since I missed to comment what I was thinking

@7flying 7flying deleted the re-run-to0-before-expiration branch April 4, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Owner Onboarding Server: make sure to re-run TO0 before it is actually expired
3 participants