diff --git a/nexus/src/app/rack.rs b/nexus/src/app/rack.rs index a9ad97e9c8..325e65c5df 100644 --- a/nexus/src/app/rack.rs +++ b/nexus/src/app/rack.rs @@ -63,6 +63,7 @@ use omicron_common::api::external::NameOrId; use omicron_common::api::external::ResourceType; use omicron_common::api::internal::shared::ExternalPortDiscovery; use omicron_common::api::internal::shared::LldpAdminStatus; +use omicron_uuid_kinds::GenericUuid; use omicron_uuid_kinds::SledUuid; use oxnet::IpNet; use sled_agent_client::types::AddSledRequest; @@ -140,15 +141,18 @@ impl super::Nexus { .collect(); let datasets: Vec<_> = request - .datasets - .into_iter() - .map(|dataset| { - db::model::Dataset::new( - dataset.dataset_id, - dataset.zpool_id, - dataset.request.address, - dataset.request.kind, - ) + .blueprint + .blueprint_datasets + .values() + .flat_map(|config| { + config.datasets.values().map(|dataset| { + db::model::Dataset::new( + dataset.id, + dataset.pool.id().into_untyped_uuid(), + dataset.address, + dataset.kind.clone(), + ) + }) }) .collect(); diff --git a/nexus/src/lib.rs b/nexus/src/lib.rs index 1a25b2e9aa..30a021db0f 100644 --- a/nexus/src/lib.rs +++ b/nexus/src/lib.rs @@ -252,7 +252,6 @@ impl nexus_test_interface::NexusServer for Server { nexus_types::internal_api::params::PhysicalDiskPutRequest, >, zpools: Vec, - datasets: Vec, internal_dns_zone_config: nexus_types::internal_api::params::DnsConfigParams, external_dns_zone_name: &str, recovery_silo: nexus_sled_agent_shared::recovery_silo::RecoverySiloConfig, @@ -303,7 +302,6 @@ impl nexus_test_interface::NexusServer for Server { blueprint, physical_disks, zpools, - datasets, internal_services_ip_pool_ranges, certs, internal_dns_zone_config, diff --git a/nexus/test-interface/src/lib.rs b/nexus/test-interface/src/lib.rs index 68f462551c..d1f08ece41 100644 --- a/nexus/test-interface/src/lib.rs +++ b/nexus/test-interface/src/lib.rs @@ -70,7 +70,6 @@ pub trait NexusServer: Send + Sync + 'static { blueprint: Blueprint, physical_disks: Vec, zpools: Vec, - datasets: Vec, internal_dns_config: nexus_types::internal_api::params::DnsConfigParams, external_dns_zone_name: &str, recovery_silo: nexus_sled_agent_shared::recovery_silo::RecoverySiloConfig, diff --git a/nexus/test-utils/src/lib.rs b/nexus/test-utils/src/lib.rs index e78fb45ce6..a7b7ebb2f9 100644 --- a/nexus/test-utils/src/lib.rs +++ b/nexus/test-utils/src/lib.rs @@ -52,8 +52,6 @@ use nexus_types::deployment::CockroachDbPreserveDowngrade; use nexus_types::deployment::OmicronZoneExternalFloatingAddr; use nexus_types::deployment::OmicronZoneExternalFloatingIp; use nexus_types::external_api::views::SledState; -use nexus_types::internal_api::params::DatasetCreateRequest; -use nexus_types::internal_api::params::DatasetPutRequest; use nexus_types::internal_api::params::DnsConfigParams; use omicron_common::address::DNS_OPTE_IPV4_SUBNET; use omicron_common::address::NEXUS_OPTE_IPV4_SUBNET; @@ -216,7 +214,6 @@ pub async fn test_setup( } struct RackInitRequestBuilder { - datasets: Vec, internal_dns_config: DnsConfigBuilder, mac_addrs: Box + Send>, } @@ -224,7 +221,6 @@ struct RackInitRequestBuilder { impl RackInitRequestBuilder { fn new() -> Self { Self { - datasets: vec![], internal_dns_config: DnsConfigBuilder::new(), mac_addrs: Box::new(MacAddr::iter_system()), } @@ -245,49 +241,13 @@ impl RackInitRequestBuilder { .expect("Failed to set up DNS for {kind}"); } - // Keeps track of: - // - The "DatasetPutRequest" (for handoff to Nexus) - // - The internal DNS configuration for this service - fn add_dataset( - &mut self, - zone_id: OmicronZoneUuid, - zpool_id: ZpoolUuid, - dataset_id: DatasetUuid, - address: SocketAddrV6, - kind: DatasetKind, - service_name: ServiceName, - ) { - self.datasets.push(DatasetCreateRequest { - zpool_id: zpool_id.into_untyped_uuid(), - dataset_id, - request: DatasetPutRequest { address: Some(address), kind }, - }); - let zone = self - .internal_dns_config - .host_zone(zone_id, *address.ip()) - .expect("Failed to set up DNS for {kind}"); - self.internal_dns_config - .service_backend_zone(service_name, &zone, address.port()) - .expect("Failed to set up DNS for {kind}"); - } - // Special handling of ClickHouse, which has multiple SRV records for its // single zone. - fn add_clickhouse_dataset( + fn add_clickhouse_to_dns( &mut self, zone_id: OmicronZoneUuid, - zpool_id: ZpoolUuid, - dataset_id: DatasetUuid, address: SocketAddrV6, ) { - self.datasets.push(DatasetCreateRequest { - zpool_id: zpool_id.into_untyped_uuid(), - dataset_id, - request: DatasetPutRequest { - address: Some(address), - kind: DatasetKind::Clickhouse, - }, - }); self.internal_dns_config .host_zone_clickhouse(zone_id, ServiceName::Clickhouse, address) .expect("Failed to setup ClickHouse DNS"); @@ -449,14 +409,10 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { let zone_id = OmicronZoneUuid::new_v4(); let zpool_id = ZpoolUuid::new_v4(); - let dataset_id = DatasetUuid::new_v4(); eprintln!("DB address: {}", address); - self.rack_init_builder.add_dataset( + self.rack_init_builder.add_service_to_dns( zone_id, - zpool_id, - dataset_id, address, - DatasetKind::Cockroach, ServiceName::Cockroach, ); let pool_name = illumos_utils::zpool::ZpoolName::new_external(zpool_id) @@ -490,16 +446,10 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { let zone_id = OmicronZoneUuid::new_v4(); let zpool_id = ZpoolUuid::new_v4(); - let dataset_id = DatasetUuid::new_v4(); let http_address = clickhouse.http_address(); let http_port = http_address.port(); let native_address = clickhouse.native_address(); - self.rack_init_builder.add_clickhouse_dataset( - zone_id, - zpool_id, - dataset_id, - http_address, - ); + self.rack_init_builder.add_clickhouse_to_dns(zone_id, http_address); self.clickhouse = Some(clickhouse); // NOTE: We could pass this port information via DNS, rather than @@ -934,24 +884,6 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { .expect("Must launch internal nexus first"), self.config, blueprint, - // NOTE: We should probably hand off - // "self.rack_init_builder.datasets" here, but Nexus won't be happy - // if we pass it right now: - // - // - When we "call .add_dataset(...)", we need to keep track of - // which zpool the dataset is coming from. For these synthetic - // environments, we make this value up. - // - When we tell Nexus about datasets, we need to provide the - // parent zpool UUID, which must be known to Nexus's database. - // - The sled agent we're creating to run alongside this test DOES - // create synthetic zpools on boot, but - // (a) They're not the same zpools we're making up when we start - // Clickhouse / CRDB (we're basically making distinct calls to - // Uuid::new_v4()). - // (b) These sled-agent-created zpools are registered with Nexus - // asynchronously, and we're not making any effort (currently) to - // wait for them to be known to Nexus. - vec![], vec![], vec![], dns_config, diff --git a/nexus/types/src/internal_api/params.rs b/nexus/types/src/internal_api/params.rs index bbc7565370..2ae0d5aa0b 100644 --- a/nexus/types/src/internal_api/params.rs +++ b/nexus/types/src/internal_api/params.rs @@ -20,7 +20,6 @@ use omicron_common::api::internal::shared::DatasetKind; use omicron_common::api::internal::shared::ExternalPortDiscovery; use omicron_common::api::internal::shared::RackNetworkConfig; use omicron_common::api::internal::shared::SourceNatConfig; -use omicron_uuid_kinds::DatasetUuid; use omicron_uuid_kinds::PhysicalDiskUuid; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -156,13 +155,6 @@ impl fmt::Display for ServiceKind { } } -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -pub struct DatasetCreateRequest { - pub zpool_id: Uuid, - pub dataset_id: DatasetUuid, - pub request: DatasetPutRequest, -} - #[derive(Debug, Clone, Deserialize, JsonSchema)] pub struct RackInitializationRequest { /// Blueprint describing services initialized by RSS. @@ -174,8 +166,6 @@ pub struct RackInitializationRequest { /// Zpools created within the physical disks created by the control plane. pub zpools: Vec, - /// Datasets on the rack which have been provisioned by RSS. - pub datasets: Vec, /// Ranges of the service IP pool which may be used for internal services, /// such as Nexus. pub internal_services_ip_pool_ranges: Vec, diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index 5c39652aa3..b846fc23bf 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -3160,52 +3160,10 @@ "start_time" ] }, - "DatasetCreateRequest": { - "type": "object", - "properties": { - "dataset_id": { - "$ref": "#/components/schemas/TypedUuidForDatasetKind" - }, - "request": { - "$ref": "#/components/schemas/DatasetPutRequest" - }, - "zpool_id": { - "type": "string", - "format": "uuid" - } - }, - "required": [ - "dataset_id", - "request", - "zpool_id" - ] - }, "DatasetKind": { "description": "The kind of dataset. See the `DatasetKind` enum in omicron-common for possible values.", "type": "string" }, - "DatasetPutRequest": { - "description": "Describes a dataset within a pool.", - "type": "object", - "properties": { - "address": { - "nullable": true, - "description": "Address on which a service is responding to requests for the dataset.", - "type": "string" - }, - "kind": { - "description": "Type of dataset being inserted.", - "allOf": [ - { - "$ref": "#/components/schemas/DatasetKind" - } - ] - } - }, - "required": [ - "kind" - ] - }, "DemoSaga": { "description": "Identifies an instance of the demo saga", "type": "object", @@ -4956,13 +4914,6 @@ "$ref": "#/components/schemas/Certificate" } }, - "datasets": { - "description": "Datasets on the rack which have been provisioned by RSS.", - "type": "array", - "items": { - "$ref": "#/components/schemas/DatasetCreateRequest" - } - }, "external_dns_zone_name": { "description": "delegated DNS name for external DNS", "type": "string" @@ -5025,7 +4976,6 @@ "allowed_source_ips", "blueprint", "certs", - "datasets", "external_dns_zone_name", "external_port_count", "internal_dns_zone_config", diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index 37a49b930a..eb42b88af5 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -110,7 +110,6 @@ use omicron_common::ledger::{self, Ledger, Ledgerable}; use omicron_ddm_admin_client::{Client as DdmAdminClient, DdmError}; use omicron_uuid_kinds::GenericUuid; use omicron_uuid_kinds::SledUuid; -use omicron_uuid_kinds::ZpoolUuid; use serde::{Deserialize, Serialize}; use sled_agent_client::{ types as SledAgentTypes, Client as SledAgentClient, Error as SledAgentError, @@ -815,63 +814,6 @@ impl ServiceInner { self.log.new(o!("component" => "NexusClient")), ); - // Convert all the information we have about datasets into a format - // which can be stored in CockroachDB once they make their way to Nexus. - // - // TODO(https://github.com/oxidecomputer/omicron/issues/6998): Remove me! - // This is somewhat redundant with the information we're supplying in - // the initial blueprint, and could be de-duplicated if we can fully - // migrate to a world where "datasets exist in the blueprint, but not - // in CockroachDB". - let mut datasets = HashMap::< - (ZpoolUuid, DatasetKind), - NexusTypes::DatasetCreateRequest, - >::new(); - for sled_config in service_plan.services.values() { - // Add all datasets, as they appear in our plan. - // - // Note that we assume all datasets have a "None" address - // field -- the coupling of datasets with addresses is linked - // to usage by specific zones. - for dataset in sled_config.datasets.datasets.values() { - let duplicate = datasets.insert( - (dataset.name.pool().id(), dataset.name.kind().clone()), - NexusTypes::DatasetCreateRequest { - zpool_id: dataset.name.pool().id().into_untyped_uuid(), - dataset_id: dataset.id, - request: NexusTypes::DatasetPutRequest { - address: None, - kind: dataset.name.kind().clone(), - }, - }, - ); - - if let Some(dataset) = duplicate { - panic!("Inserting multiple datasets of the same kind on a single zpool: {dataset:?}"); - } - } - - // If any datasets came from a zone, patch their addresses. - // - // It would be better if "datasets" was keyed off of a DatasetUuid, - // but the SeldConfig storing zones does not know about - // DatasetUuids. - // - // Instead, we use the (Zpool, DatasetKind) tuple as a unique - // identifier for the dataset. - for zone in &sled_config.zones { - if let Some(dataset) = zone.zone_type.durable_dataset() { - let Some(entry) = datasets.get_mut(&( - dataset.dataset.pool_name.id(), - dataset.kind.clone(), - )) else { - panic!("zone's durable dataset not found"); - }; - entry.request.address = Some(dataset.address.to_string()); - } - } - } - let datasets: Vec<_> = datasets.into_values().collect(); let internal_services_ip_pool_ranges = config .internal_services_ip_pool_ranges .clone() @@ -1058,7 +1000,6 @@ impl ServiceInner { blueprint, physical_disks, zpools, - datasets, internal_services_ip_pool_ranges, certs: config.external_certificates.clone(), internal_dns_zone_config: service_plan.dns_config.clone(), diff --git a/sled-agent/src/sim/server.rs b/sled-agent/src/sim/server.rs index 0d3a682b57..588f12ceee 100644 --- a/sled-agent/src/sim/server.rs +++ b/sled-agent/src/sim/server.rs @@ -39,7 +39,6 @@ use omicron_common::api::external::Generation; use omicron_common::api::external::MacAddr; use omicron_common::api::external::Vni; use omicron_common::api::internal::nexus::Certificate; -use omicron_common::api::internal::shared::DatasetKind; use omicron_common::backoff::{ retry_notify, retry_policy_internal_service_aggressive, BackoffError, }; @@ -178,7 +177,6 @@ impl Server { task.await.unwrap(); } - let mut datasets = vec![]; // Create all the Zpools requested by the config, and allocate a single // Crucible dataset for each. This emulates the setup we expect to have // on the physical rack. @@ -203,17 +201,6 @@ impl Server { .create_zpool(zpool_id, physical_disk_id, zpool.size) .await; let dataset_id = DatasetUuid::new_v4(); - let address = - sled_agent.create_crucible_dataset(zpool_id, dataset_id).await; - - datasets.push(NexusTypes::DatasetCreateRequest { - zpool_id: zpool_id.into_untyped_uuid(), - dataset_id, - request: NexusTypes::DatasetPutRequest { - address: Some(address.to_string()), - kind: DatasetKind::Crucible, - }, - }); // Whenever Nexus tries to allocate a region, it should complete // immediately. What efficiency! @@ -515,24 +502,8 @@ pub async fn run_standalone_server( .unwrap(), }; - let mut datasets = vec![]; let physical_disks = server.sled_agent.get_all_physical_disks().await; let zpools = server.sled_agent.get_zpools().await; - for zpool in &zpools { - let zpool_id = ZpoolUuid::from_untyped_uuid(zpool.id); - for (dataset_id, address) in - server.sled_agent.get_crucible_datasets(zpool_id).await - { - datasets.push(NexusTypes::DatasetCreateRequest { - zpool_id: zpool.id, - dataset_id, - request: NexusTypes::DatasetPutRequest { - address: Some(address.to_string()), - kind: DatasetKind::Crucible, - }, - }); - } - } let certs = match &rss_args.tls_certificate { Some(c) => vec![c.clone()], @@ -573,7 +544,6 @@ pub async fn run_standalone_server( blueprint, physical_disks, zpools, - datasets, internal_services_ip_pool_ranges, certs, internal_dns_zone_config: dns_config,