Skip to content

Commit c574f40

Browse files
committed
Revert "[RSS] Initial blueprint: only set address for Crucible datasets (#7310)"
This reverts commit 0603f0b.
1 parent 34fd65f commit c574f40

File tree

14 files changed

+44
-312
lines changed

14 files changed

+44
-312
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/src/disk.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ impl DatasetName {
112112
&self.pool_name
113113
}
114114

115-
pub fn kind(&self) -> &DatasetKind {
115+
// TODO(https://github.com/oxidecomputer/omicron/issues/7115): Rename
116+
// this to "kind?
117+
pub fn dataset(&self) -> &DatasetKind {
116118
&self.kind
117119
}
118120

nexus/reconfigurator/blippy/src/blippy.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use omicron_uuid_kinds::SledUuid;
1919
use omicron_uuid_kinds::ZpoolUuid;
2020
use std::collections::BTreeSet;
2121
use std::net::IpAddr;
22-
use std::net::SocketAddrV6;
2322

2423
#[derive(Debug, Clone, PartialEq, Eq)]
2524
pub struct Note {
@@ -170,17 +169,6 @@ pub enum SledKind {
170169
OrphanedDataset { dataset: BlueprintDatasetConfig },
171170
/// A dataset claims to be on a zpool that does not exist.
172171
DatasetOnNonexistentZpool { dataset: BlueprintDatasetConfig },
173-
/// A Crucible dataset does not have its `address` set to its corresponding
174-
/// Crucible zone.
175-
CrucibleDatasetWithIncorrectAddress {
176-
dataset: BlueprintDatasetConfig,
177-
expected_address: SocketAddrV6,
178-
},
179-
/// A non-Crucible dataset has an address.
180-
NonCrucibleDatasetWithAddress {
181-
dataset: BlueprintDatasetConfig,
182-
address: SocketAddrV6,
183-
},
184172
}
185173

186174
impl fmt::Display for SledKind {
@@ -364,24 +352,6 @@ impl fmt::Display for SledKind {
364352
dataset.kind, dataset.id, dataset.pool
365353
)
366354
}
367-
SledKind::CrucibleDatasetWithIncorrectAddress {
368-
dataset,
369-
expected_address,
370-
} => {
371-
write!(
372-
f,
373-
"Crucible dataset {} has bad address {:?} (expected {})",
374-
dataset.id, dataset.address, expected_address,
375-
)
376-
}
377-
SledKind::NonCrucibleDatasetWithAddress { dataset, address } => {
378-
write!(
379-
f,
380-
"non-Crucible dataset ({:?} {}) has an address: {} \
381-
(only Crucible datasets should have addresses)",
382-
dataset.kind, dataset.id, address,
383-
)
384-
}
385355
}
386356
}
387357
}

nexus/reconfigurator/blippy/src/checks.rs

Lines changed: 3 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ use crate::blippy::Blippy;
66
use crate::blippy::Severity;
77
use crate::blippy::SledKind;
88
use nexus_sled_agent_shared::inventory::ZoneKind;
9-
use nexus_types::deployment::blueprint_zone_type;
109
use nexus_types::deployment::BlueprintDatasetConfig;
1110
use nexus_types::deployment::BlueprintDatasetFilter;
1211
use nexus_types::deployment::BlueprintZoneConfig;
1312
use nexus_types::deployment::BlueprintZoneFilter;
14-
use nexus_types::deployment::BlueprintZoneType;
1513
use nexus_types::deployment::OmicronZoneExternalIp;
1614
use omicron_common::address::DnsSubnet;
1715
use omicron_common::address::Ipv6Subnet;
@@ -415,10 +413,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
415413
}
416414
}
417415

418-
// In a check below, we want to look up Crucible zones by zpool; build that
419-
// map as we perform the next set of checks.
420-
let mut crucible_zone_by_zpool = BTreeMap::new();
421-
422416
// There should be a dataset for every dataset referenced by a running zone
423417
// (filesystem or durable).
424418
for (sled_id, zone_config) in blippy
@@ -437,7 +431,7 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
437431
Some(dataset) => {
438432
match sled_datasets
439433
.get(&dataset.pool().id())
440-
.and_then(|by_zpool| by_zpool.get(dataset.kind()))
434+
.and_then(|by_zpool| by_zpool.get(dataset.dataset()))
441435
{
442436
Some(dataset) => {
443437
expected_datasets.insert(dataset.id);
@@ -477,21 +471,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
477471
);
478472
}
479473
}
480-
481-
if dataset.kind == DatasetKind::Crucible {
482-
match &zone_config.zone_type {
483-
BlueprintZoneType::Crucible(crucible_zone_config) => {
484-
crucible_zone_by_zpool.insert(
485-
dataset.dataset.pool_name.id(),
486-
crucible_zone_config,
487-
);
488-
}
489-
_ => unreachable!(
490-
"zone_type.durable_dataset() returned Crucible for \
491-
non-Crucible zone type"
492-
),
493-
}
494-
}
495474
}
496475
}
497476

@@ -554,50 +533,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
554533
continue;
555534
}
556535
}
557-
558-
// All Crucible datasets should have their address set to the address of the
559-
// Crucible zone on their same zpool, and all non-Crucible datasets should
560-
// not have addresses.
561-
for (sled_id, dataset) in blippy
562-
.blueprint()
563-
.all_omicron_datasets(BlueprintDatasetFilter::InService)
564-
{
565-
match dataset.kind {
566-
DatasetKind::Crucible => {
567-
let Some(blueprint_zone_type::Crucible { address, .. }) =
568-
crucible_zone_by_zpool.get(&dataset.pool.id())
569-
else {
570-
// We already checked above that all datasets have
571-
// corresponding zones, so a failure to find the zone for
572-
// this dataset would have already produced a note; just
573-
// skip it.
574-
continue;
575-
};
576-
if dataset.address != Some(*address) {
577-
blippy.push_sled_note(
578-
sled_id,
579-
Severity::Fatal,
580-
SledKind::CrucibleDatasetWithIncorrectAddress {
581-
dataset: dataset.clone(),
582-
expected_address: *address,
583-
},
584-
);
585-
}
586-
}
587-
_ => {
588-
if let Some(address) = dataset.address {
589-
blippy.push_sled_note(
590-
sled_id,
591-
Severity::Fatal,
592-
SledKind::NonCrucibleDatasetWithAddress {
593-
dataset: dataset.clone(),
594-
address,
595-
},
596-
);
597-
}
598-
}
599-
}
600-
}
601536
}
602537

603538
#[cfg(test)]
@@ -1359,7 +1294,7 @@ mod tests {
13591294
== durable_zone.zone_type.durable_dataset().unwrap().kind);
13601295
let root_dataset = root_zone.filesystem_dataset().unwrap();
13611296
let matches_root = (dataset.pool == *root_dataset.pool())
1362-
&& (dataset.kind == *root_dataset.kind());
1297+
&& (dataset.kind == *root_dataset.dataset());
13631298
!matches_durable && !matches_root
13641299
});
13651300

@@ -1530,7 +1465,7 @@ mod tests {
15301465
if (dataset.pool == durable_dataset.dataset.pool_name
15311466
&& dataset.kind == durable_dataset.kind)
15321467
|| (dataset.pool == *root_dataset.pool()
1533-
&& dataset.kind == *root_dataset.kind())
1468+
&& dataset.kind == *root_dataset.dataset())
15341469
{
15351470
Some(Note {
15361471
severity: Severity::Fatal,
@@ -1626,108 +1561,4 @@ mod tests {
16261561

16271562
logctx.cleanup_successful();
16281563
}
1629-
1630-
#[test]
1631-
fn test_dataset_with_bad_address() {
1632-
static TEST_NAME: &str = "test_dataset_with_bad_address";
1633-
let logctx = test_setup_log(TEST_NAME);
1634-
let (_, _, mut blueprint) = example(&logctx.log, TEST_NAME);
1635-
1636-
let crucible_addr_by_zpool = blueprint
1637-
.all_omicron_zones(BlueprintZoneFilter::ShouldBeRunning)
1638-
.filter_map(|(_, z)| match z.zone_type {
1639-
BlueprintZoneType::Crucible(
1640-
blueprint_zone_type::Crucible { address, .. },
1641-
) => {
1642-
let zpool_id = z
1643-
.zone_type
1644-
.durable_zpool()
1645-
.expect("crucible zone has durable zpool")
1646-
.id();
1647-
Some((zpool_id, address))
1648-
}
1649-
_ => None,
1650-
})
1651-
.collect::<BTreeMap<_, _>>();
1652-
1653-
// We have three ways a dataset address can be wrong:
1654-
//
1655-
// * A Crucible dataset has no address
1656-
// * A Crucible dataset has an address but it doesn't match its zone
1657-
// * A non-Crucible dataset has an address
1658-
//
1659-
// Make all three kinds of modifications to three different datasets and
1660-
// ensure we see all three noted.
1661-
let mut cleared_crucible_addr = false;
1662-
let mut changed_crucible_addr = false;
1663-
let mut set_non_crucible_addr = false;
1664-
let mut expected_notes = Vec::new();
1665-
1666-
for (sled_id, datasets_config) in
1667-
blueprint.blueprint_datasets.iter_mut()
1668-
{
1669-
for dataset in datasets_config.datasets.values_mut() {
1670-
match dataset.kind {
1671-
DatasetKind::Crucible => {
1672-
let bad_address = if !cleared_crucible_addr {
1673-
cleared_crucible_addr = true;
1674-
None
1675-
} else if !changed_crucible_addr {
1676-
changed_crucible_addr = true;
1677-
Some("[1234:5678:9abc::]:0".parse().unwrap())
1678-
} else {
1679-
continue;
1680-
};
1681-
1682-
dataset.address = bad_address;
1683-
let expected_address = *crucible_addr_by_zpool
1684-
.get(&dataset.pool.id())
1685-
.expect("found crucible zone for zpool");
1686-
expected_notes.push(Note {
1687-
severity: Severity::Fatal,
1688-
kind: Kind::Sled {
1689-
sled_id: *sled_id,
1690-
kind: SledKind::CrucibleDatasetWithIncorrectAddress {
1691-
dataset: dataset.clone(),
1692-
expected_address,
1693-
},
1694-
},
1695-
});
1696-
}
1697-
_ => {
1698-
if !set_non_crucible_addr {
1699-
set_non_crucible_addr = true;
1700-
let address = "[::1]:0".parse().unwrap();
1701-
dataset.address = Some(address);
1702-
expected_notes.push(Note {
1703-
severity: Severity::Fatal,
1704-
kind: Kind::Sled {
1705-
sled_id: *sled_id,
1706-
kind: SledKind::NonCrucibleDatasetWithAddress {
1707-
dataset: dataset.clone(),
1708-
address,
1709-
},
1710-
},
1711-
});
1712-
}
1713-
}
1714-
}
1715-
}
1716-
}
1717-
1718-
// We should have modified 3 datasets.
1719-
assert_eq!(expected_notes.len(), 3);
1720-
1721-
let report =
1722-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1723-
eprintln!("{}", report.display());
1724-
for note in expected_notes {
1725-
assert!(
1726-
report.notes().contains(&note),
1727-
"did not find expected note {note:?}"
1728-
);
1729-
}
1730-
1731-
logctx.cleanup_successful();
1732-
}
17331564
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,7 @@ pub mod test {
27902790
{
27912791
for dataset in dataset_configs {
27922792
let id = dataset.id;
2793-
let kind = dataset.name.kind();
2793+
let kind = dataset.name.dataset();
27942794
let by_kind: &mut BTreeMap<_, _> =
27952795
input_dataset_ids.entry(*zpool_id).or_default();
27962796
let prev = by_kind.insert(kind.clone(), id);

nexus/reconfigurator/planning/src/blueprint_editor/sled_editor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ impl ActiveSledEditor {
460460
}
461461

462462
if let Some(dataset) = config.filesystem_dataset() {
463-
self.datasets.expunge(&dataset.pool().id(), dataset.kind())?;
463+
self.datasets.expunge(&dataset.pool().id(), dataset.dataset())?;
464464
}
465465
if let Some(dataset) = config.zone_type.durable_dataset() {
466466
self.datasets

nexus/reconfigurator/planning/src/blueprint_editor/sled_editor/datasets.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl DatasetIdsBackfillFromDb {
7070
let iter = resources.all_datasets(ZpoolFilter::InService).flat_map(
7171
|(&zpool_id, configs)| {
7272
configs.iter().map(move |config| {
73-
(zpool_id, config.name.kind().clone(), config.id)
73+
(zpool_id, config.name.dataset().clone(), config.id)
7474
})
7575
},
7676
);
@@ -162,7 +162,7 @@ impl PartialDatasetConfig {
162162

163163
pub fn for_transient_zone(name: DatasetName) -> Self {
164164
assert!(
165-
matches!(name.kind(), DatasetKind::TransientZone { .. }),
165+
matches!(name.dataset(), DatasetKind::TransientZone { .. }),
166166
"for_transient_zone called with incorrect dataset kind: {name:?}"
167167
);
168168
Self {

sled-agent/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ guppy.workspace = true
119119
hex-literal.workspace = true
120120
http.workspace = true
121121
hyper.workspace = true
122-
nexus-reconfigurator-blippy.workspace = true
123122
omicron-test-utils.workspace = true
124123
pretty_assertions.workspace = true
125124
rcgen.workspace = true

sled-agent/src/artifact_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub(crate) fn filter_dataset_mountpoints(
453453
config
454454
.datasets
455455
.into_values()
456-
.filter(|dataset| *dataset.name.kind() == DatasetKind::Update)
456+
.filter(|dataset| *dataset.name.dataset() == DatasetKind::Update)
457457
.map(|dataset| dataset.name.mountpoint(root))
458458
}
459459

sled-agent/src/rack_setup/plan/sled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Plan {
2626
}
2727

2828
impl Plan {
29-
pub fn create(
29+
pub async fn create(
3030
log: &Logger,
3131
config: &Config,
3232
bootstrap_addrs: BTreeSet<Ipv6Addr>,

0 commit comments

Comments
 (0)