Skip to content
Open
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
15 changes: 7 additions & 8 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2223,14 +2223,13 @@ fn cmd_blueprint_edit(
.map(|c| c.clone())
.unwrap_or_else(|| CollectionBuilder::new("sim").build());

let mut builder = BlueprintBuilder::new_based_on(
&sim.log,
blueprint,
&planning_input,
creator,
rng,
)
.context("creating blueprint builder")?;
let mut builder =
BlueprintBuilder::new_based_on(&sim.log, blueprint, creator, rng)
.context("creating blueprint builder")?;

// We're acting as the planner here, so we need to update the builder for
// any static changes in the input (e.g., new sleds, new DNS versions, ...).
Planner::update_builder_from_planning_input(&mut builder, &planning_input);

if let Some(comment) = args.comment {
builder.comment(comment);
Expand Down
4 changes: 1 addition & 3 deletions live-tests/tests/common/reconfigurator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use nexus_lockstep_client::types::{
};
use nexus_reconfigurator_planning::blueprint_builder::BlueprintBuilder;
use nexus_reconfigurator_planning::planner::PlannerRng;
use nexus_types::deployment::{Blueprint, BlueprintSource, PlanningInput};
use nexus_types::deployment::{Blueprint, BlueprintSource};
use nexus_types::external_api::views::SledState;
use nexus_types::inventory::Collection;
use omicron_test_utils::dev::poll::{CondCheckError, wait_for_condition};
Expand Down Expand Up @@ -80,7 +80,6 @@ pub async fn blueprint_load_target_enabled(
/// their test environment.
pub async fn blueprint_edit_current_target(
log: &slog::Logger,
planning_input: &PlanningInput,
nexus: &nexus_lockstep_client::Client,
edit_fn: &dyn Fn(&mut BlueprintBuilder) -> Result<(), anyhow::Error>,
) -> Result<(Blueprint, Blueprint), anyhow::Error> {
Expand All @@ -92,7 +91,6 @@ pub async fn blueprint_edit_current_target(
let mut builder = BlueprintBuilder::new_based_on(
log,
&blueprint1,
&planning_input,
"test-suite",
PlannerRng::from_entropy(),
)
Expand Down
2 changes: 0 additions & 2 deletions live-tests/tests/test_nexus_add_remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
let sled_id = *commissioned_sled_ids.first().expect("any sled id");
let (blueprint1, blueprint2) = blueprint_edit_current_target(
log,
&planning_input,
&nexus,
&|builder: &mut BlueprintBuilder| {
// We have to tell the builder what image source to use for the new
Expand Down Expand Up @@ -188,7 +187,6 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
// Now expunge the zone we just created.
let (_blueprint2, blueprint3) = blueprint_edit_current_target(
log,
&planning_input,
&nexus,
&|builder: &mut BlueprintBuilder| {
builder
Expand Down
11 changes: 0 additions & 11 deletions live-tests/tests/test_nexus_handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
let (_blueprint_initial, blueprint_new_nexus) =
blueprint_edit_current_target(
log,
&planning_input,
&nexus,
&|builder: &mut BlueprintBuilder| {
let mut external_networking_alloc =
Expand Down Expand Up @@ -264,14 +263,9 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
info!(log, "created demo saga"; "demo_saga" => ?demo_saga);

// Now update the target blueprint to trigger a handoff.
let planning_input =
PlanningInputFromDb::assemble(opctx, datastore, planner_config)
.await
.expect("planning input");
let (_blueprint_new_nexus, blueprint_handoff) =
blueprint_edit_current_target(
log,
&planning_input,
&nexus,
&|builder: &mut BlueprintBuilder| {
builder.set_nexus_generation(next_generation);
Expand Down Expand Up @@ -427,16 +421,11 @@ async fn test_nexus_handoff(lc: &LiveTestContext) {
info!(log, "all new Nexus instances report running!");

// Clean up: expunge the old Nexus instances.
let planning_input =
PlanningInputFromDb::assemble(opctx, datastore, planner_config)
.await
.expect("planning input");
let new_nexus =
new_nexus_clients.values().next().expect("one new Nexus client");
let (_blueprint_handoff, blueprint_cleanup) =
blueprint_edit_current_target(
log,
&planning_input,
new_nexus,
&|builder: &mut BlueprintBuilder| {
for (id, current_zone) in &current_nexus_zones {
Expand Down
15 changes: 0 additions & 15 deletions nexus/db-queries/src/db/datastore/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3159,7 +3159,6 @@ mod tests {
use nexus_types::deployment::ExpectedActiveRotSlot;
use nexus_types::deployment::PendingMgsUpdate;
use nexus_types::deployment::PlanningInput;
use nexus_types::deployment::PlanningInputBuilder;
use nexus_types::deployment::SledDetails;
use nexus_types::deployment::SledDisk;
use nexus_types::deployment::SledFilter;
Expand Down Expand Up @@ -3191,16 +3190,12 @@ mod tests {
use std::mem;
use std::net::Ipv6Addr;
use std::sync::Arc;
use std::sync::LazyLock;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::time::Duration;
use tufaceous_artifact::ArtifactHash;
use tufaceous_artifact::ArtifactVersion;

static EMPTY_PLANNING_INPUT: LazyLock<PlanningInput> =
LazyLock::new(|| PlanningInputBuilder::empty_input());

#[derive(Default)]
pub struct NetworkResourceControlFlow {
pub target_check_done: Option<Arc<AtomicBool>>,
Expand Down Expand Up @@ -3448,7 +3443,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint1,
&planning_input,
"test",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -3795,7 +3789,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint2,
&planning_input,
"dummy",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -3851,7 +3844,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint3,
&planning_input,
"dummy",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -3904,7 +3896,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint4,
&planning_input,
"dummy",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -3961,7 +3952,6 @@ mod tests {
let blueprint6 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint5,
&planning_input,
"dummy",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -4032,7 +4022,6 @@ mod tests {
let blueprint2 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint1,
&EMPTY_PLANNING_INPUT,
"test2",
PlannerRng::from_entropy(),
)
Expand All @@ -4041,7 +4030,6 @@ mod tests {
let blueprint3 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint1,
&EMPTY_PLANNING_INPUT,
"test3",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -4141,7 +4129,6 @@ mod tests {
let blueprint4 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint3,
&EMPTY_PLANNING_INPUT,
"test3",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -4180,7 +4167,6 @@ mod tests {
let blueprint2 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint1,
&EMPTY_PLANNING_INPUT,
"test2",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -4365,7 +4351,6 @@ mod tests {
let blueprint2 = BlueprintBuilder::new_based_on(
&logctx.log,
&blueprint1,
&example_system.input,
&format!("{test_name}-2"),
PlannerRng::from_entropy(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&opctx.log,
&bp1,
&input,
TEST_NAME,
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -1466,7 +1465,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&opctx.log,
&bp2,
&input,
TEST_NAME,
PlannerRng::from_entropy(),
)
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,6 @@ mod test {
let mut builder = BlueprintBuilder::new_based_on(
log,
&EMPTY_BLUEPRINT,
&planning_input,
test_name,
PlannerRng::from_entropy(),
)
Expand All @@ -1217,6 +1216,7 @@ mod test {
for (sled_id, sled_resources) in
planning_input.all_sled_resources(SledFilter::InService)
{
builder.ensure_sled_exists(sled_id, sled_resources.subnet);
builder
.sled_add_disks(sled_id, &sled_resources)
.expect("added disks");
Expand Down
2 changes: 0 additions & 2 deletions nexus/db-queries/src/db/datastore/vpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3324,7 +3324,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&bp0,
&planning_input,
"test",
PlannerRng::from_entropy(),
)
Expand Down Expand Up @@ -3417,7 +3416,6 @@ mod tests {
let mut builder = BlueprintBuilder::new_based_on(
&logctx.log,
&bp2,
&planning_input,
"test",
PlannerRng::from_entropy(),
)
Expand Down
75 changes: 11 additions & 64 deletions nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ mod test {
use internal_dns_types::names::BOUNDARY_NTP_DNS_NAME;
use internal_dns_types::names::DNS_ZONE;
use internal_dns_types::names::ServiceName;
use nexus_db_model::DbMetadataNexusState;
use nexus_db_model::DnsGroup;
use nexus_db_model::Silo;
use nexus_db_queries::authn;
Expand All @@ -334,7 +333,6 @@ mod test {
use nexus_reconfigurator_planning::blueprint_editor::ExternalNetworkingAllocator;
use nexus_reconfigurator_planning::example::ExampleSystemBuilder;
use nexus_reconfigurator_planning::planner::PlannerRng;
use nexus_reconfigurator_preparation::PlanningInputFromDb;
use nexus_sled_agent_shared::inventory::OmicronZoneConfig;
use nexus_sled_agent_shared::inventory::OmicronZoneImageSource;
use nexus_sled_agent_shared::inventory::OmicronZoneType;
Expand All @@ -352,18 +350,13 @@ mod test {
use nexus_types::deployment::BlueprintZoneDisposition;
use nexus_types::deployment::BlueprintZoneImageSource;
use nexus_types::deployment::BlueprintZoneType;
use nexus_types::deployment::CockroachDbClusterVersion;
use nexus_types::deployment::CockroachDbPreserveDowngrade;
use nexus_types::deployment::CockroachDbSettings;
use nexus_types::deployment::ExternalIpPolicy;
pub use nexus_types::deployment::OmicronZoneExternalFloatingAddr;
pub use nexus_types::deployment::OmicronZoneExternalFloatingIp;
pub use nexus_types::deployment::OmicronZoneExternalSnatIp;
use nexus_types::deployment::OximeterReadMode;
use nexus_types::deployment::OximeterReadPolicy;
use nexus_types::deployment::PendingMgsUpdates;
use nexus_types::deployment::PlannerConfig;
use nexus_types::deployment::SledFilter;
use nexus_types::deployment::TufRepoPolicy;
use nexus_types::deployment::blueprint_zone_type;
use nexus_types::external_api::params;
use nexus_types::external_api::shared;
Expand All @@ -376,6 +369,7 @@ mod test {
use nexus_types::internal_api::params::DnsRecord;
use nexus_types::internal_api::params::Srv;
use nexus_types::silo::silo_dns_name;
use omicron_common::address::IpRange;
use omicron_common::address::Ipv6Subnet;
use omicron_common::address::RACK_PREFIX;
use omicron_common::address::REPO_DEPOT_PORT;
Expand All @@ -384,12 +378,6 @@ mod test {
use omicron_common::address::get_switch_zone_address;
use omicron_common::api::external::Generation;
use omicron_common::api::external::IdentityMetadataCreateParams;
use omicron_common::policy::BOUNDARY_NTP_REDUNDANCY;
use omicron_common::policy::COCKROACHDB_REDUNDANCY;
use omicron_common::policy::CRUCIBLE_PANTRY_REDUNDANCY;
use omicron_common::policy::INTERNAL_DNS_REDUNDANCY;
use omicron_common::policy::NEXUS_REDUNDANCY;
use omicron_common::policy::OXIMETER_REDUNDANCY;
use omicron_common::zpool_name::ZpoolName;
use omicron_test_utils::dev::test_setup_log;
use omicron_uuid_kinds::BlueprintUuid;
Expand Down Expand Up @@ -1514,60 +1502,19 @@ mod test {
// Now, go through the motions of provisioning a new Nexus zone.
// We do this directly with BlueprintBuilder to avoid the planner
// deciding to make other unrelated changes.
let sled_rows = datastore
.sled_list_all_batched(&opctx, SledFilter::Commissioned)
.await
.unwrap();
let zpool_rows =
datastore.zpool_list_all_external_batched(&opctx).await.unwrap();
let ip_pool_range_rows =
fetch_all_service_ip_pool_ranges(&datastore, &opctx).await;
let active_nexus_zones = datastore
.get_db_metadata_nexus_in_state(
&opctx,
vec![DbMetadataNexusState::Active],
)
.await
.internal_context("fetching active nexuses")
.unwrap()
.into_iter()
.map(|z| z.nexus_id())
.collect();
let planning_input = PlanningInputFromDb {
sled_rows: &sled_rows,
zpool_rows: &zpool_rows,
ip_pool_range_rows: &ip_pool_range_rows,
external_dns_external_ips: BTreeSet::new(),
internal_dns_version: dns_initial_internal.generation.into(),
external_dns_version: dns_latest_external.generation.into(),
// These are not used because we're not actually going through
// the planner.
cockroachdb_settings: &CockroachDbSettings::empty(),
external_ip_rows: &[],
service_nic_rows: &[],
target_boundary_ntp_zone_count: BOUNDARY_NTP_REDUNDANCY,
target_nexus_zone_count: NEXUS_REDUNDANCY,
target_internal_dns_zone_count: INTERNAL_DNS_REDUNDANCY,
target_oximeter_zone_count: OXIMETER_REDUNDANCY,
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
target_cockroachdb_cluster_version:
CockroachDbClusterVersion::POLICY,
target_crucible_pantry_zone_count: CRUCIBLE_PANTRY_REDUNDANCY,
clickhouse_policy: None,
oximeter_read_policy: OximeterReadPolicy::new(1),
tuf_repo: TufRepoPolicy::initial(),
old_repo: TufRepoPolicy::initial(),
planner_config: PlannerConfig::default(),
active_nexus_zones,
not_yet_nexus_zones: BTreeSet::new(),
log,
}
.build()
.unwrap();
let external_ip_policy = {
let mut builder = ExternalIpPolicy::builder();
for range in ip_pool_range_rows {
let range = IpRange::try_from(&range).unwrap();
builder.push_service_pool_range(range).unwrap();
}
builder.build()
};
let mut builder = BlueprintBuilder::new_based_on(
&log,
&blueprint,
&planning_input,
"test suite",
PlannerRng::from_entropy(),
)
Expand All @@ -1590,7 +1537,7 @@ mod test {
let new_nexus_external_ip =
ExternalNetworkingAllocator::from_current_zones(
&builder,
planning_input.external_ip_policy(),
&external_ip_policy,
)
.expect("constructed ExternalNetworkingAllocator")
.for_new_nexus()
Expand Down
Loading
Loading