Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Disambiguate VMware replacement selectors

rcourtman4efd90ab52b6
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index b8780e8f2b..980eda2a3c 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -280,6 +280,11 @@ Candidate matching must fail closed when the prospective monitored-system
candidate cannot resolve to a canonical top-level resource; malformed or
whitespace-only inputs are not allowed to masquerade as an already-counted
system simply because their no-op projection has zero additional count.
+VMware replacement selectors must also keep source-specific identity signals
+unambiguous: `ResourceID` scopes saved vCenter connection replacement to
+`ConnectionID`, while host UUID / DMI identity matching belongs to the
+machine-identity selector path, so editing one connection cannot strip an
+unrelated VMware host whose UUID happens to equal that connection ID.
That shared consumer ownership now includes same-tab summary hydration too.
`frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts`
may keep an in-memory remount cache for canonical resource charts, but the key
diff --git a/internal/unifiedresources/monitored_system_projection.go b/internal/unifiedresources/monitored_system_projection.go
index e8600b2325..b86900db0a 100644
--- a/internal/unifiedresources/monitored_system_projection.go
+++ b/internal/unifiedresources/monitored_system_projection.go
@@ -564,7 +564,8 @@ func monitoredSystemReplacementSelectorMatchesVMware(
}
return monitoredSystemSelectorMatchesCanonicalResourceID(selector, resource) ||
trimmedEqualFold(selector.ResourceID, resource.VMware.ConnectionID) ||
- trimmedEqualFold(selector.ResourceID, resource.VMware.HostUUID) ||
+ trimmedEqualFold(selector.MachineID, resource.VMware.HostUUID) ||
+ trimmedEqualFold(selector.MachineID, resource.Identity.DMIUUID) ||
trimmedEqualFold(selector.Name, resource.Name) ||
monitoredSystemSelectorMatchesHost(selector, resource.VMware.RuntimeHostName, resource.VMware.VCenterHost, resource.Name)
}
diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.go
index 655bb1b5fd..cb38984991 100644
--- a/internal/unifiedresources/registry_test.go
+++ b/internal/unifiedresources/registry_test.go
@@ -2372,6 +2372,106 @@ func TestPreviewMonitoredSystemRecordsReplacementOffsetsReplacedVMwareConnection
}
}
+func TestPreviewMonitoredSystemRecordsReplacementScopesVMwareResourceIDToConnection(t *testing.T) {
+ rr := NewRegistry(nil)
+ now := time.Date(2026, 4, 7, 12, 0, 0, 0, time.UTC)
+
+ rr.IngestRecords(SourceVMware, []IngestRecord{
+ {
+ SourceID: "vc-edit:host:host-101",
+ Resource: Resource{
+ Type: ResourceTypeAgent,
+ Name: "esxi-01.lab.local",
+ Status: StatusOnline,
+ LastSeen: now,
+ VMware: &VMwareData{
+ ConnectionID: "vc-edit",
+ ConnectionName: "Edited VC",
+ ManagedObjectID: "host-101",
+ EntityType: "host",
+ HostUUID: "uuid-host-1",
+ },
+ },
+ Identity: ResourceIdentity{
+ DMIUUID: "uuid-host-1",
+ Hostnames: []string{"esxi-01.lab.local"},
+ },
+ },
+ {
+ SourceID: "vc-other:host:host-201",
+ Resource: Resource{
+ Type: ResourceTypeAgent,
+ Name: "esxi-collision.lab.local",
+ Status: StatusOnline,
+ LastSeen: now,
+ VMware: &VMwareData{
+ ConnectionID: "vc-other",
+ ConnectionName: "Other VC",
+ ManagedObjectID: "host-201",
+ EntityType: "host",
+ HostUUID: "vc-edit",
+ },
+ },
+ Identity: ResourceIdentity{
+ DMIUUID: "vc-edit",
+ Hostnames: []string{"esxi-collision.lab.local"},
+ },
+ },
+ })
+
+ preview := PreviewMonitoredSystemRecordsReplacement(rr, MonitoredSystemReplacement{
+ Source: SourceVMware,
+ Selector: MonitoredSystemReplacementSelector{
+ ResourceID: "vc-edit",
+ },
+ }, map[DataSource][]IngestRecord{
+ SourceVMware: {
+ {
+ SourceID: "vc-edit:host:host-101",
+ Resource: Resource{
+ Type: ResourceTypeAgent,
+ Name: "esxi-01.lab.local",
+ Status: StatusOnline,
+ LastSeen: now,
+ VMware: &VMwareData{
+ ConnectionID: "vc-edit",
+ ConnectionName: "Edited VC",
+ ManagedObjectID: "host-101",
+ EntityType: "host",
+ HostUUID: "uuid-host-1",
+ },
+ },
+ Identity: ResourceIdentity{
+ DMIUUID: "uuid-host-1",
+ Hostnames: []string{"esxi-01.lab.local"},
+ },
+ },
+ },
+ })
+
+ if preview.CurrentCount != 2 {
+ t.Fatalf("CurrentCount = %d, want 2", preview.CurrentCount)
+ }
+ if preview.ProjectedCount != 2 {
+ t.Fatalf("ProjectedCount = %d, want 2", preview.ProjectedCount)
+ }
+ if preview.AdditionalCount != 0 {
+ t.Fatalf("AdditionalCount = %d, want 0", preview.AdditionalCount)
+ }
+ if len(preview.CurrentSystems) != 1 {
+ t.Fatalf("len(CurrentSystems) = %d, want 1", len(preview.CurrentSystems))
+ }
+ if preview.CurrentSystems[0].Name != "esxi-01.lab.local" {
+ t.Fatalf("CurrentSystems[0].Name = %q, want esxi-01.lab.local", preview.CurrentSystems[0].Name)
+ }
+ if len(preview.ProjectedSystems) != 1 {
+ t.Fatalf("len(ProjectedSystems) = %d, want 1", len(preview.ProjectedSystems))
+ }
+ if preview.ProjectedSystems[0].Name != "esxi-01.lab.local" {
+ t.Fatalf("ProjectedSystems[0].Name = %q, want esxi-01.lab.local", preview.ProjectedSystems[0].Name)
+ }
+}
+
func TestResourceRegistry_WorkloadsIncludeCanonicalAppContainers(t *testing.T) {
rr := NewRegistry(nil)
now := time.Date(2026, 3, 29, 12, 0, 0, 0, time.UTC)