public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC
@ 2026-07-07 10:55 Jakob Klocker
  2026-07-07 10:56 ` [PATCH proxmox 1/2] network-api: add is_veth helper to IpLink Jakob Klocker
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakob Klocker @ 2026-07-07 10:55 UTC (permalink / raw)
  To: pve-devel; +Cc: Jakob Klocker

When PBS runs inside an LXC container, network traffic graphs stay
empty for interfaces with non-standard names (e.g. wan0, vxb01). The
reporter [0] observed that renaming to eth0 and restarting made data
appear.

The cause is in collect_netdev_stats(): an interface is recorded as
NetdevType::Physical only if is_physical() returns true. Inside a
container the uplink is one end of a veth pair (info_kind = "veth"), so
is_physical() returns false and the code falls back to
PHYSICAL_NIC_REGEX, which only matches conventional names. A standard
name like eth0 matches the regex and is counted; a custom name does 
not, so its stats are silently dropped. In a VM the guest NIC appears
as a normal hardware NIC without info_kind, which is why the VM case
works.

This series adds is_veth() to proxmox-network-api and gates the
collector on whether PBS runs in a container (checking
/run/systemd/container). 


RFC / open questions:

This patch fixes the reported single-uplink case, but in a container 
with several veths it counts all of them, including a veth enslaved to 
a bridge. In testing (see below) a bridge-enslaved veth was still 
counted. An alternative would be to count root-level interfaces without 
a master instead of matching veth, which would exclude enslaved 
interfaces and also generalise beyond veth.
Also this fix does not work if PBS is run in docker/podman,
since the interface is not a veth there (it was `tap` in podman).
LXC is the case that matters for PVE, so not covering podman/docker
seems acceptable to me.


Related, not fixed here:

NETWORK_INTERFACE_CACHE is a OnceLock populated once at proxy startup 
and never refreshed, so interfaces added or renamed after startup are 
not picked up until a restart. This matches the reporter's note that a
restart was required. It's pre-existing and independent of this fix.


Testing:

Reproduced in a PVE LXC running PBS with a custom-named veth uplink
("test"). Before: the interface produces no graph data. After: it is
counted. Verified via a temporary debug print in the collector that:

  * the custom-named veth uplink is counted,
  * a bridge (info_kind = bridge) is correctly excluded,
  * with multiple veths present, all veths are counted, including a
    bridge-enslaved one - the limitation noted above.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=7198


proxmox:

Jakob Klocker (1):
  network-api: add is_veth helper to IpLink

 proxmox-network-api/src/config/helper.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)


proxmox-backup:

Jakob Klocker (1):
  fix #7198: metric collection: count veth uplink when running in a
    container

 src/server/metric_collection/mod.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


Summary over all repositories:
  2 files changed, 20 insertions(+), 1 deletions(-)

-- 
Generated by murpp 0.12.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-07 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 10:55 [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC Jakob Klocker
2026-07-07 10:56 ` [PATCH proxmox 1/2] network-api: add is_veth helper to IpLink Jakob Klocker
2026-07-07 10:56 ` [PATCH proxmox-backup 2/2] fix #7198: metric collection: count veth uplink when running in a container Jakob Klocker
2026-07-07 11:17 ` [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC Jakob Klocker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal