all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces
@ 2026-05-15  8:39 Erik Fastermann
  2026-06-09  6:39 ` Erik Fastermann
  2026-06-26  9:06 ` Christian Ebner
  0 siblings, 2 replies; 3+ messages in thread
From: Erik Fastermann @ 2026-05-15  8:39 UTC (permalink / raw)
  To: pbs-devel; +Cc: Erik Fastermann

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 <e.fastermann@proxmox.com>
---

 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<OsStr>] also don't work.
   Mapping the Vec<String> 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<String>)> {
+    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::<Vec<String>>()
         .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::<Vec<String>>()
         .join("\n\n");
 
-- 
2.47.3




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

* Re: [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces
  2026-05-15  8:39 [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces Erik Fastermann
@ 2026-06-09  6:39 ` Erik Fastermann
  2026-06-26  9:06 ` Christian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Erik Fastermann @ 2026-06-09  6:39 UTC (permalink / raw)
  To: pbs-devel

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 <e.fastermann@proxmox.com>
> ---
> 
>   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<OsStr>] also don't work.
>     Mapping the Vec<String> 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<String>)> {
> +    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::<Vec<String>>()
>           .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::<Vec<String>>()
>           .join("\n\n");
>   





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

* Re: [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces
  2026-05-15  8:39 [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces Erik Fastermann
  2026-06-09  6:39 ` Erik Fastermann
@ 2026-06-26  9:06 ` Christian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Ebner @ 2026-06-26  9:06 UTC (permalink / raw)
  To: Erik Fastermann, pbs-devel

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.
> 

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7187

although only the PBS part for this particular case.

> Signed-off-by: Erik Fastermann <e.fastermann@proxmox.com>

Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>

Code looks okay to me and this produces the expected output.

Only concern, although out of scope for this patch:
As noted in server/src/report.rs on the PDM side, code was basically 
copied over from PBS for the initial implementation. The comment there 
already suggest refactoring and splitting into a `proxmox-system-report` 
crate.

It would make sense to do this sooner than later, as the reports are 
likely to further diverge over time and code duplication to increase.

Could you tackle this as followup?

Maybe further split into product common commands (and files, ecc.) and 
product specific commands (and files, ecc.). Product specific parts 
could then maybe be defined as callbacks?






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

end of thread, other threads:[~2026-06-26  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15  8:39 [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces Erik Fastermann
2026-06-09  6:39 ` Erik Fastermann
2026-06-26  9:06 ` Christian Ebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal