Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 11 additions & 7 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,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 @@ -2244,12 +2244,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
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