Skip to content

Commit

Permalink
Do not overwrite UUIDs, throw conflict on mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Dec 18, 2024
1 parent 5117c18 commit cc17582
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions sled-storage/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cc17582

Please sign in to comment.