From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 1974C1FF146 for ; Tue, 09 Jun 2026 08:40:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 608FA5AB4; Tue, 9 Jun 2026 08:40:02 +0200 (CEST) Message-ID: Date: Tue, 9 Jun 2026 08:39:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces To: pbs-devel@lists.proxmox.com References: <20260515083918.10590-1-e.fastermann@proxmox.com> Content-Language: en-US From: Erik Fastermann In-Reply-To: <20260515083918.10590-1-e.fastermann@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780987153265 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.862 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 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: FTSKA5JUYNC6AM6SKMLRFLIVR27VQ77S X-Message-ID-Hash: FTSKA5JUYNC6AM6SKMLRFLIVR27VQ77S X-MailFrom: e.fastermann@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Gentle ping. This patch still cleanly applies on the current master. On 5/15/26 10:39 AM, Erik Fastermann wrote: > 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. > > 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. > > src/server/report.rs | 35 ++++++++++++++++++++++++++++++++--- > 1 file changed, 32 insertions(+), 3 deletions(-) > > diff --git a/src/server/report.rs b/src/server/report.rs > index e4c761cdb..297718d2e 100644 > --- a/src/server/report.rs > +++ b/src/server/report.rs > @@ -2,6 +2,8 @@ use std::fmt::Write; > use std::path::Path; > use std::process::Command; > > +use proxmox_network_api::NetworkInterfaceType; > + > fn get_top_processes() -> String { > let (exe, args) = ("top", vec!["-b", "-c", "-w512", "-n", "1", "-o", "TIME"]); > let output = Command::new(exe).args(&args).output(); > @@ -93,6 +95,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); > > @@ -206,9 +227,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"); >