From cc1758257d04efce8805d985c76cb259d50ed510 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Wed, 18 Dec 2024 10:10:27 -0800 Subject: [PATCH] Do not overwrite UUIDs, throw conflict on mismatch --- sled-storage/src/manager.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sled-storage/src/manager.rs b/sled-storage/src/manager.rs index ca001e2178..b4a07f606c 100644 --- a/sled-storage/src/manager.rs +++ b/sled-storage/src/manager.rs @@ -28,6 +28,7 @@ use omicron_common::disk::{ }; use omicron_common::ledger::Ledger; use omicron_uuid_kinds::DatasetUuid; +use omicron_uuid_kinds::GenericUuid; use slog::{error, info, o, warn, Logger}; use std::collections::BTreeMap; use std::collections::HashSet; @@ -999,17 +1000,11 @@ impl StorageManager { }; if old_id != config.id { - // NOTE(https://github.com/oxidecomputer/omicron/issues/7265): - // - // This should potentially return a "UuidMismatch" error in the - // future, rather than overwriting the existing dataset UUID. - warn!( - log, - "Dataset UUID mismatch. Choosing to take new value."; - "old" => ?old_id, - "new" => ?config.id - ); - return Ok(false); + return Err(Error::UuidMismatch { + name: config.name.full_name(), + old: old_id.into_untyped_uuid(), + new: config.id.into_untyped_uuid(), + }); } let old_props = match SharedDatasetConfig::try_from(old_dataset) {