Skip to content

Commit cb110e2

Browse files
authored
[reconfigurator] Consider Internal DNS generation in planner (#8683)
Refuse to tear down an Internal DNS zone unless we're at sufficient redundancy, with an expected generation number for "last deployed data". Also: - Fixes a blippy bug that was overly conservative for expunged datasets, when finding duplicate dataset kinds - Adds internal DNS generation statuses when converting a system description to an inventory collection Fixes #8545
1 parent 76e9eb8 commit cb110e2

File tree

5 files changed

+432
-21
lines changed

5 files changed

+432
-21
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,7 @@ LEDGERED SLED CONFIG
15101510
slot B details UNAVAILABLE: constructed via debug_assume_success()
15111511
last reconciled config: matches ledgered config
15121512
no information from NTP for this sled
1513+
Internal DNS generation: 1
15131514
no mupdate override to clear
15141515
no orphaned datasets
15151516
all disks reconciled successfully

dev-tools/reconfigurator-cli/tests/output/cmds-mupdate-update-flow-stdout

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ LEDGERED SLED CONFIG
183183
slot B details UNAVAILABLE: constructed via debug_assume_success()
184184
last reconciled config: matches ledgered config
185185
no information from NTP for this sled
186+
Internal DNS generation: 1
186187
error reading mupdate override, so sled agent didn't attempt to clear it
187188
no orphaned datasets
188189
all disks reconciled successfully
@@ -291,6 +292,7 @@ LEDGERED SLED CONFIG
291292
slot B details UNAVAILABLE: constructed via debug_assume_success()
292293
last reconciled config: matches ledgered config
293294
no information from NTP for this sled
295+
Internal DNS generation: 1
294296
mupdate override present, but sled agent was not instructed to clear it
295297
no orphaned datasets
296298
all disks reconciled successfully
@@ -388,6 +390,7 @@ LEDGERED SLED CONFIG
388390
slot B details UNAVAILABLE: constructed via debug_assume_success()
389391
last reconciled config: matches ledgered config
390392
no information from NTP for this sled
393+
Internal DNS generation: 1
391394
mupdate override present, but sled agent was not instructed to clear it
392395
no orphaned datasets
393396
all disks reconciled successfully

nexus/reconfigurator/blippy/src/checks.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ impl<'a> DatasetsBySledCache<'a> {
317317

318318
let mut by_zpool = BTreeMap::new();
319319
for dataset in sled_config.datasets.iter() {
320+
if dataset.disposition.is_expunged() {
321+
continue;
322+
}
323+
320324
let by_kind: &mut BTreeMap<_, _> =
321325
by_zpool.entry(dataset.pool.id()).or_default();
322326

@@ -1262,6 +1266,57 @@ mod tests {
12621266
logctx.cleanup_successful();
12631267
}
12641268

1269+
#[test]
1270+
fn test_zpool_with_expunged_duplicate_dataset_kinds() {
1271+
static TEST_NAME: &str =
1272+
"test_zpool_with_expunged_duplicate_dataset_kinds";
1273+
let logctx = test_setup_log(TEST_NAME);
1274+
let (_, _, mut blueprint) = example(&logctx.log, TEST_NAME);
1275+
1276+
let mut by_kind = BTreeMap::new();
1277+
1278+
// Loop over the datasets until we find a dataset kind that already
1279+
// exists on a different zpool, then copy it over.
1280+
//
1281+
// When we make the copy, also mark it expunged.
1282+
//
1283+
// By marking the dataset expunged, we should not see "duplicate dataset
1284+
// kind" errors.
1285+
let mut found_duplicate = false;
1286+
'outer: for (_, sled_config) in blueprint.sleds.iter_mut() {
1287+
for mut dataset in sled_config.datasets.iter_mut() {
1288+
if let Some(prev) =
1289+
by_kind.insert(dataset.kind.clone(), dataset.clone())
1290+
{
1291+
dataset.pool = prev.pool;
1292+
dataset.disposition = BlueprintDatasetDisposition::Expunged;
1293+
1294+
found_duplicate = true;
1295+
break 'outer;
1296+
}
1297+
}
1298+
}
1299+
assert!(found_duplicate);
1300+
1301+
let report =
1302+
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1303+
eprintln!("{}", report.display());
1304+
for note in report.notes() {
1305+
match &note.kind {
1306+
Kind::Sled { kind, .. } => match kind {
1307+
SledKind::ZpoolWithDuplicateDatasetKinds { .. } => {
1308+
panic!(
1309+
"Saw unexpected duplicate dataset kind note: {note:?}"
1310+
);
1311+
}
1312+
_ => (),
1313+
},
1314+
}
1315+
}
1316+
1317+
logctx.cleanup_successful();
1318+
}
1319+
12651320
#[test]
12661321
fn test_zpool_missing_default_datasets() {
12671322
static TEST_NAME: &str = "test_zpool_missing_default_datasets";

0 commit comments

Comments
 (0)