mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 01:32:00 +01:00
Count QGA Windows volume GUIDs rather than their shared physical drive; without a GUID retain distinct drive paths. Preserve visible mount metadata, Linux deduplication and byte-overflow containment. Exercise QEMU-only polling, removal and measured-zero History, adapting guest fixtures to the current captured mock-mode scope. Contract-Neutral: Correct existing guest filesystem capacity aggregation and fixture scope compatibility without changing schemas, identity, command admission or backup policy. Change-source: pulse-maintainer
27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package monitoring
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"
|
|
)
|
|
|
|
// windowsVMFilesystemCapacityKey identifies a filesystem, not its backing
|
|
// physical disk. Windows QGA reports disk.dev as PhysicalDriveN for every
|
|
// partition on that drive. A volume GUID is stronger than its mount path;
|
|
// without one, keep distinct drive/mount paths rather than guess equivalence.
|
|
// This key is local to capacity aggregation, never hardware or History identity.
|
|
func windowsVMFilesystemCapacityKey(fs proxmox.VMFileSystem) string {
|
|
name := strings.ToLower(strings.TrimSpace(fs.Name))
|
|
if strings.HasPrefix(name, `\\?\volume{`) && strings.HasSuffix(strings.TrimRight(name, `\/`), "}") {
|
|
return "volume:" + strings.TrimRight(name, `\/`)
|
|
}
|
|
mount := strings.TrimSpace(fs.Mountpoint)
|
|
if len(mount) >= 2 && mount[1] == ':' &&
|
|
((mount[0] >= 'a' && mount[0] <= 'z') || (mount[0] >= 'A' && mount[0] <= 'Z')) &&
|
|
(len(mount) == 2 || mount[2] == '\\' || mount[2] == '/') {
|
|
return "mount:" + strings.TrimRight(strings.ToLower(strings.ReplaceAll(mount, "/", `\`)), `\`)
|
|
}
|
|
return ""
|
|
}
|