Skip to content

Commit

Permalink
[Reconfigurator] Blippy (#7276)
Browse files Browse the repository at this point in the history
This PR introduces Blippy for linting blueprints (see #6987). It
initially only reports `FATAL` errors associated with specific sleds,
but hopefully provides enough structure to see how that can expand to
include other severities and other components. (At a minimum, there will
be some blueprint- or policy-level component for things like "there
aren't enough Nexus zones" that aren't associated with any particular
sled.)

As of this PR, the only user of Blippy is the builder test's
`verify_blueprint`, from which I imported most of the checks that it
current performs. I made a few of these checks slightly more strict, and
from that I had to patch up a handful of tests that were doing weird
things (e.g., manually expunging a zone without expunging its datasets)
and also found one legitimate planner bug (I'll note in a separate
comment below).
  • Loading branch information
jgallagher authored Dec 20, 2024
1 parent 9eca6bc commit b1978e2
Show file tree
Hide file tree
Showing 24 changed files with 2,447 additions and 235 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ members = [
"nexus/macros-common",
"nexus/metrics-producer-gc",
"nexus/networking",
"nexus/reconfigurator/blippy",
"nexus/reconfigurator/execution",
"nexus/reconfigurator/planning",
"nexus/reconfigurator/preparation",
Expand Down Expand Up @@ -213,6 +214,7 @@ default-members = [
"nexus/macros-common",
"nexus/metrics-producer-gc",
"nexus/networking",
"nexus/reconfigurator/blippy",
"nexus/reconfigurator/execution",
"nexus/reconfigurator/planning",
"nexus/reconfigurator/preparation",
Expand Down Expand Up @@ -468,6 +470,7 @@ nexus-internal-api = { path = "nexus/internal-api" }
nexus-macros-common = { path = "nexus/macros-common" }
nexus-metrics-producer-gc = { path = "nexus/metrics-producer-gc" }
nexus-networking = { path = "nexus/networking" }
nexus-reconfigurator-blippy = { path = "nexus/reconfigurator/blippy" }
nexus-reconfigurator-execution = { path = "nexus/reconfigurator/execution" }
nexus-reconfigurator-planning = { path = "nexus/reconfigurator/planning" }
nexus-reconfigurator-preparation = { path = "nexus/reconfigurator/preparation" }
Expand Down
2 changes: 2 additions & 0 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,8 @@ impl JsonSchema for L4PortRange {
DeserializeFromStr,
PartialEq,
Eq,
PartialOrd,
Ord,
SerializeDisplay,
Hash,
)]
Expand Down
24 changes: 22 additions & 2 deletions common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ pub enum NetworkInterfaceKind {

/// Information required to construct a virtual network interface
#[derive(
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
Clone,
Debug,
Deserialize,
Serialize,
JsonSchema,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
)]
pub struct NetworkInterface {
pub id: Uuid,
Expand All @@ -68,7 +77,18 @@ pub struct NetworkInterface {
/// outbound network connections from guests or services.
// Note that `Deserialize` is manually implemented; if you make any changes to
// the fields of this structure, you must make them to that implementation too.
#[derive(Debug, Clone, Copy, Serialize, JsonSchema, PartialEq, Eq, Hash)]
#[derive(
Debug,
Clone,
Copy,
Serialize,
JsonSchema,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
)]
pub struct SourceNatConfig {
/// The external address provided to the instance or service.
pub ip: IpAddr,
Expand Down
11 changes: 10 additions & 1 deletion nexus-sled-agent-shared/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ impl OmicronZoneConfig {

/// Describes a persistent ZFS dataset associated with an Omicron zone
#[derive(
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
Clone,
Debug,
Deserialize,
Serialize,
JsonSchema,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
)]
pub struct OmicronZoneDataset {
pub pool_name: ZpoolName,
Expand Down
19 changes: 19 additions & 0 deletions nexus/reconfigurator/blippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "nexus-reconfigurator-blippy"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
nexus-sled-agent-shared.workspace = true
nexus-types.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true

omicron-workspace-hack.workspace = true

[dev-dependencies]
nexus-reconfigurator-planning.workspace = true
omicron-test-utils.workspace = true
Loading

0 comments on commit b1978e2

Please sign in to comment.