From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id A3E161FF191 for ; Tue, 21 Oct 2025 16:05:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 43CA2477; Tue, 21 Oct 2025 16:05:42 +0200 (CEST) Date: Tue, 21 Oct 2025 16:05:07 +0200 Message-Id: To: "Proxmox VE development discussion" Cc: "pve-devel" From: =?utf-8?q?Michael_K=C3=B6ppl?= Mime-Version: 1.0 X-Mailer: aerc 0.21.0 References: <20251014132207.1171073-1-c.heiss@proxmox.com> <20251014132207.1171073-7-c.heiss@proxmox.com> In-Reply-To: <20251014132207.1171073-7-c.heiss@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761055501142 X-SPAM-LEVEL: Spam detection results: 0 AWL -2.470 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SOMETLD_ARE_BAD_TLD 5 .bar, .beauty, .buzz, .cam, .casa, .cfd, .club, .date, .guru, .link, .live, .monster, .online, .press, .pw, .quest, .rest, .sbs, .shop, .stream, .top, .trade, .wiki, .work, .xyz TLD abuse SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH installer 06/14] common: implement support for `network_interface_pin_map` config X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 > --- > 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, > +} > + > +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