Skip to content

Commit 3aa4aba

Browse files
committed
Add planner wait conditions
1 parent 0006a30 commit 3aa4aba

File tree

9 files changed

+215
-73
lines changed

9 files changed

+215
-73
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use nexus_reconfigurator_simulation::{BlueprintId, SimState};
2626
use nexus_types::deployment::OmicronZoneNic;
2727
use nexus_types::deployment::PlanningInput;
2828
use nexus_types::deployment::SledFilter;
29+
use nexus_types::deployment::ZoneExpungeReason;
2930
use nexus_types::deployment::execution;
3031
use nexus_types::deployment::execution::blueprint_external_dns_config;
3132
use nexus_types::deployment::execution::blueprint_internal_dns_config;
@@ -1249,7 +1250,11 @@ fn cmd_blueprint_edit(
12491250
BlueprintEditCommands::ExpungeZone { zone_id } => {
12501251
let sled_id = sled_with_zone(&builder, &zone_id)?;
12511252
builder
1252-
.sled_expunge_zone(sled_id, zone_id)
1253+
.sled_expunge_zone(
1254+
sled_id,
1255+
zone_id,
1256+
&ZoneExpungeReason::ManualEdit,
1257+
)
12531258
.context("failed to expunge zone")?;
12541259
format!("expunged zone {zone_id} from sled {sled_id}")
12551260
}

dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,7 @@ INFO sufficient ExternalDns zones exist in plan, desired_count: 0, current_count
505505
WARN failed to place all new desired Nexus zones, placed: 0, wanted_to_place: 3
506506
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
507507
WARN cannot issue more SP updates (no current artifacts)
508-
INFO some zones not yet up-to-date, sled_id: 89d02b1b-478c-401a-8e28-7a26f74fa41b
509-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
508+
INFO some zones not yet up-to-date
510509
generated blueprint 86db3308-f817-4626-8838-4085949a6a41 based on parent blueprint ade5749d-bdf3-4fab-a8ae-00bea01b3a5a
511510

512511
> blueprint-list

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-external-dns-stdout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,7 @@ INFO added zone to sled, sled_id: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a, kind: Ex
980980
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
981981
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
982982
WARN cannot issue more SP updates (no current artifacts)
983-
INFO some zones not yet up-to-date, sled_id: 711ac7f8-d19e-4572-bdb9-e9b50f6e362a
984-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
983+
INFO some zones not yet up-to-date
985984
generated blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 based on parent blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0
986985

987986
> blueprint-diff 366b0b68-d80e-4bc1-abd3-dc69837847e0 9c998c1d-1a7b-440a-ae0c-40f781dea6e2

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-internal-dns-stdout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,7 @@ INFO sufficient ExternalDns zones exist in plan, desired_count: 3, current_count
10131013
INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
10141014
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
10151015
WARN cannot issue more SP updates (no current artifacts)
1016-
INFO some zones not yet up-to-date, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
1017-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
1016+
INFO some zones not yet up-to-date
10181017
generated blueprint af934083-59b5-4bf6-8966-6fb5292c29e1 based on parent blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4
10191018

10201019
> blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4 af934083-59b5-4bf6-8966-6fb5292c29e1

dev-tools/reconfigurator-cli/tests/output/target-release-stdout

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
170170
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
171171
INFO configuring SP update, artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: NoValidVersion, expected_active_version: 0.0.1, component: sp, sp_slot: 0, sp_type: Sled, serial_number: serial0, part_number: model0
172172
INFO reached maximum number of pending SP updates, max: 1
173-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
174173
generated blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 based on parent blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
175174

176175
> blueprint-diff dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
@@ -352,7 +351,6 @@ INFO sufficient Nexus zones exist in plan, desired_count: 3, current_count: 3
352351
INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
353352
INFO SP update not yet completed (will keep it), artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: NoValidVersion, expected_active_version: 0.0.1, component: sp, sp_slot: 0, sp_type: Sled, serial_number: serial0, part_number: model0
354353
INFO reached maximum number of pending SP updates, max: 1
355-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
356354
generated blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4 based on parent blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
357355

358356
> blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 58d5e830-0884-47d8-a7cd-b2b3751adeb4
@@ -537,7 +535,6 @@ INFO SP update completed (will remove it and re-evaluate board), artifact_versio
537535
INFO skipping board for SP update, serial_number: serial0, part_number: model0
538536
INFO configuring SP update, artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: NoValidVersion, expected_active_version: 0.0.1, component: sp, sp_slot: 1, sp_type: Sled, serial_number: serial1, part_number: model1
539537
INFO reached maximum number of pending SP updates, max: 1
540-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
541538
generated blueprint af934083-59b5-4bf6-8966-6fb5292c29e1 based on parent blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4
542539

543540
> blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4 af934083-59b5-4bf6-8966-6fb5292c29e1
@@ -729,7 +726,6 @@ INFO sufficient Oximeter zones exist in plan, desired_count: 0, current_count: 0
729726
INFO SP update impossible (will remove it and re-evaluate board), artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: NoValidVersion, expected_active_version: 0.0.1, component: sp, sp_slot: 1, sp_type: Sled, serial_number: serial1, part_number: model1
730727
INFO configuring SP update, artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: Version(ArtifactVersion("0.5.0")), expected_active_version: 0.0.1, component: sp, sp_slot: 1, sp_type: Sled, serial_number: serial1, part_number: model1
731728
INFO reached maximum number of pending SP updates, max: 1
732-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
733729
generated blueprint df06bb57-ad42-4431-9206-abff322896c7 based on parent blueprint af934083-59b5-4bf6-8966-6fb5292c29e1
734730

735731
> blueprint-diff af934083-59b5-4bf6-8966-6fb5292c29e1 df06bb57-ad42-4431-9206-abff322896c7
@@ -922,7 +918,6 @@ INFO skipping board for SP update, serial_number: serial1, part_number: model1
922918
INFO skipping board for SP update, serial_number: serial0, part_number: model0
923919
INFO configuring SP update, artifact_version: 1.0.0, artifact_hash: 7e6667e646ad001b54c8365a3d309c03f89c59102723d38d01697ee8079fe670, expected_inactive_version: NoValidVersion, expected_active_version: 0.0.1, component: sp, sp_slot: 2, sp_type: Sled, serial_number: serial2, part_number: model2
924920
INFO ran out of boards for SP update
925-
INFO will ensure cockroachdb setting, setting: cluster.preserve_downgrade_option, value: DoNotModify
926921
generated blueprint 7f976e0d-d2a5-4eeb-9e82-c82bc2824aba based on parent blueprint df06bb57-ad42-4431-9206-abff322896c7
927922

928923
> blueprint-diff df06bb57-ad42-4431-9206-abff322896c7 7f976e0d-d2a5-4eeb-9e82-c82bc2824aba

live-tests/tests/test_nexus_add_remove.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use nexus_reconfigurator_planning::planner::Planner;
1919
use nexus_reconfigurator_preparation::PlanningInputFromDb;
2020
use nexus_sled_agent_shared::inventory::ZoneKind;
2121
use nexus_types::deployment::SledFilter;
22+
use nexus_types::deployment::ZoneExpungeReason;
2223
use omicron_common::address::NEXUS_INTERNAL_PORT;
2324
use omicron_test_utils::dev::poll::CondCheckError;
2425
use omicron_test_utils::dev::poll::wait_for_condition;
@@ -123,7 +124,11 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
123124
&nexus,
124125
&|builder: &mut BlueprintBuilder| {
125126
builder
126-
.sled_expunge_zone(sled_id, new_zone.id)
127+
.sled_expunge_zone(
128+
sled_id,
129+
new_zone.id,
130+
&ZoneExpungeReason::Test,
131+
)
127132
.context("expunging zone")?;
128133
Ok(())
129134
},

nexus/reconfigurator/planning/src/blueprint_builder/builder.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::blueprint_editor::ExternalSnatNetworkingChoice;
1414
use crate::blueprint_editor::NoAvailableDnsSubnets;
1515
use crate::blueprint_editor::SledEditError;
1616
use crate::blueprint_editor::SledEditor;
17-
use crate::planner::ZoneExpungeReason;
1817
use crate::planner::rng::PlannerRng;
1918
use anyhow::Context as _;
2019
use anyhow::anyhow;
@@ -45,6 +44,7 @@ use nexus_types::deployment::PendingMgsUpdates;
4544
use nexus_types::deployment::PlanningInput;
4645
use nexus_types::deployment::SledFilter;
4746
use nexus_types::deployment::SledResources;
47+
use nexus_types::deployment::ZoneExpungeReason;
4848
use nexus_types::deployment::ZpoolFilter;
4949
use nexus_types::deployment::ZpoolName;
5050
use nexus_types::deployment::blueprint_zone_type;
@@ -337,6 +337,13 @@ impl fmt::Display for Operation {
337337
ZoneExpungeReason::ClickhouseSingleNodeDisabled => {
338338
"clickhouse single-node disabled via policy"
339339
}
340+
ZoneExpungeReason::ManualEdit => {
341+
"blueprint edited manually"
342+
}
343+
ZoneExpungeReason::Test => "for testing purposes",
344+
ZoneExpungeReason::UpdatedSource { from, to } => {
345+
&format!("updating from image source {from:?} → {to:?}")
346+
}
340347
};
341348
write!(
342349
f,
@@ -1741,6 +1748,7 @@ impl<'a> BlueprintBuilder<'a> {
17411748
&mut self,
17421749
sled_id: SledUuid,
17431750
zone_id: OmicronZoneUuid,
1751+
_reason: &ZoneExpungeReason,
17441752
) -> Result<SledEditCounts, Error> {
17451753
let editor = self.sled_editors.get_mut(&sled_id).ok_or_else(|| {
17461754
Error::Planner(anyhow!(

0 commit comments

Comments
 (0)