all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Erik Fastermann <e.fastermann@proxmox.com>
To: pdm-devel@lists.proxmox.com
Cc: Erik Fastermann <e.fastermann@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	[thread overview]
Message-ID: <20260515084116.8028-1-e.fastermann@proxmox.com> (raw)

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

 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<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);
 
@@ -183,9 +204,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




                 reply	other threads:[~2026-05-15  8:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515084116.8028-1-e.fastermann@proxmox.com \
    --to=e.fastermann@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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