[reconfigurator] database support for PendingMgsUpdate for RoT#8588
Merged
karencfv merged 10 commits intooxidecomputer:mainfrom Jul 20, 2025
Merged
[reconfigurator] database support for PendingMgsUpdate for RoT#8588karencfv merged 10 commits intooxidecomputer:mainfrom
karencfv merged 10 commits intooxidecomputer:mainfrom
Conversation
karencfv
commented
Jul 16, 2025
Comment on lines
+1416
to
1452
| // Load all pending RoT updates. | ||
| // | ||
| // Pagination is a little silly here because we will only allow one at a | ||
| // time in practice for a while, but it's easy enough to do. | ||
| let mut pending_updates_rot = Vec::new(); | ||
| { | ||
| use nexus_db_schema::schema::bp_pending_mgs_update_rot::dsl; | ||
|
|
||
| let mut paginator = Paginator::new( | ||
| SQL_BATCH_SIZE, | ||
| dropshot::PaginationOrder::Ascending, | ||
| ); | ||
| while let Some(p) = paginator.next() { | ||
| let batch = paginated( | ||
| dsl::bp_pending_mgs_update_rot, | ||
| dsl::hw_baseboard_id, | ||
| &p.current_pagparams(), | ||
| ) | ||
| .filter(dsl::blueprint_id.eq(to_db_typed_uuid(blueprint_id))) | ||
| .select(BpPendingMgsUpdateRot::as_select()) | ||
| .load_async(&*conn) | ||
| .await | ||
| .map_err(|e| { | ||
| public_error_from_diesel(e, ErrorHandler::Server) | ||
| })?; | ||
|
|
||
| paginator = p.found_batch(&batch, &|d| d.hw_baseboard_id); | ||
| for row in batch { | ||
| pending_updates_rot.push(row); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Load all pending SP updates. | ||
| let mut pending_updates_sp = Vec::new(); | ||
| { | ||
| use nexus_db_schema::schema::bp_pending_mgs_update_sp::dsl; |
Contributor
Author
There was a problem hiding this comment.
We only allow one of PendingMgsUpdate at a time, so I think it should be OK to have these two one after the other in this manner.
Contributor
There was a problem hiding this comment.
I'd get a double check on this from someone else, maybe @jgallagher. Everything else looks great to me!
Contributor
Author
There was a problem hiding this comment.
Thanks! I'll be on stand-by then
Contributor
There was a problem hiding this comment.
Agreed, this looks fine!
andrewjstone
approved these changes
Jul 17, 2025
Comment on lines
+1416
to
1452
| // Load all pending RoT updates. | ||
| // | ||
| // Pagination is a little silly here because we will only allow one at a | ||
| // time in practice for a while, but it's easy enough to do. | ||
| let mut pending_updates_rot = Vec::new(); | ||
| { | ||
| use nexus_db_schema::schema::bp_pending_mgs_update_rot::dsl; | ||
|
|
||
| let mut paginator = Paginator::new( | ||
| SQL_BATCH_SIZE, | ||
| dropshot::PaginationOrder::Ascending, | ||
| ); | ||
| while let Some(p) = paginator.next() { | ||
| let batch = paginated( | ||
| dsl::bp_pending_mgs_update_rot, | ||
| dsl::hw_baseboard_id, | ||
| &p.current_pagparams(), | ||
| ) | ||
| .filter(dsl::blueprint_id.eq(to_db_typed_uuid(blueprint_id))) | ||
| .select(BpPendingMgsUpdateRot::as_select()) | ||
| .load_async(&*conn) | ||
| .await | ||
| .map_err(|e| { | ||
| public_error_from_diesel(e, ErrorHandler::Server) | ||
| })?; | ||
|
|
||
| paginator = p.found_batch(&batch, &|d| d.hw_baseboard_id); | ||
| for row in batch { | ||
| pending_updates_rot.push(row); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Load all pending SP updates. | ||
| let mut pending_updates_sp = Vec::new(); | ||
| { | ||
| use nexus_db_schema::schema::bp_pending_mgs_update_sp::dsl; |
Contributor
There was a problem hiding this comment.
I'd get a double check on this from someone else, maybe @jgallagher. Everything else looks great to me!
jgallagher
approved these changes
Jul 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Equivalent of #8291 for RoT