From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 75AE01FF14C for ; Fri, 15 May 2026 10:41:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4F94A106C1; Fri, 15 May 2026 10:41:20 +0200 (CEST) From: Erik Fastermann To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox-datacenter-manager v3] fix #7187: report: add ethtool output for physical interfaces Date: Fri, 15 May 2026 10:41:16 +0200 Message-ID: <20260515084116.8028-1-e.fastermann@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: SURXEFKON364QFBQ5BLRTMYCR7GHNECS X-Message-ID-Hash: SURXEFKON364QFBQ5BLRTMYCR7GHNECS X-MailFrom: root@erik-pdm.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 CC: Erik Fastermann X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Adding ethtool output to the report provides visibility into actual and supported NIC link speeds, making it much easier to diagnose network performance issues, negotiation failures, and configuration mismatches. It also reduces support back-and-forth. The implementation mirrors the change in proxmox-backup, as the report functionality in pdm is adapted from there. Signed-off-by: Erik Fastermann --- NOTE: A similar patch was submitted for all products: pmg, pve, pbs, pdm. changes since v2: * added new function dynamic_commands * updated generate_report to include the dynamic_commands NOTE: I did not change the signature of get_command_output, as the suggested fix does not work in this case, because we later join the args for the output. This is why solutions like &[impl AsRef] also don't work. Mapping the Vec to Vec<&str> seamed like the simplest change, but I'm open to other suggestions. server/src/report.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/server/src/report.rs b/server/src/report.rs index 371d8cf..3c87b99 100644 --- a/server/src/report.rs +++ b/server/src/report.rs @@ -2,6 +2,8 @@ use std::fmt::Write; use std::path::Path; use std::process::Command; +use proxmox_network_api::NetworkInterfaceType; + // TODO: This was copied from PBS. Might make sense to refactor these a little // bit and move them a `proxmox-system-report` crate or something. @@ -84,6 +86,25 @@ fn commands() -> Vec<(&'static str, Vec<&'static str>)> { ] } +fn dynamic_commands() -> Vec<(&'static str, Vec)> { + let mut commands = Vec::new(); + + match proxmox_network_api::config() { + Ok((config, _)) => { + for (name, iface) in config.interfaces { + if iface.interface_type == NetworkInterfaceType::Eth { + commands.push(("ethtool", vec![name])); + } + } + } + Err(err) => { + eprintln!("failed to query network interfaces: {err}"); + } + } + + commands +} + // (description, function()) type FunctionMapping = (&'static str, fn() -> String); @@ -183,9 +204,17 @@ pub fn generate_report() -> String { .collect::>() .join("\n\n"); - let command_outputs = commands() - .iter() - .map(|(command, args)| get_command_output(command, args)) + let static_command_outputs = commands() + .into_iter() + .map(|(command, args)| get_command_output(command, &args)); + + let dynamic_command_outputs = dynamic_commands().into_iter().map(|(command, args)| { + let args = args.iter().map(String::as_str).collect(); + get_command_output(command, &args) + }); + + let command_outputs = static_command_outputs + .chain(dynamic_command_outputs) .collect::>() .join("\n\n"); -- 2.47.3