public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-ve-rs 0/2] fix network interface name parsing
@ 2026-10-09  9:00 Stefan Hanreich
  2026-10-09  9:00 ` [PATCH proxmox-ve-rs 1/2] fix #7584: ve-config: guest: add missing network interface models Stefan Hanreich
  2026-10-09  9:00 ` [PATCH proxmox-ve-rs 2/2] ve-config: guest: add fallback enum variant Stefan Hanreich
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hanreich @ 2026-10-09  9:00 UTC (permalink / raw)
  To: pve-devel

The enum in proxmox-ve-config was missing several models that are defined in
qemu-server, which leads to failure in parsing when encountering them in the
guest configurations. Particularly, the e1000e model is used more often in
practice, as it is exposed in the UI, which lead to a few reports via different
channels.


proxmox-ve-rs:

Stefan Hanreich (2):
  fix #7584: ve-config: guest: add missing network interface models
  ve-config: guest: add fallback enum variant

 Cargo.toml                        |  1 +
 proxmox-ve-config/Cargo.toml      |  1 +
 proxmox-ve-config/src/guest/vm.rs | 48 +++++++++++++++++++++++++++++--
 3 files changed, 47 insertions(+), 3 deletions(-)


Summary over all repositories:
  3 files changed, 47 insertions(+), 3 deletions(-)

-- 
Generated by murpp 0.12.0




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

* [PATCH proxmox-ve-rs 1/2] fix #7584: ve-config: guest: add missing network interface models
  2026-10-09  9:00 [PATCH proxmox-ve-rs 0/2] fix network interface name parsing Stefan Hanreich
@ 2026-10-09  9:00 ` Stefan Hanreich
  2026-10-09  9:00 ` [PATCH proxmox-ve-rs 2/2] ve-config: guest: add fallback enum variant Stefan Hanreich
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hanreich @ 2026-10-09  9:00 UTC (permalink / raw)
  To: pve-devel

Add models defined in qemu-server to the enum that is parsing the
network interface property string. This prevents the parser from
failing to parse valid network interface names that are accepted by
the qemu-server API. In practice, the e1000e model was the most likely
culprit since it is exposed in the UI.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 proxmox-ve-config/src/guest/vm.rs | 37 ++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
index 5c3bbb86..cebcb9e6 100644
--- a/proxmox-ve-config/src/guest/vm.rs
+++ b/proxmox-ve-config/src/guest/vm.rs
@@ -22,6 +22,16 @@ pub enum NetworkDeviceModel {
     E1000,
     Vmxnet3,
     RTL8139,
+    E100082540em,
+    E100082544gc,
+    E100082545em,
+    E1000e,
+    I82551,
+    I82557b,
+    I82559er,
+    Ne2kIsa,
+    Ne2kPci,
+    Pcnet,
 }
 
 proxmox_serde::forward_deserialize_to_from_str!(NetworkDeviceModel);
@@ -36,6 +46,16 @@ impl FromStr for NetworkDeviceModel {
             "rtl8139" => Ok(NetworkDeviceModel::RTL8139),
             "vmxnet3" => Ok(NetworkDeviceModel::Vmxnet3),
             "veth" => Ok(NetworkDeviceModel::Veth),
+            "e1000-82540em" => Ok(NetworkDeviceModel::E100082540em),
+            "e1000-82544gc" => Ok(NetworkDeviceModel::E100082544gc),
+            "e1000-82545em" => Ok(NetworkDeviceModel::E100082545em),
+            "e1000e" => Ok(NetworkDeviceModel::E1000e),
+            "i82551" => Ok(NetworkDeviceModel::I82551),
+            "i82557b" => Ok(NetworkDeviceModel::I82557b),
+            "i82559er" => Ok(NetworkDeviceModel::I82559er),
+            "ne2k_isa" => Ok(NetworkDeviceModel::Ne2kIsa),
+            "ne2k_pci" => Ok(NetworkDeviceModel::Ne2kPci),
+            "pcnet" => Ok(NetworkDeviceModel::Pcnet),
             _ => bail!("Invalid network device model: {s}"),
         }
     }
@@ -79,7 +99,22 @@ impl ApiType for QemuNetworkDevice {
     .additional_properties(true)
     .key_alias_info(KeyAliasInfo::new(
         "model",
-        &sorted!(["e1000", "rtl8139", "virtio", "vmxnet3"]),
+        &sorted!([
+            "e1000",
+            "rtl8139",
+            "virtio",
+            "vmxnet3",
+            "e1000-82540em",
+            "e1000-82544gc",
+            "e1000-82545em",
+            "e1000e",
+            "i82551",
+            "i82557b",
+            "i82559er",
+            "ne2k_isa",
+            "ne2k_pci",
+            "pcnet",
+        ]),
         "macaddr",
     ))
     .schema();
-- 
2.47.3





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

* [PATCH proxmox-ve-rs 2/2] ve-config: guest: add fallback enum variant
  2026-10-09  9:00 [PATCH proxmox-ve-rs 0/2] fix network interface name parsing Stefan Hanreich
  2026-10-09  9:00 ` [PATCH proxmox-ve-rs 1/2] fix #7584: ve-config: guest: add missing network interface models Stefan Hanreich
@ 2026-10-09  9:00 ` Stefan Hanreich
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hanreich @ 2026-10-09  9:00 UTC (permalink / raw)
  To: pve-devel

In order for ve-config to stay forward-compatible with the addition of
new network interface types, introduce a fallback variant to contain
any potential unknown variants that may be introduced in the future.
Since the netX properties in qemu-server use KeyAliasInfo, and the
struct does not provide the possibility of allowing arbitrary keys,
this does not allow using arbitrary models when using the short form -
which is currently prevalent in the configuration files.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---

Notes:
    Practically not really an improvement, but I had it initially and
    thought it wouldn't hurt to include it in the series nonetheles. If
    not desired or deemed to useless, this patch can be dropped when
    applying.

 Cargo.toml                        |  1 +
 proxmox-ve-config/Cargo.toml      |  1 +
 proxmox-ve-config/src/guest/vm.rs | 11 +++++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 4655b178..2f9058dd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,7 @@ regex = "1.7"
 serde = { version = "1" }
 thiserror = "2.0.0"
 
+proxmox-fixed-string = { version = "0.1.1" }
 proxmox-frr = { version = "0.5.1", path = "proxmox-frr" }
 proxmox-network-types = { version = "1.1.2" }
 proxmox-schema = { version = "5" }
diff --git a/proxmox-ve-config/Cargo.toml b/proxmox-ve-config/Cargo.toml
index 7e3939d4..3d5aa9eb 100644
--- a/proxmox-ve-config/Cargo.toml
+++ b/proxmox-ve-config/Cargo.toml
@@ -19,6 +19,7 @@ serde = { workspace = true, features = [ "derive" ] }
 serde_json = "1"
 
 proxmox-base64 = "1"
+proxmox-fixed-string.workspace = true
 proxmox-frr = { workspace = true, optional = true }
 proxmox-network-types = { workspace = true, features = [ "api-types" ] }
 proxmox-schema = { workspace = true, features = [ "api-types" ] }
diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
index cebcb9e6..3ce04c73 100644
--- a/proxmox-ve-config/src/guest/vm.rs
+++ b/proxmox-ve-config/src/guest/vm.rs
@@ -2,7 +2,8 @@ use std::collections::BTreeMap;
 use std::io;
 use std::str::FromStr;
 
-use anyhow::{Error, bail};
+use anyhow::{Context, Error, bail};
+use proxmox_fixed_string::FixedString;
 use serde::Deserialize;
 
 use proxmox_network_types::ip_address::{Ipv4Cidr, Ipv6Cidr};
@@ -32,6 +33,7 @@ pub enum NetworkDeviceModel {
     Ne2kIsa,
     Ne2kPci,
     Pcnet,
+    UnknownEnumValue(FixedString),
 }
 
 proxmox_serde::forward_deserialize_to_from_str!(NetworkDeviceModel);
@@ -56,7 +58,12 @@ impl FromStr for NetworkDeviceModel {
             "ne2k_isa" => Ok(NetworkDeviceModel::Ne2kIsa),
             "ne2k_pci" => Ok(NetworkDeviceModel::Ne2kPci),
             "pcnet" => Ok(NetworkDeviceModel::Pcnet),
-            _ => bail!("Invalid network device model: {s}"),
+            _ => {
+                let unknown_variant = FixedString::try_from(s)
+                    .with_context(|| format!("unable to parse network device model {s}"))?;
+
+                Ok(NetworkDeviceModel::UnknownEnumValue(unknown_variant))
+            }
         }
     }
 }
-- 
2.47.3





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

end of thread, other threads:[~2026-10-09  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  9:00 [PATCH proxmox-ve-rs 0/2] fix network interface name parsing Stefan Hanreich
2026-10-09  9:00 ` [PATCH proxmox-ve-rs 1/2] fix #7584: ve-config: guest: add missing network interface models Stefan Hanreich
2026-10-09  9:00 ` [PATCH proxmox-ve-rs 2/2] ve-config: guest: add fallback enum variant Stefan Hanreich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal