-
Notifications
You must be signed in to change notification settings - Fork 232
Support Installation-Date-based Slot Selection (A/B/C Update) #1525
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1525 +/- ##
==========================================
+ Coverage 84.42% 84.46% +0.04%
==========================================
Files 69 69
Lines 21663 21710 +47
==========================================
+ Hits 18288 18337 +49
+ Misses 3375 3373 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Do we still have enough test cases for the per-slot
status cases?
return iterslot; | ||
} | ||
|
||
g_assert_nonnull(iterslot->status); |
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.
Is this guaranteed? What happens if the global slot status is empty?
73bf8fc
to
8143d3f
Compare
Rebased onto |
We should consider selecting bad slots (e.g. due to an interrupted installation) before looking at the dates. Otherwise, repeated installation attempts would lead to all inactive slots being marked as bad. |
046e67c
to
3f05f48
Compare
3f05f48
to
a5416a8
Compare
58ed4e8
to
749709f
Compare
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
When using a global slot status, we can load the status of all slots during RAUC startup. This should happen during (target) context setup. This commit does not change behavior but renames load_slot_status_globally() to r_slot_status_load_globally() and adds the status file name and slot hash table as arguments to allow removing calls to the r_context() method (which is not available during context setup). Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Adds a call to r_slot_status_load_globally() to r_context_configure_target(), just like it already calls r_system_status_load(). This ensures the slot status is loaded initially and the rest of the code can safely assume the status information is filled (when using a global status file). Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Prepares for reworking timestamp handling and ensures using the same format string consistently. For later glib versions, an alternative coulde be to use g_date_time_format_iso8601(). Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Up to now the time was stored as a gchar string in RaucSlotStatus as it was only recorded and never modified or used for any operation. If we now aim to use this time to base further decisions on it, we should be able to properly handle the time as time and not as a string. Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
…date) So far, RAUC theoretically supported having three slot groups (e.g. rootfs.0, rootfs.1, rootfs.2), but the slot selection algorithm prevented their use for an A/B/C update. The algorithm simply selected the 'first' inactive slot group. The 'first' group is implementation-defined by the data type used (i.e. by the GHashTable). As a result, updating always alternated between two slot groups. This commit now introduces a slightly more sophisticated slot selection algorithm which always selects the slot group with the oldest installation date. Selecting the oldest installation date automatically ensures that all slots get their turn since once a slot is updated, it has the most recent timestamp and will be selected last. A slot that has no installation date yet is considered outdated. Not that the same behavior can also be used in an A/B setup together with 'rauc.external' to ensure that two consecutive calls of 'rauc install' populate *both* inactive slot groups A and B. Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Having a data-directory is the new default, thus we should update older configs to this. It also potentially enhances test coverage for data-directory and allows using it for testing newer features. Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
With the changes made for timestamp-based slot selection, it is possible to install to both inactive slot groups by calling 'rauc install' twice. This extends the existing test case 'test_install_rauc_external' to cover that, too. Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
This adds a fixture that can be used to test triple-redundancy setups with RAUC. Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
749709f
to
0f76339
Compare
@ejoerns Does the current state address the comments above? If so, please re-request a review. |
So far, RAUC theoretically supported having three slot groups (e.g.
rootfs.0
,rootfs.1
,rootfs.2
), but the slot selection algorithm prevented their use for an A/B/C update.The algorithm simply selected the 'first' inactive slot group.
The 'first' group is implementation-defined by the data type used (i.e. by the GHashTable).
As a result, updating always alternated between two slot groups.
This PR now introduces a slightly more sophisticated slot selection algorithm which always selects the slot group with the oldest installation date.
Selecting the oldest installation date automatically ensures that all slots get their turn since once a slot is updated, it has the most recent timestamp and will be selected last.
A slot that has no installation date yet is considered outdated.
Not that the same behavior can also be used in an A/B setup together with
rauc.external
to ensure that two consecutive calls ofrauc install
populate both inactive slot groups A and B.Fixes #1383