From 7a3ee3d5ba0e42f37031570c354adf3328e1f246 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 23 Nov 2025 13:54:33 +0100 Subject: [PATCH] Fix physical drive grouping logic for unified pool visualization Updated filesystem grouping to use extract_base_device method for proper partition-to-drive mapping. This ensures nvme0n1p1 and nvme0n1p2 are correctly grouped under nvme0n1 drive pool instead of separate pools. --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- agent/src/collectors/disk.rs | 13 +++++++++++-- dashboard/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a1bd4a..1812dec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.107" +version = "0.1.108" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.107" +version = "0.1.108" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.107" +version = "0.1.108" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index bf68cce..6fcdd8c 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.108" +version = "0.1.109" edition = "2021" [dependencies] diff --git a/agent/src/collectors/disk.rs b/agent/src/collectors/disk.rs index 897011c..7fea4f7 100644 --- a/agent/src/collectors/disk.rs +++ b/agent/src/collectors/disk.rs @@ -419,13 +419,22 @@ impl DiskCollector { // Get the physical drive name for this mount point if let Some(devices) = self.detected_devices.get(&fs.mount_point) { if let Some(device_name) = devices.first() { - // Extract drive name (e.g., "nvme0n1" from "nvme0n1") - let drive_name = device_name.clone(); + // Extract base drive name from detected device + let drive_name = Self::extract_base_device(device_name) + .unwrap_or_else(|| device_name.clone()); + + debug!("Grouping filesystem {} (device: {}) under drive: {}", + fs.mount_point, device_name, drive_name); + grouped.entry(drive_name).or_insert_with(Vec::new).push(fs.clone()); } } } + debug!("Filesystem grouping result: {} drives with filesystems: {:?}", + grouped.len(), + grouped.keys().collect::>()); + Ok(grouped) } diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 1469bf3..2a1a956 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.108" +version = "0.1.109" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 1082edb..a0aef69 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.108" +version = "0.1.109" edition = "2021" [dependencies]