Skip to content

Commit c67d8e9

Browse files
committed
return conflict, case can happen due to client requests
1 parent d6e7e1b commit c67d8e9

File tree

1 file changed

+18
-2
lines changed
  • nexus/db-queries/src/db/datastore

1 file changed

+18
-2
lines changed

nexus/db-queries/src/db/datastore/sled.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,25 @@ impl DataStore {
538538
} else {
539539
if local_storage_allocation_sleds.len() != 1 {
540540
// It's an error for multiple sleds to host local storage
541-
// disks, that makes no sense!
541+
// disks for a single VMM, so return a conflict error here.
542+
//
543+
// This case can happen if a local storage disk was
544+
// allocated on a sled, and then is detached from the
545+
// instance whose VMM was on that sled, and then is attached
546+
// to another instance that has some local storage disks
547+
// that already have some allocations on another sled.
548+
//
549+
// TODO by the time this query has run that detach + attach
550+
// has already occurred. Nexus should disallow attaching
551+
// local storage disks to an instance that already has local
552+
// storage disks if the allocations are on different sleds.
553+
//
554+
// TODO for clients to prevent such a scenario they would
555+
// need to be aware of which sled a local storage disk's
556+
// allocation is on, which means that information has to be
557+
// exposed somehow in the Disk view.
542558
return Err(SledReservationTransactionError::Connection(
543-
Error::internal_error(&format!(
559+
Error::conflict(&format!(
544560
"local storage disks for instance {instance_id} \
545561
allocated on multiple sleds \
546562
{local_storage_allocation_sleds:?}"

0 commit comments

Comments
 (0)