[pve-devel] [PATCH installer 03/14] run env: network: add kernel driver name to network interface info
Christoph Heiss
c.heiss at proxmox.com
Tue Oct 14 15:21:48 CEST 2025
This information is already available in the GUI, this makes it possible
to show it in the TUI too.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Proxmox/Install/RunEnv.pm | 7 +++++++
.../fqdn_from_dhcp_no_default_domain.run-env.json | 9 +++++++++
.../parse_answer_fail/no_fqdn_from_dhcp.run-env.json | 9 +++++++++
proxmox-auto-installer/tests/resources/run-env-info.json | 9 +++++++++
proxmox-installer-common/src/options.rs | 2 ++
proxmox-installer-common/src/setup.rs | 3 +++
6 files changed, 39 insertions(+)
diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm
index f0fa6ec..40a9621 100644
--- a/Proxmox/Install/RunEnv.pm
+++ b/Proxmox/Install/RunEnv.pm
@@ -72,6 +72,9 @@ sub query_cpu_info : prototype() {
# mac => <mac address>,
# index => <index>,
# name => <ifname>,
+# state => <UP|DOWN|LOWERLAYERDOWN|DORMANT|TESTING|NOTPRESENT|UNKNOWN>,
+# pinned_id => <sequential numerical ID>,
+# driver => <driver name>,
# addresses => [
# family => <inet|inet6>,
# address => <mac address>,
@@ -113,12 +116,16 @@ my sub query_netdevs : prototype() {
}
}
+ my $driver = readlink "/sys/class/net/$name/device/driver" || 'unknown';
+ $driver =~ s!^.*/!!;
+
$ifs->{$name} = {
index => $index,
name => $name,
pinned_id => "${pinned_counter}",
mac => $mac,
state => uc($state),
+ driver => $driver,
};
$ifs->{$name}->{addresses} = \@valid_addrs if @valid_addrs;
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
index e7c2205..4c41c13 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/fqdn_from_dhcp_no_default_domain.run-env.json
@@ -182,6 +182,7 @@
"mac": "b4:2e:99:ac:ad:b4",
"name": "eno1",
"state": "UP",
+ "driver": "igb",
"pinned_id": "0"
},
"eno2": {
@@ -189,6 +190,7 @@
"mac": "b4:2e:99:ac:ad:b5",
"name": "eno2",
"state": "UP",
+ "driver": "igb",
"pinned_id": "1"
},
"enp129s0f0np0": {
@@ -196,6 +198,7 @@
"mac": "1c:34:da:5c:5e:24",
"name": "enp129s0f0np0",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "2"
},
"enp129s0f1np1": {
@@ -203,6 +206,7 @@
"mac": "1c:34:da:5c:5e:25",
"name": "enp129s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "3"
},
"enp193s0f0np0": {
@@ -210,6 +214,7 @@
"mac": "24:8a:07:1e:05:bc",
"name": "enp193s0f0np0",
"state": "UP",
+ "driver": "mlx5_core",
"pinned_id": "4"
},
"enp193s0f1np1": {
@@ -217,6 +222,7 @@
"mac": "24:8a:07:1e:05:bd",
"name": "enp193s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "5"
},
"enp65s0f0": {
@@ -224,6 +230,7 @@
"mac": "a0:36:9f:0a:b3:82",
"name": "enp65s0f0",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "6"
},
"enp65s0f1": {
@@ -231,6 +238,7 @@
"mac": "a0:36:9f:0a:b3:83",
"name": "enp65s0f1",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "7"
},
"enx5a4732ddc747": {
@@ -238,6 +246,7 @@
"mac": "5a:47:32:dd:c7:47",
"name": "enx5a4732ddc747",
"state": "UNKNOWN",
+ "driver": "cdc_ether",
"pinned_id": "8"
}
},
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
index 47d7bde..fa4e834 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/no_fqdn_from_dhcp.run-env.json
@@ -181,6 +181,7 @@
"mac": "b4:2e:99:ac:ad:b4",
"name": "eno1",
"state": "UP",
+ "driver": "igb",
"pinned_id": "0"
},
"eno2": {
@@ -188,6 +189,7 @@
"mac": "b4:2e:99:ac:ad:b5",
"name": "eno2",
"state": "UP",
+ "driver": "igb",
"pinned_id": "1"
},
"enp129s0f0np0": {
@@ -195,6 +197,7 @@
"mac": "1c:34:da:5c:5e:24",
"name": "enp129s0f0np0",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "2"
},
"enp129s0f1np1": {
@@ -202,6 +205,7 @@
"mac": "1c:34:da:5c:5e:25",
"name": "enp129s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "3"
},
"enp193s0f0np0": {
@@ -209,6 +213,7 @@
"mac": "24:8a:07:1e:05:bc",
"name": "enp193s0f0np0",
"state": "UP",
+ "driver": "mlx5_core",
"pinned_id": "4"
},
"enp193s0f1np1": {
@@ -216,6 +221,7 @@
"mac": "24:8a:07:1e:05:bd",
"name": "enp193s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "5"
},
"enp65s0f0": {
@@ -223,6 +229,7 @@
"mac": "a0:36:9f:0a:b3:82",
"name": "enp65s0f0",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "6"
},
"enp65s0f1": {
@@ -230,6 +237,7 @@
"mac": "a0:36:9f:0a:b3:83",
"name": "enp65s0f1",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "7"
},
"enx5a4732ddc747": {
@@ -237,6 +245,7 @@
"mac": "5a:47:32:dd:c7:47",
"name": "enx5a4732ddc747",
"state": "UNKNOWN",
+ "driver": "cdc_ether",
"pinned_id": "8"
}
},
diff --git a/proxmox-auto-installer/tests/resources/run-env-info.json b/proxmox-auto-installer/tests/resources/run-env-info.json
index 5291721..add5f2a 100644
--- a/proxmox-auto-installer/tests/resources/run-env-info.json
+++ b/proxmox-auto-installer/tests/resources/run-env-info.json
@@ -182,6 +182,7 @@
"mac": "b4:2e:99:ac:ad:b4",
"name": "eno1",
"state": "UP",
+ "driver": "igb",
"pinned_id": "0"
},
"eno2": {
@@ -189,6 +190,7 @@
"mac": "b4:2e:99:ac:ad:b5",
"name": "eno2",
"state": "UP",
+ "driver": "igb",
"pinned_id": "1"
},
"enp129s0f0np0": {
@@ -196,6 +198,7 @@
"mac": "1c:34:da:5c:5e:24",
"name": "enp129s0f0np0",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "2"
},
"enp129s0f1np1": {
@@ -203,6 +206,7 @@
"mac": "1c:34:da:5c:5e:25",
"name": "enp129s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "3"
},
"enp193s0f0np0": {
@@ -210,6 +214,7 @@
"mac": "24:8a:07:1e:05:bc",
"name": "enp193s0f0np0",
"state": "UP",
+ "driver": "mlx5_core",
"pinned_id": "4"
},
"enp193s0f1np1": {
@@ -217,6 +222,7 @@
"mac": "24:8a:07:1e:05:bd",
"name": "enp193s0f1np1",
"state": "DOWN",
+ "driver": "mlx5_core",
"pinned_id": "5"
},
"enp65s0f0": {
@@ -224,6 +230,7 @@
"mac": "a0:36:9f:0a:b3:82",
"name": "enp65s0f0",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "6"
},
"enp65s0f1": {
@@ -231,6 +238,7 @@
"mac": "a0:36:9f:0a:b3:83",
"name": "enp65s0f1",
"state": "DOWN",
+ "driver": "igb",
"pinned_id": "7"
},
"enx5a4732ddc747": {
@@ -238,6 +246,7 @@
"mac": "5a:47:32:dd:c7:47",
"name": "enx5a4732ddc747",
"state": "UNKNOWN",
+ "driver": "cdc_ether",
"pinned_id": "8"
}
},
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 48c77c9..50fd74e 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -677,6 +677,7 @@ mod tests {
name: "eth0".to_owned(),
index: 0,
state: InterfaceState::Up,
+ driver: "dummy".to_owned(),
mac: "01:23:45:67:89:ab".to_owned(),
addresses: Some(vec![
CidrAddress::new(Ipv4Addr::new(192, 168, 0, 2), 24).unwrap(),
@@ -804,6 +805,7 @@ mod tests {
name: "eth0".to_owned(),
index: 0,
state: InterfaceState::Up,
+ driver: "dummy".to_owned(),
mac: "01:23:45:67:89:ab".to_owned(),
addresses: None,
},
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 66cea72..4fda39d 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -473,6 +473,9 @@ pub struct Interface {
pub state: InterfaceState,
+ /// Kernel driver name that claims this interface.
+ pub driver: String,
+
#[serde(default)]
#[serde(deserialize_with = "deserialize_cidr_list")]
pub addresses: Option<Vec<CidrAddress>>,
--
2.51.0
More information about the pve-devel
mailing list