Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6545d73
WIP: pretty good changes so far
davepacheco Sep 5, 2025
cba808d
WIP: cont
davepacheco Sep 6, 2025
8dce7c1
pass OpContext through usefully
davepacheco Sep 6, 2025
7ad5d55
start fixing/writing tests
davepacheco Sep 6, 2025
40f75ac
fix test
davepacheco Sep 8, 2025
b57236b
WIP: live test for handoff
davepacheco Sep 12, 2025
ee285d7
Merge branch 'main' into dap/quiesce-with-db
davepacheco Sep 13, 2025
f7c92b3
final timeout was too short due to transient Cockroach issue on a4x2
davepacheco Sep 15, 2025
d45a995
remove stuff that will go into separate PRs
davepacheco Sep 15, 2025
bdf36a7
clean up / refactor
davepacheco Sep 15, 2025
0830d57
fix wrong comment
davepacheco Sep 15, 2025
4d99381
write db_metadata_nexus records with the correct state
davepacheco Sep 16, 2025
fa6d78f
Merge remote-tracking branch 'origin/main' into dap/quiesce-with-db
davepacheco Sep 16, 2025
0f15899
Merge branch 'dap/quiesce-with-db' into dap/write-notyet-records
davepacheco Sep 16, 2025
f01ffe9
review feedback (update comment)
davepacheco Sep 16, 2025
e8eb204
review feedback
davepacheco Sep 16, 2025
f3de50c
add reconfigurator-cli command for bumping Nexus generation
davepacheco Sep 16, 2025
88d0668
Merge commit 'e8eb204' into dap/write-notyet-records
davepacheco Sep 16, 2025
04cdeb7
Merge commit 'a96a4e64c1f756cc58340ccb8a1082a6aab90706' into dap/writ…
davepacheco Sep 16, 2025
08b8580
Merge commit '2163cfa43af7d5558021946bd642f78e6104ab06' into dap/writ…
davepacheco Sep 16, 2025
a876669
reconfigurator-cli: ability to expunge multiple zones at once (#9035)
davepacheco Sep 18, 2025
805deb0
Merge commit '08b8580' into dap/reconfigurator-cli-bump-generation
davepacheco Sep 18, 2025
2e99c30
Merge commit 'f1a21fbecbb677d8600ecccb43cd4ed73077abd1' into dap/reco…
davepacheco Sep 18, 2025
f5762fc
Merge commit 'd98f3785629184b8384c170550b6f435fe7f9f87' into dap/reco…
davepacheco Sep 18, 2025
e3c0b03
Merge remote-tracking branch 'origin/main' into dap/reconfigurator-cl…
davepacheco Sep 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! developer REPL for driving blueprint planning

use anyhow::{Context, anyhow, bail};
use anyhow::{Context, anyhow, bail, ensure};
use camino::{Utf8Path, Utf8PathBuf};
use chrono::{DateTime, Utc};
use clap::{ArgAction, ValueEnum};
Expand Down Expand Up @@ -778,7 +778,7 @@ enum BlueprintEditCommands {
generation: Generation,
},
/// expunge a zone
ExpungeZone { zone_id: OmicronZoneUuid },
ExpungeZones { zone_ids: Vec<OmicronZoneUuid> },
/// mark an expunged zone ready for cleanup
MarkForCleanup { zone_id: OmicronZoneUuid },
/// configure an SP update
Expand Down Expand Up @@ -807,6 +807,11 @@ enum BlueprintEditCommands {
#[command(subcommand)]
command: BlueprintEditDebugCommands,
},
/// bumps the blueprint's Nexus generation
///
/// This initiates a handoff from the current generation of Nexus zones to
/// the next generation of Nexus zones.
BumpNexusGeneration,
}

#[derive(Debug, Subcommand)]
Expand Down Expand Up @@ -2180,6 +2185,29 @@ fn cmd_blueprint_edit(
.context("failed to add CockroachDB zone")?;
format!("added CockroachDB zone to sled {}", sled_id)
}
BlueprintEditCommands::BumpNexusGeneration => {
let current_generation = builder.nexus_generation();
let current_max = blueprint
.all_nexus_zones(BlueprintZoneDisposition::is_in_service)
.fold(
current_generation,
|current_max, (_sled_id, _zone_config, nexus_config)| {
std::cmp::max(
nexus_config.nexus_generation,
current_max,
)
},
);
ensure!(
current_max > current_generation,
"cannot bump blueprint generation (currently \
{current_generation}) past highest deployed Nexus \
generation (currently {current_max})",
);
let next = current_generation.next();
builder.set_nexus_generation(next);
format!("nexus generation: {current_generation} -> {next}")
}
BlueprintEditCommands::SetRemoveMupdateOverride { sled_id, value } => {
let sled_id = sled_id.to_sled_id(system.description())?;
builder
Expand Down Expand Up @@ -2235,12 +2263,16 @@ fn cmd_blueprint_edit(
.context("failed to set host phase 2 source")?;
rv
}
BlueprintEditCommands::ExpungeZone { zone_id } => {
let sled_id = sled_with_zone(&builder, &zone_id)?;
builder
.sled_expunge_zone(sled_id, zone_id)
.context("failed to expunge zone")?;
format!("expunged zone {zone_id} from sled {sled_id}")
BlueprintEditCommands::ExpungeZones { zone_ids } => {
let mut rv = String::new();
for zone_id in zone_ids {
let sled_id = sled_with_zone(&builder, &zone_id)?;
builder.sled_expunge_zone(sled_id, zone_id).with_context(
|| format!("failed to expunge zone {zone_id}"),
)?;
swriteln!(rv, "expunged zone {zone_id} from sled {sled_id}");
}
rv
}
BlueprintEditCommands::MarkForCleanup { zone_id } => {
let sled_id = sled_with_zone(&builder, &zone_id)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
load-example --seed test_expunge_newly_added_external_dns

blueprint-show 3f00b694-1b16-4aaa-8f78-e6b3a527b434
blueprint-edit 3f00b694-1b16-4aaa-8f78-e6b3a527b434 expunge-zone 8429c772-07e8-40a6-acde-2ed47d16cf84
blueprint-edit 3f00b694-1b16-4aaa-8f78-e6b3a527b434 expunge-zones 8429c772-07e8-40a6-acde-2ed47d16cf84

# Diff DNS to see that the expunged zone is no longer has DNS records.
blueprint-diff 3f00b694-1b16-4aaa-8f78-e6b3a527b434 366b0b68-d80e-4bc1-abd3-dc69837847e0
Expand All @@ -15,5 +15,5 @@ blueprint-diff 366b0b68-d80e-4bc1-abd3-dc69837847e0 9c998c1d-1a7b-440a-ae0c-40f7

blueprint-show 9c998c1d-1a7b-440a-ae0c-40f781dea6e2
# expunging the new zone should work, then diff again to see the new zone also have its DNS records removed.
blueprint-edit 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 expunge-zone 8c0a1969-15b6-4165-ba6d-a27c24151037
blueprint-edit 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 expunge-zones 8c0a1969-15b6-4165-ba6d-a27c24151037
blueprint-diff 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 2ac8c740-444d-42ff-8d66-9812a7e51288
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load-example

blueprint-show dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
# Expunge an internal DNS zone
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zone 99e2f30b-3174-40bf-a78a-90da8abba8ca
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zones 99e2f30b-3174-40bf-a78a-90da8abba8ca
# Diff against the new blueprint; the zone has been expunged so its records should be removed.
blueprint-diff dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1

Expand Down
12 changes: 12 additions & 0 deletions dev-tools/reconfigurator-cli/tests/input/cmds-expunge-zones.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Load example system
load-example --nsleds 3 --ndisks-per-sled 3
blueprint-list
blueprint-show dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21

# Expunge one zone.
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zones 694bd14f-cb24-4be4-bb19-876e79cda2c8
blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1

# Expunge multiple zones.
blueprint-edit 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 expunge-zones 7c252b64-c5af-4ec1-989e-9a03f3b0f111 dfac80b4-a887-430a-ae87-a4e065dba787
blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4
18 changes: 18 additions & 0 deletions dev-tools/reconfigurator-cli/tests/input/cmds-nexus-generation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Load example system
load-example --nsleds 3 --ndisks-per-sled 3

# Print the initial configuration
show
sled-list

# Try to bump the Nexus generation. This should not work because you can't
# bump it to a generation that has no Nexus instances deployed.
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 bump-nexus-generation

# Now, deploy a Nexus instance at the next generation.
blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 add-nexus serial0 2
blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1

# Now we can bump the Nexus generation to trigger a handoff.
blueprint-edit 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 bump-nexus-generation
blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ empty planning report for blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434.



> blueprint-edit 3f00b694-1b16-4aaa-8f78-e6b3a527b434 expunge-zone 8429c772-07e8-40a6-acde-2ed47d16cf84
> blueprint-edit 3f00b694-1b16-4aaa-8f78-e6b3a527b434 expunge-zones 8429c772-07e8-40a6-acde-2ed47d16cf84
blueprint 366b0b68-d80e-4bc1-abd3-dc69837847e0 created from blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434: expunged zone 8429c772-07e8-40a6-acde-2ed47d16cf84 from sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a



> # Diff DNS to see that the expunged zone is no longer has DNS records.
> blueprint-diff 3f00b694-1b16-4aaa-8f78-e6b3a527b434 366b0b68-d80e-4bc1-abd3-dc69837847e0
from: blueprint 3f00b694-1b16-4aaa-8f78-e6b3a527b434
Expand Down Expand Up @@ -1346,9 +1347,10 @@ planning report for blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2:


> # expunging the new zone should work, then diff again to see the new zone also have its DNS records removed.
> blueprint-edit 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 expunge-zone 8c0a1969-15b6-4165-ba6d-a27c24151037
> blueprint-edit 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 expunge-zones 8c0a1969-15b6-4165-ba6d-a27c24151037
blueprint 2ac8c740-444d-42ff-8d66-9812a7e51288 created from blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2: expunged zone 8c0a1969-15b6-4165-ba6d-a27c24151037 from sled 9dc50690-f9bf-4520-bf80-051d0f465c2c


> blueprint-diff 9c998c1d-1a7b-440a-ae0c-40f781dea6e2 2ac8c740-444d-42ff-8d66-9812a7e51288
from: blueprint 9c998c1d-1a7b-440a-ae0c-40f781dea6e2
to: blueprint 2ac8c740-444d-42ff-8d66-9812a7e51288
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,10 @@ empty planning report for blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21.


> # Expunge an internal DNS zone
> blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zone 99e2f30b-3174-40bf-a78a-90da8abba8ca
> blueprint-edit dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 expunge-zones 99e2f30b-3174-40bf-a78a-90da8abba8ca
blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 created from blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21: expunged zone 99e2f30b-3174-40bf-a78a-90da8abba8ca from sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c


> # Diff against the new blueprint; the zone has been expunged so its records should be removed.
> blueprint-diff dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
from: blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
Expand Down
Empty file.
Loading
Loading