Skip to content

Commit 2648592

Browse files
jgallaghersmklein
andauthored
Complete target-release test simulating an entire update (#9059)
Finishes the `target-release` `reconfigurator-test`, showing the simulate update walking through the process of starting new Nexus zones, waiting for handoff, then expunging the old Nexus zones. Has two tweaks: * Fixes a planning report off-by-one bug where we'd claim a zone was both out of date and expunged (or updated) within the same plan. * Adds a `set active-nexus-gen N` command to `reconfigurator-cli` to control Nexus handoff instead of assuming it completes instantly. Closes #8478 --------- Co-authored-by: Sean Klein <[email protected]>
1 parent f53eb00 commit 2648592

File tree

7 files changed

+1176
-70
lines changed

7 files changed

+1176
-70
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl ReconfiguratorSim {
150150
builder.set_internal_dns_version(parent_blueprint.internal_dns_version);
151151
builder.set_external_dns_version(parent_blueprint.external_dns_version);
152152

153+
let active_nexus_gen = state.config().active_nexus_zone_generation();
153154
let mut active_nexus_zones = BTreeSet::new();
154155
let mut not_yet_nexus_zones = BTreeSet::new();
155156

@@ -177,20 +178,23 @@ impl ReconfiguratorSim {
177178

178179
match &zone.zone_type {
179180
nexus_types::deployment::BlueprintZoneType::Nexus(nexus) => {
180-
if nexus.nexus_generation
181-
== parent_blueprint.nexus_generation
182-
{
181+
if nexus.nexus_generation == active_nexus_gen {
183182
active_nexus_zones.insert(zone.id);
184-
} else if nexus.nexus_generation
185-
> parent_blueprint.nexus_generation
186-
{
183+
} else if nexus.nexus_generation > active_nexus_gen {
187184
not_yet_nexus_zones.insert(zone.id);
188185
}
189186
}
190187
_ => (),
191188
}
192189
}
193190

191+
if active_nexus_zones.is_empty() {
192+
bail!(
193+
"no Nexus zones found at current active generation \
194+
({active_nexus_gen})"
195+
);
196+
}
197+
194198
builder.set_active_nexus_zones(active_nexus_zones);
195199
builder.set_not_yet_nexus_zones(not_yet_nexus_zones);
196200

@@ -1185,6 +1189,9 @@ enum SetArgs {
11851189
Seed { seed: String },
11861190
/// target number of Nexus instances (for planning)
11871191
NumNexus { num_nexus: u16 },
1192+
/// specify the generation of Nexus zones that are considered active when
1193+
/// running the blueprint planner
1194+
ActiveNexusGen { gen: Generation },
11881195
/// system's external DNS zone name (suffix)
11891196
ExternalDnsZoneName { zone_name: String },
11901197
/// system target release
@@ -2736,6 +2743,12 @@ fn cmd_set(
27362743
.target_nexus_zone_count(usize::from(num_nexus));
27372744
rv
27382745
}
2746+
SetArgs::ActiveNexusGen { gen } => {
2747+
let rv =
2748+
format!("will use active Nexus zones from generation {gen}");
2749+
state.config_mut().set_active_nexus_zone_generation(gen);
2750+
rv
2751+
}
27392752
SetArgs::ExternalDnsZoneName { zone_name } => {
27402753
let rv = format!(
27412754
"external DNS zone name: {:?} -> {:?}",

dev-tools/reconfigurator-cli/tests/input/cmds-target-release.txt

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,26 +446,50 @@ blueprint-diff latest
446446
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
447447
inventory-generate
448448

449-
# Add Nexus zones on three sleds
449+
# Start the Nexus handoff process: A planning step here should place three new
450+
# Nexus zones, each running from the new TUF repo artifact.
450451
blueprint-plan latest latest
451452
blueprint-diff latest
452453

453-
# Propagate configs to the sleds which should be running Nexus
454+
# Update inventory to reflect the three Nexus zones starting.
454455
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
455456
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
456457
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
457458
inventory-generate
458459

459-
# Update the Nexus generation from 1 -> 2, initiating
460-
# quiesce of the old Nexuses
460+
# Planning now should bump the top-level `nexus_generation` to 2, indicating
461+
# that we want handoff to begin.
461462
blueprint-plan latest latest
462463
blueprint-diff latest
463464

464-
# Expunge three Nexus zones, one at a time
465+
# Planning again should make no changes: we haven't yet performed a handoff,
466+
# so the old Nexus zones are still in charge.
465467
blueprint-plan latest latest
468+
blueprint-diff latest
469+
470+
# Bump the set of active Nexus zones; this simulates Nexus handoff.
471+
set active-nexus-gen 2
472+
473+
# Planning should now expunge one of the old Nexus zones.
466474
blueprint-plan latest latest
475+
blueprint-diff latest
476+
477+
# Two more planning iterations should expunge the remaining two old install
478+
# dataset Nexus zones.
479+
blueprint-plan latest latest
480+
blueprint-diff latest
467481
blueprint-plan latest latest
482+
blueprint-diff latest
468483

469-
# Attempt to plan one more blueprint.
470-
# There should be no changes attempted here.
484+
# Update sled configs and inventory to reflect the expunged Nexus zones.
485+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
486+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
487+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
488+
inventory-generate
489+
490+
# Planning now should note that the old zones are gone, but do nothing else:
491+
# the update is complete. All in-service zones have image sources from the new
492+
# TUF repo, and all zones using old images are expunged.
471493
blueprint-plan latest latest
494+
blueprint-diff latest
495+
blueprint-show latest

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,8 @@ wiped system
863863

864864
> load state.json
865865
loaded data from "state.json"
866+
warnings:
867+
could not determine active Nexus generation from serialized state: no target blueprint set (using default of 1)
866868
result:
867869
system:
868870
using collection 6e066695-94bc-4250-bd63-fd799c166cc1 as source of sled inventory data
@@ -875,6 +877,7 @@ result:
875877
config:
876878
configured external DNS zone name: oxide.example
877879
configured silo names: example-silo
880+
active Nexus generation: 1
878881

879882

880883
> sled-show dde1c0e2-b10d-4621-b420-f179f7a7a00a

0 commit comments

Comments
 (0)