volume(rs): report a volume a collection delete could not destroy

The collection delete logged a refused destroy, kept the volume mounted
and still answered success, so the caller never retried. Return the first
error after the loop, as the Go store does, while the other volumes of the
collection are still deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-03 16:36:43 -08:00
1 parent 0589a59bf8
commit 0709c04af3
1 file changed
+3 -1
+3 -1
View File
@@ -782,6 +782,7 @@ impl DiskLocation {
/// Delete all volumes in a collection.
pub fn delete_collection(&mut self, collection: &str) -> Result<(), VolumeError> {
let mut first_error = None;
let vids: Vec<VolumeId> = self
.volumes
.iter()
@@ -793,6 +794,7 @@ impl DiskLocation {
if let Some(v) = self.volumes.remove(&vid) {
if let Err(e) = v.destroy(false, false, false) {
warn!(volume_id = vid.0, error = %e, "delete collection: failed to destroy volume");
first_error.get_or_insert(e);
self.volumes.insert(vid, v);
} else {
crate::metrics::VOLUME_GAUGE
@@ -819,7 +821,7 @@ impl DiskLocation {
ec_vol.destroy();
}
}
Ok(())
first_error.map_or(Ok(()), Err)
}
// ---- Metrics ----