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.

Keep display address preference separate from MAC identity metadata

pulse-triage[bot]68f80d6c0f1a
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 536db50dd8..f3d693dd8e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -3091,8 +3091,10 @@ canonical identity and broadcast. Agent-host display address selection also
recognises Podman interface names as secondary, retaining every address and the
explicit `--report-ip` preference. The shared `pkg/netutil` name hint does not
drop management bridges, bonds, VLANs or tunnels, prove a default route, or
-change the agent's separate MAC-based machine-ID fallback. No identity key or
-wire shape changes. `TestIssue2757AgentDisplayPrefersNonContainerInterfaces`
+change the agent's separate MAC-based machine-ID fallback. The existing MAC
+metadata sequence keeps its legacy classifier; Podman preference affects only
+displayed IPs. No identity key or wire shape changes.
+`TestIssue2757AgentDisplayPrefersNonContainerInterfaces`
and `TestIssue2757AgentDisplayKeepsSecondaryOnlyAddresses` bind Podman,
management-interface, supplied identity and explicit-override controls to the
production host adapter; monitoring's #2757 fixtures bind guest list/broadcast
diff --git a/internal/monitoring/monitor_pve_guest_lxc_test.go b/internal/monitoring/monitor_pve_guest_lxc_test.go
index d05f8ca166..832efc0704 100644
--- a/internal/monitoring/monitor_pve_guest_lxc_test.go
+++ b/internal/monitoring/monitor_pve_guest_lxc_test.go
@@ -89,8 +89,8 @@ func TestIssue2757ContainerAddressSelection(t *testing.T) {
config: map[string]interface{}{"net0": "name=eth0,ip=dhcp,ip6=auto"},
interfaces: []proxmox.ContainerInterface{
{Name: "podman0", Inet: "10.88.0.1/16"},
- {Name: "veth0", IPAddresses: []proxmox.VMIPAddress{{Address: "10.89.0.1/16"}}},
- {Name: "eth0", IPAddresses: []proxmox.VMIPAddress{{Address: "192.0.2.80/24"}, {Address: "2001:db8::80/64"}, {Address: "fe80::1/64"}}},
+ {Name: "veth0", IPAddresses: []proxmox.ContainerInterfaceAddress{{Address: "10.89.0.1/16"}}},
+ {Name: "eth0", IPAddresses: []proxmox.ContainerInterfaceAddress{{Address: "192.0.2.80/24"}, {Address: "2001:db8::80/64"}, {Address: "fe80::1/64"}}},
{Name: "lo", Inet: "127.0.0.1/8 ::1/128"},
},
want: []string{"192.0.2.80", "2001:db8::80", "10.88.0.1", "10.89.0.1"},
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index e95d6a5ac1..8c8cfd3f70 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -3939,12 +3939,14 @@ func collectInterfaceIDs(interfaces []models.HostNetworkInterface) ([]string, []
// default-route assertion and must not alter the agent's MAC-based identity.
for pass := 0; pass < 2; pass++ {
for _, iface := range interfaces {
- if (pass == 0) == isLikelyVirtualInterfaceName(iface.Name) {
- continue
- }
- if iface.MAC != "" {
+ // Preserve the old MAC sequence: the new Podman preference is
+ // only for displayed IPs, not another identity metadata change.
+ if (pass == 0) != isLikelyVirtualInterfaceName(iface.Name) && iface.MAC != "" {
macs = append(macs, iface.MAC)
}
+ if (pass == 0) == netutil.IsSecondaryInterfaceName(iface.Name) {
+ continue
+ }
for _, addr := range iface.Addresses {
ip := addr
if strings.Contains(ip, "/") {
@@ -3958,7 +3960,29 @@ func collectInterfaceIDs(interfaces []models.HostNetworkInterface) ([]string, []
}
func isLikelyVirtualInterfaceName(name string) bool {
- return netutil.IsSecondaryInterfaceName(name)
+ // Legacy MAC metadata ordering, also used by the agent's machine-ID
+ // fallback. Keep Podman out of this classifier to preserve those identities.
+ name = strings.ToLower(strings.TrimSpace(name))
+ switch {
+ case name == "" || name == "lo":
+ return true
+ case strings.HasPrefix(name, "docker"):
+ return true
+ case strings.HasPrefix(name, "veth"):
+ return true
+ case strings.HasPrefix(name, "br-"):
+ return true
+ case strings.HasPrefix(name, "cni"):
+ return true
+ case strings.HasPrefix(name, "flannel"):
+ return true
+ case strings.HasPrefix(name, "virbr"):
+ return true
+ case strings.HasPrefix(name, "zt"):
+ return true
+ default:
+ return false
+ }
}
func extractHostname(raw string) string {
diff --git a/internal/unifiedresources/adapters_test.go b/internal/unifiedresources/adapters_test.go
index ca7701c96a..7722e6bbff 100644
--- a/internal/unifiedresources/adapters_test.go
+++ b/internal/unifiedresources/adapters_test.go
@@ -1960,6 +1960,9 @@ func TestIssue2757AgentDisplayPrefersNonContainerInterfaces(t *testing.T) {
if !reflect.DeepEqual(identity.IPAddresses, []string{"192.0.2.80", "10.88.0.1"}) || identity.MachineID != "machine-a" || resource.Agent.AgentID != "agent-a" {
t.Fatalf("agent display IPs or supplied identity changed: %+v", identity)
}
+ if !reflect.DeepEqual(identity.MACAddresses, []string{"02:00:00:00:00:01", "02:00:00:00:00:02"}) {
+ t.Fatalf("display preference changed the legacy MAC sequence: %v", identity.MACAddresses)
+ }
host.ReportIP = "10.88.0.1"
_, override := resourceFromHost(host)
if !reflect.DeepEqual(override.IPAddresses, []string{"10.88.0.1", "192.0.2.80"}) {