From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D9C461FF146 for ; Tue, 07 Jul 2026 13:17:52 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B966C2143A; Tue, 07 Jul 2026 13:17:55 +0200 (CEST) Message-ID: <587928ba-6f96-427f-87c0-481f94164b58@proxmox.com> Date: Tue, 7 Jul 2026 13:17:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [RFC proxmox{,-backup} 0/2] fix #7198: count veth uplink for PBS running in an LXC To: pve-devel@lists.proxmox.com References: <20260707105601.309299-1-j.klocker@proxmox.com> Content-Language: en-US From: Jakob Klocker In-Reply-To: <20260707105601.309299-1-j.klocker@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783423064372 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.834 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: OP2GF2ZEXDX33A6Z62IBLJKHLKV2342T X-Message-ID-Hash: OP2GF2ZEXDX33A6Z62IBLJKHLKV2342T X-MailFrom: j.klocker@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Sorry for the noise, this was meant for the PBS ML. On 7/7/26 12:56 PM, Jakob Klocker wrote: > 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(-) >