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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep same-name Proxmox estates distinct after restart
pulse-triage[bot]e00d0eee03a6
diff --git a/internal/unifiedresources/canonical_id_pins.go b/internal/unifiedresources/canonical_id_pins.goindex ec7ddcb0ba..384712afd5 100644--- a/internal/unifiedresources/canonical_id_pins.go+++ b/internal/unifiedresources/canonical_id_pins.go@@ -2,6 +2,7 @@ package unifiedresourcesimport ("log"+ "net""strings")@@ -115,6 +116,61 @@ func (index *identityPinIndex) find(identity ResourceIdentity) (ResourceIdentityreturn ResourceIdentityPin{}, false}+// findProxmoxNode resolves a weak provider node only inside identity evidence+// owned by that provider. A standalone node name is not an estate-wide key:+// pve in one DNS zone may coexist with pve in another. Falling through to the+// generic short-hostname buckets lets the first site's durable agent pin lend+// its machine ID to every same-named provider during the boot window before+// agents check in, collapsing those provider rows into one canonical resource.+//+// A full configured endpoint is provider-scoped evidence and is safe when the+// durable pin recorded that exact endpoint. Named clusters may retain their+// historical cluster+native-name lookup; duplicate cluster labels are already+// marked provider-scoped by the adapter and arrive without ClusterName.+func (index *identityPinIndex) findProxmoxNode(resource Resource, identity ResourceIdentity) (ResourceIdentityPin, bool) {+ if index == nil || resource.Proxmox == nil {+ return ResourceIdentityPin{}, false+ }+ machineID := strings.TrimSpace(identity.MachineID)+ dmiUUID := strings.TrimSpace(identity.DMIUUID)+ if machineID != "" {+ if pin, ok := index.byMachineID[machineID]; ok {+ return pin, true+ }+ }+ if dmiUUID != "" {+ if pin, ok := index.byDMIUUID[dmiUUID]; ok && pinCompatible(pin, machineID, "") {+ return pin, true+ }+ }++ clusterName := strings.TrimSpace(identity.ClusterName)+ endpoint := NormalizeFullHostname(extractHostname(resource.Proxmox.HostURL))+ if endpoint != "" && net.ParseIP(endpoint) == nil {+ if clusterName != "" {+ if pin, ok := resolvePinBucket(index.byClusterHost[clusterHostPinKey(clusterName, endpoint)], endpoint, machineID, dmiUUID); ok {+ return pin, true+ }+ }+ if pin, ok := resolvePinBucket(index.byHostname[endpoint], endpoint, machineID, dmiUUID); ok {+ return pin, true+ }+ }++ if clusterName != "" {+ for _, hostname := range identity.Hostnames {+ hostname = NormalizeFullHostname(hostname)+ if hostname == "" {+ continue+ }+ if pin, ok := resolvePinBucket(index.byClusterHost[clusterHostPinKey(clusterName, hostname)], hostname, machineID, dmiUUID); ok {+ return pin, true+ }+ }+ }+ return ResourceIdentityPin{}, false+}+// resolvePinBucket resolves a hostname bucket lookup. The bucket must be// unambiguous (exactly one pin), the pinned hostname must be the incoming one// or its short/FQDN equivalent (two distinct FQDNs sharing a short name never@@ -166,14 +222,20 @@ func (rr *ResourceRegistry) loadIdentityPins() {// knows cluster+hostname) still derives the same canonical ID as a steady// state rebuild that knows the machine ID. Only missing fields are filled; an// incoming identity that already carries a machine ID is never overridden.-func (rr *ResourceRegistry) completeIdentityFromPins(resourceType ResourceType, identity ResourceIdentity) ResourceIdentity {- if CanonicalResourceType(resourceType) != ResourceTypeAgent {+func (rr *ResourceRegistry) completeIdentityFromPins(source DataSource, resource Resource, identity ResourceIdentity) ResourceIdentity {+ if CanonicalResourceType(resource.Type) != ResourceTypeAgent {return identity}if strings.TrimSpace(identity.MachineID) != "" && strings.TrimSpace(identity.DMIUUID) != "" {return identity}- pin, ok := rr.identityPins.find(identity)+ var pin ResourceIdentityPin+ var ok bool+ if source == SourceProxmox && resource.Proxmox != nil {+ pin, ok = rr.identityPins.findProxmoxNode(resource, identity)+ } else {+ pin, ok = rr.identityPins.find(identity)+ }if !ok {return identity}diff --git a/internal/unifiedresources/ids.go b/internal/unifiedresources/ids.goindex 51975f8a05..0811f16d93 100644--- a/internal/unifiedresources/ids.go+++ b/internal/unifiedresources/ids.go@@ -4,6 +4,7 @@ import ("crypto/sha256""encoding/hex""fmt"+ "net""strconv""strings")@@ -170,13 +171,23 @@ func identityPinForResource(resource *Resource) (ResourceIdentityPin, bool) {if resource == nil || CanonicalResourceType(resource.Type) != ResourceTypeAgent {return ResourceIdentityPin{}, false}+ hostname := firstIdentityHostname(resource.Identity)+ // Proxmox native node names are commonly short and repeat across+ // independent estates. When the merged provider view has a full endpoint,+ // pin that provider-scoped hostname so a provider-only boot can recover the+ // machine identity without making the short name globally authoritative.+ if resource.Proxmox != nil {+ if endpoint := NormalizeFullHostname(extractHostname(resource.Proxmox.HostURL)); endpoint != "" && net.ParseIP(endpoint) == nil {+ hostname = endpoint+ }+ }pin := ResourceIdentityPin{CanonicalID: resource.ID,ResourceType: ResourceTypeAgent,MachineID: resource.Identity.MachineID,DMIUUID: resource.Identity.DMIUUID,ClusterName: resource.Identity.ClusterName,- Hostname: firstIdentityHostname(resource.Identity),+ Hostname: hostname,}.normalized()if pin.CanonicalID == "" || !pin.hasStrongKey() {return ResourceIdentityPin{}, falsediff --git a/internal/unifiedresources/issue1753_provider_scope_test.go b/internal/unifiedresources/issue1753_provider_scope_test.gonew file mode 100644index 0000000000..5cebdadede--- /dev/null+++ b/internal/unifiedresources/issue1753_provider_scope_test.go@@ -0,0 +1,95 @@+package unifiedresources++import (+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/models"+)++func TestIssue1753StandaloneProviderScopesSurvivePinnedBootWindow(t *testing.T) {+ store := NewMemoryStore()+ now := time.Date(2026, 8, 31, 9, 0, 0, 0, time.UTC)+ adapter := NewMonitorAdapter(NewRegistry(store))+ adapter.PopulateFromSnapshot(models.StateSnapshot{+ Nodes: []models.Node{{+ ID: "staging-pve", NodeIdentity: "staging-pve", Name: "pve",+ DisplayName: "Staging", Instance: "staging", Host: "https://pve.staging.example:8006",+ Status: "online", LinkedAgentID: "agent-staging", LastSeen: now,+ }},+ Hosts: []models.Host{{+ ID: "agent-staging", Hostname: "pve", MachineID: "machine-staging",+ LinkedNodeID: "staging-pve", Status: "online", LastSeen: now,+ }},+ LastUpdate: now,+ })++ // Provider polling can lead agent check-in after restart. The durable pin+ // from the established first site must not lend its machine identity to a+ // new standalone provider solely because both native nodes are named pve.+ adapter.PopulateFromSnapshot(models.StateSnapshot{+ Nodes: []models.Node{+ {ID: "staging-pve", NodeIdentity: "staging-pve", Name: "pve", DisplayName: "Staging", Instance: "staging", Host: "https://pve.staging.example:8006", Status: "online", LastSeen: now.Add(time.Minute)},+ {ID: "production-pve", NodeIdentity: "production-pve", Name: "pve", DisplayName: "Production", Instance: "production", Host: "https://pve.production.example:8006", Status: "online", LastSeen: now.Add(time.Minute)},+ },+ LastUpdate: now.Add(time.Minute),+ })++ resources := adapter.GetAll()+ var nodes []Resource+ for _, resource := range resources {+ if resource.Type == ResourceTypeAgent && resource.Proxmox != nil {+ nodes = append(nodes, resource)+ }+ }+ if len(nodes) != 2 {+ t.Fatalf("presentation nodes = %d, want 2: %+v", len(nodes), nodes)+ }+ byInstance := make(map[string]Resource, len(nodes))+ for _, node := range nodes {+ byInstance[node.Proxmox.Instance] = node+ }+ if got := byInstance["staging"].ID; got != MachineIdentityCanonicalID(ResourceTypeAgent, "machine-staging") {+ t.Fatalf("staging canonical ID = %q, want pinned machine identity", got)+ }+ if byInstance["production"].ID == "" || byInstance["production"].ID == byInstance["staging"].ID {+ t.Fatalf("provider identities were not separated: %+v", byInstance)+ }+ if byInstance["staging"].Name != "Staging" || byInstance["production"].Name != "Production" {+ t.Fatalf("provider display names were lost: %+v", byInstance)+ }+}++func TestIssue1753LegacyShortHostnamePinCannotClaimMultipleProviderScopes(t *testing.T) {+ store := NewMemoryStore()+ if err := store.UpsertResourceIdentityPins([]ResourceIdentityPin{{+ CanonicalID: MachineIdentityCanonicalID(ResourceTypeAgent, "machine-staging"),+ ResourceType: ResourceTypeAgent,+ MachineID: "machine-staging",+ Hostname: "pve",+ }}); err != nil {+ t.Fatalf("seed legacy identity pin: %v", err)+ }++ registry := NewRegistry(store)+ registry.IngestSnapshot(models.StateSnapshot{Nodes: []models.Node{+ {ID: "staging-pve", NodeIdentity: "staging-pve", Name: "pve", DisplayName: "Staging", Instance: "staging", Host: "https://pve.staging.example:8006", Status: "online"},+ {ID: "production-pve", NodeIdentity: "production-pve", Name: "pve", DisplayName: "Production", Instance: "production", Host: "https://pve.production.example:8006", Status: "online"},+ }})++ resources := registry.ListForPresentation()+ var nodes []Resource+ for _, resource := range resources {+ if resource.Type == ResourceTypeAgent && resource.Proxmox != nil {+ nodes = append(nodes, resource)+ }+ }+ if len(nodes) != 2 {+ t.Fatalf("legacy short pin collapsed provider scopes: %+v", nodes)+ }+ for _, node := range nodes {+ if node.Identity.MachineID != "" {+ t.Fatalf("legacy short pin leaked machine identity into %q: %+v", node.Proxmox.Instance, node.Identity)+ }+ }+}diff --git a/internal/unifiedresources/registry.go b/internal/unifiedresources/registry.goindex 6945b9e468..9ccacf2320 100644--- a/internal/unifiedresources/registry.go+++ b/internal/unifiedresources/registry.go@@ -2663,7 +2663,7 @@ func (rr *ResourceRegistry) ingest(source DataSource, sourceID string, resource// pulse-agent's pin on a same-named host) completing the identity would// re-merge systems the connection scoping keeps apart.if source != SourceTrueNAS {- identity = rr.completeIdentityFromPins(resource.Type, identity)+ identity = rr.completeIdentityFromPins(source, resource, identity)}resource.Identity = identityresource.Sources = []DataSource{source}