Skip to content

Commit dbbe333

Browse files
authored
Move ClickhouseClusterConfig construction from BlueprintBuilder to planner (#9370)
This is staged on top of #9347 and is a part of #9238. In particular, by moving this from the builder to the planner, we can remove the builder's need for an inventory collection entirely. There should be no functional changes here; it's just moving code around (with some reformatting to break it up a bit) and then removing the `collection` argument from all the callers of `BlueprintBuilder::new_based_on()`.
1 parent 017597c commit dbbe333

File tree

15 files changed

+170
-204
lines changed

15 files changed

+170
-204
lines changed

dev-tools/reconfigurator-cli/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,6 @@ fn cmd_blueprint_edit(
22272227
&sim.log,
22282228
blueprint,
22292229
&planning_input,
2230-
&latest_collection,
22312230
creator,
22322231
rng,
22332232
)

live-tests/tests/common/reconfigurator.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub async fn blueprint_load_target_enabled(
8181
pub async fn blueprint_edit_current_target(
8282
log: &slog::Logger,
8383
planning_input: &PlanningInput,
84-
collection: &Collection,
8584
nexus: &nexus_lockstep_client::Client,
8685
edit_fn: &dyn Fn(&mut BlueprintBuilder) -> Result<(), anyhow::Error>,
8786
) -> Result<(Blueprint, Blueprint), anyhow::Error> {
@@ -94,7 +93,6 @@ pub async fn blueprint_edit_current_target(
9493
log,
9594
&blueprint1,
9695
&planning_input,
97-
&collection,
9896
"test-suite",
9997
PlannerRng::from_entropy(),
10098
)

live-tests/tests/test_nexus_add_remove.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use common::LiveTestContext;
1010
use common::reconfigurator::blueprint_edit_current_target;
1111
use futures::TryStreamExt;
1212
use live_tests_macros::live_test;
13-
use nexus_inventory::CollectionBuilder;
1413
use nexus_lockstep_client::types::BlueprintTargetSet;
1514
use nexus_lockstep_client::types::QuiesceState;
1615
use nexus_lockstep_client::types::Saga;
@@ -59,11 +58,6 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
5958
PlanningInputFromDb::assemble(&opctx, &datastore, planner_config)
6059
.await
6160
.expect("planning input");
62-
let collection = datastore
63-
.inventory_get_latest_collection(opctx)
64-
.await
65-
.expect("latest inventory collection")
66-
.unwrap_or_else(|| CollectionBuilder::new("test").build());
6761
let initial_nexus_clients = lc.all_internal_nexus_clients().await.unwrap();
6862
let nexus = initial_nexus_clients.first().expect("internal Nexus client");
6963

@@ -75,7 +69,6 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
7569
let (blueprint1, blueprint2) = blueprint_edit_current_target(
7670
log,
7771
&planning_input,
78-
&collection,
7972
&nexus,
8073
&|builder: &mut BlueprintBuilder| {
8174
// We have to tell the builder what image source to use for the new
@@ -196,7 +189,6 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
196189
let (_blueprint2, blueprint3) = blueprint_edit_current_target(
197190
log,
198191
&planning_input,
199-
&collection,
200192
&nexus,
201193
&|builder: &mut BlueprintBuilder| {
202194
builder

live-tests/tests/test_nexus_handoff.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
5555
// That blueprint should be propagated to all sleds. We wait just a bit
5656
// here to deal with races set up by other tests failing or other ongoing
5757
// activity.
58-
let collection = blueprint_wait_sled_configs_propagated(
58+
let _collection = blueprint_wait_sled_configs_propagated(
5959
opctx,
6060
datastore,
6161
&blueprint_initial,
@@ -171,7 +171,6 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
171171
blueprint_edit_current_target(
172172
log,
173173
&planning_input,
174-
&collection,
175174
&nexus,
176175
&|builder: &mut BlueprintBuilder| {
177176
let mut external_networking_alloc =
@@ -228,7 +227,7 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
228227
// SMF may still be starting up the zone. Even once the Nexus process
229228
// starts, it will become blocked on the "not yet" DbMetadataNexusState,
230229
// waiting for handoff.
231-
let collection = blueprint_wait_sled_configs_propagated(
230+
let _collection = blueprint_wait_sled_configs_propagated(
232231
opctx,
233232
datastore,
234233
&blueprint_new_nexus,
@@ -273,7 +272,6 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
273272
blueprint_edit_current_target(
274273
log,
275274
&planning_input,
276-
&collection,
277275
&nexus,
278276
&|builder: &mut BlueprintBuilder| {
279277
builder.set_nexus_generation(next_generation);
@@ -439,7 +437,6 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
439437
blueprint_edit_current_target(
440438
log,
441439
&planning_input,
442-
&collection,
443440
new_nexus,
444441
&|builder: &mut BlueprintBuilder| {
445442
for (id, current_zone) in &current_nexus_zones {

nexus/db-queries/src/db/datastore/deployment.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,6 @@ mod tests {
31133113
use crate::db::raw_query_builder::QueryBuilder;
31143114
use gateway_types::rot::RotSlot;
31153115
use nexus_db_model::IpVersion;
3116-
use nexus_inventory::CollectionBuilder;
31173116
use nexus_inventory::now_db_precision;
31183117
use nexus_reconfigurator_planning::blueprint_builder::BlueprintBuilder;
31193118
use nexus_reconfigurator_planning::blueprint_builder::Ensure;
@@ -3439,7 +3438,6 @@ mod tests {
34393438
&logctx.log,
34403439
&blueprint1,
34413440
&planning_input,
3442-
&collection,
34433441
"test",
34443442
PlannerRng::from_entropy(),
34453443
)
@@ -3787,7 +3785,6 @@ mod tests {
37873785
&logctx.log,
37883786
&blueprint2,
37893787
&planning_input,
3790-
&collection,
37913788
"dummy",
37923789
PlannerRng::from_entropy(),
37933790
)
@@ -3844,7 +3841,6 @@ mod tests {
38443841
&logctx.log,
38453842
&blueprint3,
38463843
&planning_input,
3847-
&collection,
38483844
"dummy",
38493845
PlannerRng::from_entropy(),
38503846
)
@@ -3898,7 +3894,6 @@ mod tests {
38983894
&logctx.log,
38993895
&blueprint4,
39003896
&planning_input,
3901-
&collection,
39023897
"dummy",
39033898
PlannerRng::from_entropy(),
39043899
)
@@ -3956,7 +3951,6 @@ mod tests {
39563951
&logctx.log,
39573952
&blueprint5,
39583953
&planning_input,
3959-
&collection,
39603954
"dummy",
39613955
PlannerRng::from_entropy(),
39623956
)
@@ -4020,9 +4014,6 @@ mod tests {
40204014
.unwrap_err();
40214015
assert!(err.to_string().contains("no target blueprint set"));
40224016

4023-
// Create an initial empty collection
4024-
let collection = CollectionBuilder::new("test").build();
4025-
40264017
// Create three blueprints:
40274018
// * `blueprint1` has no parent
40284019
// * `blueprint2` and `blueprint3` both have `blueprint1` as parent
@@ -4034,7 +4025,6 @@ mod tests {
40344025
&logctx.log,
40354026
&blueprint1,
40364027
&EMPTY_PLANNING_INPUT,
4037-
&collection,
40384028
"test2",
40394029
PlannerRng::from_entropy(),
40404030
)
@@ -4044,7 +4034,6 @@ mod tests {
40444034
&logctx.log,
40454035
&blueprint1,
40464036
&EMPTY_PLANNING_INPUT,
4047-
&collection,
40484037
"test3",
40494038
PlannerRng::from_entropy(),
40504039
)
@@ -4145,7 +4134,6 @@ mod tests {
41454134
&logctx.log,
41464135
&blueprint3,
41474136
&EMPTY_PLANNING_INPUT,
4148-
&collection,
41494137
"test3",
41504138
PlannerRng::from_entropy(),
41514139
)
@@ -4179,9 +4167,6 @@ mod tests {
41794167
let db = TestDatabase::new_with_datastore(&logctx.log).await;
41804168
let (opctx, datastore) = (db.opctx(), db.datastore());
41814169

4182-
// Create an initial empty collection
4183-
let collection = CollectionBuilder::new("test").build();
4184-
41854170
// Create an initial blueprint and a child.
41864171
let blueprint1 = BlueprintBuilder::build_empty_with_sleds(
41874172
std::iter::empty(),
@@ -4191,7 +4176,6 @@ mod tests {
41914176
&logctx.log,
41924177
&blueprint1,
41934178
&EMPTY_PLANNING_INPUT,
4194-
&collection,
41954179
"test2",
41964180
PlannerRng::from_entropy(),
41974181
)
@@ -4431,7 +4415,6 @@ mod tests {
44314415
&logctx.log,
44324416
&blueprint1,
44334417
&example_system.input,
4434-
&example_system.collection,
44354418
&format!("{test_name}-2"),
44364419
PlannerRng::from_entropy(),
44374420
)

nexus/db-queries/src/db/datastore/vpc.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,17 +3322,12 @@ mod tests {
33223322
// sled IDs running services.
33233323
assert_service_sled_ids(&datastore, &[]).await;
33243324

3325-
// Build an initial empty collection
3326-
let collection =
3327-
system.to_collection_builder().expect("collection builder").build();
3328-
33293325
// Create a blueprint that has a Nexus on our third sled.
33303326
let bp1 = {
33313327
let mut builder = BlueprintBuilder::new_based_on(
33323328
&logctx.log,
33333329
&bp0,
33343330
&planning_input,
3335-
&collection,
33363331
"test",
33373332
PlannerRng::from_entropy(),
33383333
)
@@ -3426,7 +3421,6 @@ mod tests {
34263421
&logctx.log,
34273422
&bp2,
34283423
&planning_input,
3429-
&collection,
34303424
"test",
34313425
PlannerRng::from_entropy(),
34323426
)

nexus/reconfigurator/execution/src/dns.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ mod test {
330330
use nexus_db_queries::authz;
331331
use nexus_db_queries::context::OpContext;
332332
use nexus_db_queries::db::DataStore;
333-
use nexus_inventory::CollectionBuilder;
334333
use nexus_inventory::now_db_precision;
335334
use nexus_reconfigurator_planning::blueprint_builder::BlueprintBuilder;
336335
use nexus_reconfigurator_planning::blueprint_editor::ExternalNetworkingAllocator;
@@ -1563,12 +1562,10 @@ mod test {
15631562
}
15641563
.build()
15651564
.unwrap();
1566-
let collection = CollectionBuilder::new("test").build();
15671565
let mut builder = BlueprintBuilder::new_based_on(
15681566
&log,
15691567
&blueprint,
15701568
&planning_input,
1571-
&collection,
15721569
"test suite",
15731570
PlannerRng::from_entropy(),
15741571
)

nexus/reconfigurator/execution/src/sagas.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ mod test {
140140
log,
141141
&blueprint1,
142142
&example.input,
143-
&example.collection,
144143
"test suite",
145144
PlannerRng::from_entropy(),
146145
)
@@ -197,7 +196,6 @@ mod test {
197196
log,
198197
&blueprint2,
199198
&example.input,
200-
&example.collection,
201199
"test suite",
202200
PlannerRng::from_entropy(),
203201
)

0 commit comments

Comments
 (0)