Skip to content
Merged
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ progenitor::generate_api!(
SwitchLocation = omicron_common::api::external::SwitchLocation,
TypedUuidForDatasetKind = omicron_uuid_kinds::DatasetUuid,
TypedUuidForInstanceKind = omicron_uuid_kinds::InstanceUuid,
TypedUuidForOmicronZoneKind = omicron_uuid_kinds::OmicronZoneUuid,
TypedUuidForPropolisKind = omicron_uuid_kinds::PropolisUuid,
TypedUuidForZpoolKind = omicron_uuid_kinds::ZpoolUuid,
Vni = omicron_common::api::external::Vni,
Expand Down
1 change: 1 addition & 0 deletions nexus-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ anyhow.workspace = true
camino.workspace = true
dropshot.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
schemars.workspace = true
serde.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion nexus-config/src/nexus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use omicron_common::address::Ipv6Subnet;
use omicron_common::address::NEXUS_TECHPORT_EXTERNAL_PORT;
use omicron_common::address::RACK_PREFIX;
use omicron_common::api::internal::shared::SwitchLocation;
use omicron_uuid_kinds::OmicronZoneUuid;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
Expand Down Expand Up @@ -150,7 +151,7 @@ pub enum InternalDns {
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
pub struct DeploymentConfig {
/// Uuid of the Nexus instance
pub id: Uuid,
pub id: OmicronZoneUuid,
/// Uuid of the Rack where Nexus is executing.
pub rack_id: Uuid,
/// Port on which the "techport external" dropshot server should listen.
Expand Down
4 changes: 2 additions & 2 deletions nexus-sled-agent-shared/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use omicron_common::{
disk::DiskVariant,
zpool_name::ZpoolName,
};
use omicron_uuid_kinds::DatasetUuid;
use omicron_uuid_kinds::ZpoolUuid;
use omicron_uuid_kinds::{DatasetUuid, OmicronZoneUuid};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
// Export this type for convenience -- this way, dependents don't have to
Expand Down Expand Up @@ -142,7 +142,7 @@ impl OmicronZonesConfig {
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
)]
pub struct OmicronZoneConfig {
pub id: Uuid,
pub id: OmicronZoneUuid,
pub underlay_address: Ipv6Addr,

/// The pool on which we'll place this zone's root filesystem.
Expand Down
20 changes: 10 additions & 10 deletions nexus/db-model/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ use nexus_types::deployment::{
use omicron_common::api::internal::shared::NetworkInterface;
use omicron_common::disk::DiskIdentity;
use omicron_common::zpool_name::ZpoolName;
use omicron_uuid_kinds::ZpoolUuid;
use omicron_uuid_kinds::{ExternalIpKind, SledKind, ZpoolKind};
use omicron_uuid_kinds::{ExternalIpUuid, GenericUuid, OmicronZoneUuid};
use omicron_uuid_kinds::{OmicronZoneKind, SledUuid};
use omicron_uuid_kinds::{
ExternalIpKind, ExternalIpUuid, GenericUuid, OmicronZoneKind,
OmicronZoneUuid, SledKind, SledUuid, ZpoolKind, ZpoolUuid,
};
use std::net::{IpAddr, SocketAddrV6};
use uuid::Uuid;

Expand Down Expand Up @@ -238,7 +238,7 @@ impl BpSledOmicronZones {
pub struct BpOmicronZone {
pub blueprint_id: Uuid,
pub sled_id: DbTypedUuid<SledKind>,
pub id: Uuid,
pub id: DbTypedUuid<OmicronZoneKind>,
pub underlay_address: ipv6::Ipv6Addr,
pub zone_type: ZoneType,
pub primary_service_ip: ipv6::Ipv6Addr,
Expand Down Expand Up @@ -281,7 +281,7 @@ impl BpOmicronZone {
// `blueprint_zone.zone_type`
blueprint_id,
sled_id: sled_id.into(),
id: blueprint_zone.id.into_untyped_uuid(),
id: blueprint_zone.id.into(),
underlay_address: blueprint_zone.underlay_address.into(),
external_ip_id,
filesystem_pool: blueprint_zone
Expand Down Expand Up @@ -526,7 +526,7 @@ impl BpOmicronZone {
// Result) we immediately return. We check the inner result later, but
// only if some code path tries to use `nic` and it's not present.
let nic = omicron_zone_config::nic_row_to_network_interface(
self.id,
self.id.into(),
self.bp_nic_id,
nic_row.map(Into::into),
)?;
Expand Down Expand Up @@ -691,7 +691,7 @@ impl BpOmicronZone {

Ok(BlueprintZoneConfig {
disposition: self.disposition.into(),
id: OmicronZoneUuid::from_untyped_uuid(self.id),
id: self.id.into(),
underlay_address: self.underlay_address.into(),
filesystem_pool: self
.filesystem_pool
Expand Down Expand Up @@ -768,7 +768,7 @@ impl BpOmicronZoneNic {
let Some((_, nic)) = zone.zone_type.external_networking() else {
return Ok(None);
};
let nic = OmicronZoneNic::new(zone.id.into_untyped_uuid(), nic)?;
let nic = OmicronZoneNic::new(zone.id, nic)?;
Ok(Some(Self {
blueprint_id,
id: nic.id,
Expand All @@ -784,7 +784,7 @@ impl BpOmicronZoneNic {

pub fn into_network_interface_for_zone(
self,
zone_id: Uuid,
zone_id: OmicronZoneUuid,
) -> Result<NetworkInterface, anyhow::Error> {
let zone_nic = OmicronZoneNic::from(self);
zone_nic.into_network_interface_for_zone(zone_id)
Expand Down
14 changes: 7 additions & 7 deletions nexus/db-model/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ use nexus_types::inventory::{
};
use omicron_common::api::internal::shared::NetworkInterface;
use omicron_common::zpool_name::ZpoolName;
use omicron_uuid_kinds::CollectionKind;
use omicron_uuid_kinds::CollectionUuid;
use omicron_uuid_kinds::DatasetKind;
use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::SledKind;
use omicron_uuid_kinds::SledUuid;
use omicron_uuid_kinds::ZpoolKind;
use omicron_uuid_kinds::ZpoolUuid;
use omicron_uuid_kinds::{CollectionKind, OmicronZoneKind};
use omicron_uuid_kinds::{CollectionUuid, OmicronZoneUuid};
use std::net::{IpAddr, SocketAddrV6};
use uuid::Uuid;

Expand Down Expand Up @@ -1116,7 +1116,7 @@ impl From<nexus_sled_agent_shared::inventory::ZoneKind> for ZoneType {
pub struct InvOmicronZone {
pub inv_collection_id: DbTypedUuid<CollectionKind>,
pub sled_id: DbTypedUuid<SledKind>,
pub id: Uuid,
pub id: DbTypedUuid<OmicronZoneKind>,
pub underlay_address: ipv6::Ipv6Addr,
pub zone_type: ZoneType,
pub primary_service_ip: ipv6::Ipv6Addr,
Expand Down Expand Up @@ -1151,7 +1151,7 @@ impl InvOmicronZone {
// `zone.zone_type`
inv_collection_id: inv_collection_id.into(),
sled_id: sled_id.into(),
id: zone.id,
id: zone.id.into(),
underlay_address: zone.underlay_address.into(),
filesystem_pool: zone
.filesystem_pool
Expand Down Expand Up @@ -1362,7 +1362,7 @@ impl InvOmicronZone {
// Result) we immediately return. We check the inner result later, but
// only if some code path tries to use `nic` and it's not present.
let nic = omicron_zone_config::nic_row_to_network_interface(
self.id,
self.id.into(),
self.nic_id,
nic_row.map(Into::into),
)?;
Expand Down Expand Up @@ -1482,7 +1482,7 @@ impl InvOmicronZone {
};

Ok(OmicronZoneConfig {
id: self.id,
id: self.id.into(),
underlay_address: self.underlay_address.into(),
filesystem_pool: self
.filesystem_pool
Expand Down Expand Up @@ -1545,7 +1545,7 @@ impl InvOmicronZoneNic {

pub fn into_network_interface_for_zone(
self,
zone_id: Uuid,
zone_id: OmicronZoneUuid,
) -> Result<NetworkInterface, anyhow::Error> {
let zone_nic = OmicronZoneNic::from(self);
zone_nic.into_network_interface_for_zone(zone_id)
Expand Down
13 changes: 8 additions & 5 deletions nexus/db-model/src/omicron_zone_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use ipnetwork::IpNetwork;
use nexus_sled_agent_shared::inventory::OmicronZoneDataset;
use nexus_types::inventory::NetworkInterface;
use omicron_common::api::internal::shared::NetworkInterfaceKind;
use omicron_uuid_kinds::{GenericUuid, OmicronZoneUuid};
use std::net::{IpAddr, SocketAddr, SocketAddrV6};
use uuid::Uuid;

Expand Down Expand Up @@ -55,7 +56,7 @@ pub fn ntp_dns_servers_to_omicron_internal(
/// immediately. The inner result represents an operational error and should
/// only be unwrapped when the nic is used.
pub fn nic_row_to_network_interface(
zone_id: Uuid,
zone_id: OmicronZoneUuid,
nic_id: Option<Uuid>,
nic_row: Option<OmicronZoneNic>,
) -> anyhow::Result<anyhow::Result<NetworkInterface>> {
Expand Down Expand Up @@ -133,7 +134,7 @@ pub(crate) struct OmicronZoneNic {

impl OmicronZoneNic {
pub(crate) fn new(
zone_id: Uuid,
zone_id: OmicronZoneUuid,
nic: &nexus_types::inventory::NetworkInterface,
) -> anyhow::Result<Self> {
// We do not bother storing the NIC's kind and associated id
Expand All @@ -142,7 +143,7 @@ impl OmicronZoneNic {
ensure!(
matches!(
nic.kind,
NetworkInterfaceKind::Service{ id } if id == zone_id
NetworkInterfaceKind::Service { id } if id == zone_id.into_untyped_uuid()
),
"expected zone's NIC kind to be \"service\" and the \
id to match the zone's id ({zone_id})",
Expand All @@ -162,12 +163,14 @@ impl OmicronZoneNic {

pub(crate) fn into_network_interface_for_zone(
self,
zone_id: Uuid,
zone_id: OmicronZoneUuid,
) -> anyhow::Result<NetworkInterface> {
Ok(NetworkInterface {
id: self.id,
ip: self.ip.ip(),
kind: NetworkInterfaceKind::Service { id: zone_id },
kind: NetworkInterfaceKind::Service {
id: zone_id.into_untyped_uuid(),
},
mac: *self.mac,
name: self.name.into(),
primary: self.is_primary,
Expand Down
7 changes: 7 additions & 0 deletions nexus/db-model/src/saga_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use diesel::serialize::{self, ToSql};
use diesel::sql_types;
use omicron_common::api::external::Error;
use omicron_common::api::external::Generation;
use omicron_uuid_kinds::{GenericUuid, OmicronZoneUuid};
use std::convert::TryFrom;
use std::io::Write;
use std::sync::Arc;
Expand Down Expand Up @@ -64,6 +65,12 @@ NewtypeDebug! { () pub struct SecId(Uuid); }
NewtypeDisplay! { () pub struct SecId(Uuid); }
NewtypeFrom! { () pub struct SecId(Uuid); }

impl From<OmicronZoneUuid> for SecId {
fn from(g: OmicronZoneUuid) -> Self {
g.into_untyped_uuid().into()
}
}

impl From<&SecId> for Uuid {
fn from(g: &SecId) -> Self {
g.0
Expand Down
3 changes: 2 additions & 1 deletion nexus/inventory/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ mod test {
use omicron_common::api::external::Generation;
use omicron_common::zpool_name::ZpoolName;
use omicron_sled_agent::sim;
use omicron_uuid_kinds::OmicronZoneUuid;
use omicron_uuid_kinds::ZpoolUuid;
use std::fmt::Write;
use std::net::Ipv6Addr;
Expand Down Expand Up @@ -532,7 +533,7 @@ mod test {
async fn sim_sled_agent(
log: slog::Logger,
sled_id: Uuid,
zone_id: Uuid,
zone_id: OmicronZoneUuid,
) -> sim::Server {
// Start a simulated sled agent.
let config = sim::Config::for_testing(
Expand Down
3 changes: 1 addition & 2 deletions nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ mod test {
use internal_dns::resolver::Resolver;
use internal_dns::ServiceName;
use internal_dns::DNS_ZONE;
use newtype_uuid::GenericUuid;
use nexus_db_model::DnsGroup;
use nexus_db_model::Silo;
use nexus_db_queries::authn;
Expand Down Expand Up @@ -745,7 +744,7 @@ mod test {
};
Ok(BlueprintZoneConfig {
disposition,
id: OmicronZoneUuid::from_untyped_uuid(config.id),
id: config.id,
underlay_address: config.underlay_address,
filesystem_pool: config.filesystem_pool,
zone_type,
Expand Down
12 changes: 6 additions & 6 deletions nexus/reconfigurator/execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use omicron_common::address::Ipv6Subnet;
use omicron_common::address::SLED_PREFIX;
use omicron_physical_disks::DeployDisksDone;
use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::OmicronZoneUuid;
use omicron_uuid_kinds::SledUuid;
use overridables::Overridables;
use slog::info;
Expand All @@ -29,7 +30,6 @@ use std::net::SocketAddrV6;
use std::sync::Arc;
use tokio::sync::mpsc;
use update_engine::merge_anyhow_list;
use uuid::Uuid;

mod cockroachdb;
mod datasets;
Expand Down Expand Up @@ -96,7 +96,7 @@ pub async fn realize_blueprint(
datastore: &DataStore,
resolver: &Resolver,
blueprint: &Blueprint,
nexus_id: Uuid,
nexus_id: OmicronZoneUuid,
sender: mpsc::Sender<Event>,
) -> Result<RealizeBlueprintOutput, anyhow::Error> {
realize_blueprint_with_overrides(
Expand All @@ -116,7 +116,7 @@ pub async fn realize_blueprint_with_overrides(
datastore: &DataStore,
resolver: &Resolver,
blueprint: &Blueprint,
nexus_id: Uuid,
nexus_id: OmicronZoneUuid,
overrides: &Overridables,
sender: mpsc::Sender<Event>,
) -> Result<RealizeBlueprintOutput, anyhow::Error> {
Expand Down Expand Up @@ -406,7 +406,7 @@ fn register_dns_records_step<'a>(
opctx: &'a OpContext,
datastore: &'a DataStore,
blueprint: &'a Blueprint,
nexus_id: Uuid,
nexus_id: OmicronZoneUuid,
overrides: &'a Overridables,
sleds: SharedStepHandle<Arc<BTreeMap<SledUuid, Sled>>>,
) {
Expand Down Expand Up @@ -530,7 +530,7 @@ fn register_reassign_sagas_step<'a>(
opctx: &'a OpContext,
datastore: &'a DataStore,
blueprint: &'a Blueprint,
nexus_id: Uuid,
nexus_id: OmicronZoneUuid,
) -> StepHandle<ReassignSagaOutput> {
// For this and subsequent steps, we'll assume that any errors that we
// encounter do *not* require stopping execution. We'll just accumulate
Expand All @@ -545,7 +545,7 @@ fn register_reassign_sagas_step<'a>(
// For any expunged Nexus zones, re-assign in-progress sagas to
// some other Nexus. If this fails for some reason, it doesn't
// affect anything else.
let sec_id = nexus_db_model::SecId(nexus_id);
let sec_id = nexus_db_model::SecId::from(nexus_id);
let reassigned = sagas::reassign_sagas_from_expunged(
&opctx, datastore, blueprint, sec_id,
)
Expand Down
4 changes: 2 additions & 2 deletions nexus/reconfigurator/execution/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use internal_dns::resolver::Resolver;
use nexus_db_queries::{context::OpContext, db::DataStore};
use nexus_types::deployment::{execution::EventBuffer, Blueprint};
use omicron_uuid_kinds::OmicronZoneUuid;
use update_engine::TerminalKind;
use uuid::Uuid;

use crate::{overridables::Overridables, RealizeBlueprintOutput};

Expand All @@ -34,7 +34,7 @@ pub(crate) async fn realize_blueprint_and_expect(
datastore,
resolver,
blueprint,
Uuid::new_v4(),
OmicronZoneUuid::new_v4(),
overrides,
sender,
)
Expand Down
Loading