From: "Michael Köppl" <m.koeppl@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
Cc: "pve-devel" <pve-devel-bounces@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer 06/14] common: implement support for `network_interface_pin_map` config
Date: Tue, 21 Oct 2025 16:05:07 +0200 [thread overview]
Message-ID: <DDO22RN6LUYE.2OPWIJNY56924@proxmox.com> (raw)
In-Reply-To: <20251014132207.1171073-7-c.heiss@proxmox.com>
1 comment inline
On Tue Oct 14, 2025 at 3:21 PM CEST, Christoph Heiss wrote:
> Adds all the pieces for installer frontends to wire up pinning support,
> i.e. deserializing from the runtime environment, doing verification and
> serializing it out to the low-level installer.
>
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
> proxmox-auto-installer/src/utils.rs | 3 +-
> proxmox-installer-common/src/lib.rs | 5 +
> proxmox-installer-common/src/options.rs | 158 ++++++++++++++++++++++--
> proxmox-installer-common/src/setup.rs | 51 +++++++-
> proxmox-tui-installer/src/setup.rs | 3 +-
> 5 files changed, 203 insertions(+), 17 deletions(-)
>
> diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
> index 7d42f2c..eb666d1 100644
> --- a/proxmox-auto-installer/src/utils.rs
> +++ b/proxmox-auto-installer/src/utils.rs
> @@ -2,7 +2,7 @@ use anyhow::{Context, Result, bail};
> use glob::Pattern;
> use log::info;
> use std::{
> - collections::{BTreeMap, HashSet},
> + collections::{BTreeMap, HashMap, HashSet},
> process::Command,
> };
>
> @@ -485,6 +485,7 @@ pub fn parse_answer(
> root_ssh_keys: answer.global.root_ssh_keys.clone(),
>
> mngmt_nic: network_settings.ifname,
> + network_interface_pin_map: HashMap::new(),
>
> hostname: network_settings
> .fqdn
> diff --git a/proxmox-installer-common/src/lib.rs b/proxmox-installer-common/src/lib.rs
> index ea907a0..a85d5f8 100644
> --- a/proxmox-installer-common/src/lib.rs
> +++ b/proxmox-installer-common/src/lib.rs
> @@ -10,6 +10,11 @@ pub mod http;
> #[cfg(feature = "cli")]
> pub mod cli;
>
> +pub mod net {
> + /// Maximum length of the (primary) name of a network interface
> + pub const MAX_IFNAME_LEN: usize = 15; // IFNAMSIZ - 1 to account for NUL byte
> +}
> +
> pub const RUNTIME_DIR: &str = "/run/proxmox-installer";
>
> /// Default placeholder value for the administrator email address.
> diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
> index 59e8560..60ea227 100644
> --- a/proxmox-installer-common/src/options.rs
> +++ b/proxmox-installer-common/src/options.rs
> @@ -1,12 +1,14 @@
> use anyhow::{Result, bail};
> use regex::Regex;
> use serde::{Deserialize, Serialize};
> +use std::collections::HashMap;
> use std::net::{IpAddr, Ipv4Addr};
> use std::str::FromStr;
> use std::sync::OnceLock;
> use std::{cmp, fmt};
>
> use crate::disk_checks::check_raid_min_disks;
> +use crate::net::MAX_IFNAME_LEN;
> use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
> use crate::utils::{CidrAddress, Fqdn};
>
> @@ -476,6 +478,54 @@ impl TimezoneOptions {
> }
> }
>
> +/// Options controlling the behaviour of the network interface pinning (by
> +/// creating appropriate systemd.link files) during the installation.
> +#[derive(Clone, Debug, Default, PartialEq, Deserialize)]
> +#[serde(rename_all = "kebab-case", deny_unknown_fields)]
> +pub struct NetworkInterfacePinningOptions {
> + /// Maps MAC address to custom name
> + #[serde(default)]
> + pub mapping: HashMap<String, String>,
> +}
> +
> +impl NetworkInterfacePinningOptions {
> + /// Default prefix to prepend to the pinned interface ID as received from the low-level
> + /// installer.
> + pub const DEFAULT_PREFIX: &str = "nic";
> +
> + /// Do some basic checks on the options.
> + ///
> + /// This checks for:
> + /// - empty interface names
> + /// - overlong interface names
> + /// - duplicate interface names
imo it would make sense to additionally also have the check that the
interface name is not fully numeric, since according to the docs, this
is not allowed [0].
[0] https://manpages.debian.org/testing/udev/systemd.link.5.en.html#%5BLINK%5D_SECTION_OPTIONS
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-10-21 14:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 13:21 [pve-devel] [PATCH installer 00/14] support network interface name pinning Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 01/14] test: parse-kernel-cmdline: fix module import statement Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 02/14] install: add support for network interface name pinning Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 03/14] run env: network: add kernel driver name to network interface info Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 04/14] common: utils: fix clippy warnings Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 05/14] common: setup: simplify network address list serialization Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 06/14] common: implement support for `network_interface_pin_map` config Christoph Heiss
2025-10-21 14:05 ` Michael Köppl [this message]
2025-10-14 13:21 ` [pve-devel] [PATCH installer 07/14] auto: add support for pinning network interface names Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 08/14] assistant: verify network settings in `validate-answer` subcommand Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 09/14] post-hook: avoid redundant Option<bool> for (de-)serialization Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 10/14] post-hook: add network interface name and pinning status Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 11/14] tui: views: move network options view to own module Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 12/14] tui: views: form: allow attaching user-defined data to children Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 13/14] tui: add support for pinning network interface names Christoph Heiss
2025-10-14 13:21 ` [pve-devel] [PATCH installer 14/14] gui: " Christoph Heiss
2025-10-14 15:04 ` Maximiliano Sandoval
2025-10-16 12:01 ` Christoph Heiss
2025-10-21 14:05 ` Michael Köppl
2025-10-21 14:04 ` [pve-devel] [PATCH installer 00/14] support network interface name pinning Michael Köppl
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=DDO22RN6LUYE.2OPWIJNY56924@proxmox.com \
--to=m.koeppl@proxmox.com \
--cc=pve-devel-bounces@lists.proxmox.com \
--cc=pve-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox