* Re: [pve-devel] [PATCH installer 1/1] fix #2164: add option to define a vlan tag within the installer
[not found] <3978889E-73FA-4473-A70B-2C660662CC3D@credativ.de>
@ 2025-09-23 12:07 12% ` Christoph Heiss
2025-09-24 8:48 8% ` Aaron Lauterer
0 siblings, 1 reply; 14+ results
From: Christoph Heiss @ 2025-09-23 12:07 UTC (permalink / raw)
To: Florian Paul Azim Hoberg; +Cc: pve-devel
The subject should be rephrased to e.g. "partially fix #2164", as the
Bugzilla entry also mentions setting up bonds.
Didn't do any testing yet, but some comments inline:
On Mon Sep 22, 2025 at 2:30 PM CEST, Florian Paul Azim Hoberg wrote:
> To ensure a Promox node can access a desired network
> resource which requires a given vlan tag, this feature
> adds the possibility to optionally define a vlan tag
> within the auto installer, tui and gui.
s/this feature adds/add/g
Also could mention that it only applies to the selected management
interface/bridge.
>
> Signed-off-by: Florian Paul Azim Hoberg @gyptazy <florian.hoberg@credativ.de>
> ---
>
> initial commit:
> * Add possibility to optionally add vlan tag in:
> - auto installer
> - tui
> - gui
> * Tagged interface will be generated as:
> $interface.$tag in /etc/network/interfaces
> * Simple validation of given vlan tag:
> - Must be digit
> - Must be smaller than int(4094)
That can all be part of the commit message, as that is useful
information.
[..]
> diff --git a/html/ack_template.htm b/html/ack_template.htm
> index 48d7213..4404321 100644
> --- a/html/ack_template.htm
> +++ b/html/ack_template.htm
> @@ -54,6 +54,8 @@
>
> <tr><td>Management Interface:</td> <td>__interface__</td></tr>
>
> + <tr><td>Management Interface vlan tag:</td> <td>__vlan__</td></tr>
VLAN should be consistently spelled uppercase everywhere user-visible.
Also; wondering if we maybe should just hide this if no VLAN tag is set,
no not clutter the summary page unnecessarily?
> +
> <tr><td>Hostname:</td> <td>__hostname__</td></tr>
>
> <tr><td>IP CIDR:</td> <td>__cidr__</td></tr>
> diff --git a/proxinstall b/proxinstall
> index 5ba65fa..13ece1d 100755
> --- a/proxinstall
> +++ b/proxinstall
> @@ -472,6 +472,14 @@ sub create_ipconf_view {
> $grid->attach($dns_label, 0, 4, 1, 1);
> $grid->attach($ipconf_entry_dns, 1, 4, 1, 1);
>
> + my $cfg_vlan = Proxmox::Install::Config::get_vlan();
> + my $vlan = defined($cfg_vlan) ? $cfg_vlan : '';
Can be simplified to
my $cfg_vlan = Proxmox::Install::Config::get_vlan() // '';
> +
> + my ($vlan_label, $ipconf_entry_vlan) = create_text_input($vlan, 'VLAN Tag (Optional)');
> +
> + $grid->attach($vlan_label, 0, 5, 1, 1);
> + $grid->attach($ipconf_entry_vlan, 1, 5, 1, 1);
> +
> $gtk_state->{inbox}->show_all;
> set_next(
> undef,
> @@ -538,7 +546,19 @@ sub create_ipconf_view {
> }
> Proxmox::Install::Config::set_dns($dns_ip);
>
> - #print STDERR "TEST $ipaddress/$netmask $gateway_ip $dns_ip\n";
> + my $vlan = $ipconf_entry_vlan->get_text();
> + if ($vlan !~ /^\d*$/) {
> + Proxmox::UI::message("VLAN must contain only digits.");
> + $ipconf_entry_vlan->grab_focus();
> + return;
> + }
> + if ($vlan ne '' && $vlan >= 4094) {
> + Proxmox::UI::message("VLAN must be smaller than 4094.");
> + $ipconf_entry_vlan->grab_focus();
> + return;
> + }
Should also check for 0, as that is also a reserved value.
> + $vlan = undef if $vlan eq '';
> + Proxmox::Install::Config::set_vlan($vlan);
>
> $step_number++;
> create_ack_view();
> @@ -585,6 +605,7 @@ sub create_ack_view {
> __cidr__ => Proxmox::Install::Config::get_cidr(),
> __gateway__ => Proxmox::Install::Config::get_gateway(),
> __dnsserver__ => Proxmox::Install::Config::get_dns(),
> + __vlan__ => Proxmox::Install::Config::get_vlan(),
Depending on above, whether to hide it if unset or not, in the latter
case this should at least default to 'None' as in the TUI.
> );
>
> while (my ($k, $v) = each %config_values) {
> diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
> index 88f4c87..cea5cb1 100644
> --- a/proxmox-auto-installer/src/answer.rs
> +++ b/proxmox-auto-installer/src/answer.rs
> @@ -186,6 +186,7 @@ struct NetworkInAnswer {
> pub cidr: Option<CidrAddress>,
> pub dns: Option<IpAddr>,
> pub gateway: Option<IpAddr>,
> + pub vlan: Option<u16>,
> #[serde(default)]
> pub filter: BTreeMap<String, String>,
> }
> @@ -219,6 +220,7 @@ impl TryFrom<NetworkInAnswer> for Network {
> cidr: network.cidr.unwrap(),
> dns: network.dns.unwrap(),
> gateway: network.gateway.unwrap(),
> + vlan: network.vlan,
Before setting this, the same check as for the GUI/TUI can be
implemented above.
And it's missing the check that `vlan` is unset as with the other
properties below in the DHCP case.
> filter: network.filter,
> }),
> })
> @@ -254,6 +256,7 @@ pub struct NetworkManual {
> pub cidr: CidrAddress,
> pub dns: IpAddr,
> pub gateway: IpAddr,
> + pub vlan: Option<u16>,
> pub filter: BTreeMap<String, String>,
> }
>
> diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
> index 7d42f2c..2fdb6df 100644
> --- a/proxmox-auto-installer/src/utils.rs
> +++ b/proxmox-auto-installer/src/utils.rs
> @@ -66,6 +66,7 @@ fn get_network_settings(
> network_options.address = settings.cidr.clone();
> network_options.dns_server = settings.dns;
> network_options.gateway = settings.gateway;
> + network_options.vlan = settings.vlan;
> network_options.ifname = get_single_udev_index(&settings.filter, &udev_info.nics)?;
> }
> info!("Network interface used is '{}'", &network_options.ifname);
> @@ -494,6 +495,7 @@ pub fn parse_answer(
> domain: network_settings.fqdn.domain(),
> cidr: network_settings.address,
> gateway: network_settings.gateway,
> + vlan: network_settings.vlan,
> dns: network_settings.dns_server,
>
> first_boot: InstallFirstBootSetup::default(),
[..]
> diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
> new file mode 100644
> index 0000000..fad56c6
> --- /dev/null
> +++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
> @@ -0,0 +1,19 @@
> +[global]
> +keyboard = "de"
> +country = "at"
> +fqdn = "pveauto.testinstall"
> +mailto = "mail@no.invalid"
> +timezone = "Europe/Vienna"
> +root-password = "12345678"
> +
> +[network]
> +source = "from-answer"
> +cidr = "10.10.10.10/24"
> +dns = "10.10.10.1"
> +vlan = 123
> +gateway = "10.10.10.1"
> +filter.ID_NET_NAME = "enp129s0f1np1"
> +
> +[disk-setup]
> +filesystem = "ext4"
> +disk-list = ["sda"]
[..]
> diff --git a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
> index 901f894..723dfc8 100644
> --- a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
> +++ b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
> @@ -10,6 +10,7 @@ root-password = "12345678"
> source = "from-answer"
> cidr = "10.10.10.10/24"
> dns = "10.10.10.1"
> +vlan = 123
Any reason for adding it to this test too, as the `network_vlan` test
above seems to be the exact same?
> gateway = "10.10.10.1"
> filter.ID_NET_NAME_MAC = "*a0369f0ab382"
>
[..]
> diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
> index 66cea72..23e43d2 100644
> --- a/proxmox-installer-common/src/setup.rs
> +++ b/proxmox-installer-common/src/setup.rs
> @@ -580,6 +580,7 @@ pub struct InstallConfig {
> #[serde(serialize_with = "serialize_as_display")]
> pub cidr: CidrAddress,
> pub gateway: IpAddr,
> + pub vlan: Option<u16>,
Should be annotated with
#[serde(skip_serializing_if = "Option::is_none")]
to avoid serializing it as `null` if unset.
> pub dns: IpAddr,
>
> pub first_boot: InstallFirstBootSetup,
> diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
> index 15ee5d3..21ef16f 100644
> --- a/proxmox-tui-installer/src/main.rs
> +++ b/proxmox-tui-installer/src/main.rs
[..]
> @@ -552,6 +560,23 @@ fn network_dialog(siv: &mut Cursive) -> InstallerView {
> .parse::<IpAddr>()
> .map_err(|err| err.to_string())?;
>
> + let vlan_str = view
> + .get_value::<EditView, _>(5)
> + .ok_or("failed to retrieve VLAN")?;
> +
> + let vlan = if vlan_str.trim().is_empty() {
> + None
> + } else {
> + let parsed_vlan = vlan_str.trim().parse::<u16>()
> + .map_err(|e| format!("Invalid VLAN: {e}"))?;
> +
> + if parsed_vlan >= 4094 {
> + return Err(format!("VLAN must be smaller than 4094."));
> + }
Same tag 0 check as for the GUI.
[..]
> diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
> index c80877f..c59712e 100644
> --- a/proxmox-tui-installer/src/options.rs
> +++ b/proxmox-tui-installer/src/options.rs
> @@ -72,6 +72,7 @@ impl InstallerOptions {
> SummaryOption::new("Keyboard layout", kb_layout),
> SummaryOption::new("Administrator email", &self.password.email),
> SummaryOption::new("Management interface", &self.network.ifname),
> + SummaryOption::new("Management interface vlan tag", &self.network.vlan.map(|v| v.to_string()).unwrap_or("None".to_string())),
Uppercase spelling as in the GUI.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [relevance 12%]
* Re: [pve-devel] [PATCH installer 1/1] fix #2164: add option to define a vlan tag within the installer
2025-09-23 12:07 12% ` [pve-devel] [PATCH installer 1/1] fix #2164: add option to define a vlan tag within the installer Christoph Heiss
@ 2025-09-24 8:48 8% ` Aaron Lauterer
0 siblings, 0 replies; 14+ results
From: Aaron Lauterer @ 2025-09-24 8:48 UTC (permalink / raw)
To: Proxmox VE development discussion, Christoph Heiss,
Florian Paul Azim Hoberg
Thanks for working on this. One more comment from my side.
Since the default network configs are often used as a guideline by our
users, they should reflect best practices.
Instead of the dot notation, I would prefer the vlan-raw-device, vlan-id
variant. This allows us to give the interface a name that matches the
use, and the whole config is more explicit.
The final config could look like this:
auto management
iface management inet static
address {host ip}/{cidr}
gateway {gateway ip}
vlan-id {vlan tag}
vlan-raw-device {physical nic}
#Management interface
On 2025-09-23 14:08, Christoph Heiss wrote:
> The subject should be rephrased to e.g. "partially fix #2164", as the
> Bugzilla entry also mentions setting up bonds.
>
> Didn't do any testing yet, but some comments inline:
>
> On Mon Sep 22, 2025 at 2:30 PM CEST, Florian Paul Azim Hoberg wrote:
>> To ensure a Promox node can access a desired network
>> resource which requires a given vlan tag, this feature
>> adds the possibility to optionally define a vlan tag
>> within the auto installer, tui and gui.
>
> s/this feature adds/add/g
>
> Also could mention that it only applies to the selected management
> interface/bridge.
>
>>
>> Signed-off-by: Florian Paul Azim Hoberg @gyptazy <florian.hoberg@credativ.de>
>> ---
>>
>> initial commit:
>> * Add possibility to optionally add vlan tag in:
>> - auto installer
>> - tui
>> - gui
>> * Tagged interface will be generated as:
>> $interface.$tag in /etc/network/interfaces
>> * Simple validation of given vlan tag:
>> - Must be digit
>> - Must be smaller than int(4094)
>
> That can all be part of the commit message, as that is useful
> information.
>
> [..]
>> diff --git a/html/ack_template.htm b/html/ack_template.htm
>> index 48d7213..4404321 100644
>> --- a/html/ack_template.htm
>> +++ b/html/ack_template.htm
>> @@ -54,6 +54,8 @@
>>
>> <tr><td>Management Interface:</td> <td>__interface__</td></tr>
>>
>> + <tr><td>Management Interface vlan tag:</td> <td>__vlan__</td></tr>
>
> VLAN should be consistently spelled uppercase everywhere user-visible.
>
> Also; wondering if we maybe should just hide this if no VLAN tag is set,
> no not clutter the summary page unnecessarily?
>
>> +
>> <tr><td>Hostname:</td> <td>__hostname__</td></tr>
>>
>> <tr><td>IP CIDR:</td> <td>__cidr__</td></tr>
>> diff --git a/proxinstall b/proxinstall
>> index 5ba65fa..13ece1d 100755
>> --- a/proxinstall
>> +++ b/proxinstall
>> @@ -472,6 +472,14 @@ sub create_ipconf_view {
>> $grid->attach($dns_label, 0, 4, 1, 1);
>> $grid->attach($ipconf_entry_dns, 1, 4, 1, 1);
>>
>> + my $cfg_vlan = Proxmox::Install::Config::get_vlan();
>> + my $vlan = defined($cfg_vlan) ? $cfg_vlan : '';
>
> Can be simplified to
>
> my $cfg_vlan = Proxmox::Install::Config::get_vlan() // '';
>
>> +
>> + my ($vlan_label, $ipconf_entry_vlan) = create_text_input($vlan, 'VLAN Tag (Optional)');
>> +
>> + $grid->attach($vlan_label, 0, 5, 1, 1);
>> + $grid->attach($ipconf_entry_vlan, 1, 5, 1, 1);
>> +
>> $gtk_state->{inbox}->show_all;
>> set_next(
>> undef,
>> @@ -538,7 +546,19 @@ sub create_ipconf_view {
>> }
>> Proxmox::Install::Config::set_dns($dns_ip);
>>
>> - #print STDERR "TEST $ipaddress/$netmask $gateway_ip $dns_ip\n";
>> + my $vlan = $ipconf_entry_vlan->get_text();
>> + if ($vlan !~ /^\d*$/) {
>> + Proxmox::UI::message("VLAN must contain only digits.");
>> + $ipconf_entry_vlan->grab_focus();
>> + return;
>> + }
>> + if ($vlan ne '' && $vlan >= 4094) {
>> + Proxmox::UI::message("VLAN must be smaller than 4094.");
>> + $ipconf_entry_vlan->grab_focus();
>> + return;
>> + }
>
> Should also check for 0, as that is also a reserved value.
>
>> + $vlan = undef if $vlan eq '';
>> + Proxmox::Install::Config::set_vlan($vlan);
>>
>> $step_number++;
>> create_ack_view();
>> @@ -585,6 +605,7 @@ sub create_ack_view {
>> __cidr__ => Proxmox::Install::Config::get_cidr(),
>> __gateway__ => Proxmox::Install::Config::get_gateway(),
>> __dnsserver__ => Proxmox::Install::Config::get_dns(),
>> + __vlan__ => Proxmox::Install::Config::get_vlan(),
>
> Depending on above, whether to hide it if unset or not, in the latter
> case this should at least default to 'None' as in the TUI.
>
>> );
>>
>> while (my ($k, $v) = each %config_values) {
>> diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
>> index 88f4c87..cea5cb1 100644
>> --- a/proxmox-auto-installer/src/answer.rs
>> +++ b/proxmox-auto-installer/src/answer.rs
>> @@ -186,6 +186,7 @@ struct NetworkInAnswer {
>> pub cidr: Option<CidrAddress>,
>> pub dns: Option<IpAddr>,
>> pub gateway: Option<IpAddr>,
>> + pub vlan: Option<u16>,
>> #[serde(default)]
>> pub filter: BTreeMap<String, String>,
>> }
>> @@ -219,6 +220,7 @@ impl TryFrom<NetworkInAnswer> for Network {
>> cidr: network.cidr.unwrap(),
>> dns: network.dns.unwrap(),
>> gateway: network.gateway.unwrap(),
>> + vlan: network.vlan,
>
> Before setting this, the same check as for the GUI/TUI can be
> implemented above.
>
> And it's missing the check that `vlan` is unset as with the other
> properties below in the DHCP case.
>
>> filter: network.filter,
>> }),
>> })
>> @@ -254,6 +256,7 @@ pub struct NetworkManual {
>> pub cidr: CidrAddress,
>> pub dns: IpAddr,
>> pub gateway: IpAddr,
>> + pub vlan: Option<u16>,
>> pub filter: BTreeMap<String, String>,
>> }
>>
>> diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
>> index 7d42f2c..2fdb6df 100644
>> --- a/proxmox-auto-installer/src/utils.rs
>> +++ b/proxmox-auto-installer/src/utils.rs
>> @@ -66,6 +66,7 @@ fn get_network_settings(
>> network_options.address = settings.cidr.clone();
>> network_options.dns_server = settings.dns;
>> network_options.gateway = settings.gateway;
>> + network_options.vlan = settings.vlan;
>> network_options.ifname = get_single_udev_index(&settings.filter, &udev_info.nics)?;
>> }
>> info!("Network interface used is '{}'", &network_options.ifname);
>> @@ -494,6 +495,7 @@ pub fn parse_answer(
>> domain: network_settings.fqdn.domain(),
>> cidr: network_settings.address,
>> gateway: network_settings.gateway,
>> + vlan: network_settings.vlan,
>> dns: network_settings.dns_server,
>>
>> first_boot: InstallFirstBootSetup::default(),
> [..]
>> diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
>> new file mode 100644
>> index 0000000..fad56c6
>> --- /dev/null
>> +++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
>> @@ -0,0 +1,19 @@
>> +[global]
>> +keyboard = "de"
>> +country = "at"
>> +fqdn = "pveauto.testinstall"
>> +mailto = "mail@no.invalid"
>> +timezone = "Europe/Vienna"
>> +root-password = "12345678"
>> +
>> +[network]
>> +source = "from-answer"
>> +cidr = "10.10.10.10/24"
>> +dns = "10.10.10.1"
>> +vlan = 123
>> +gateway = "10.10.10.1"
>> +filter.ID_NET_NAME = "enp129s0f1np1"
>> +
>> +[disk-setup]
>> +filesystem = "ext4"
>> +disk-list = ["sda"]
> [..]
>> diff --git a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
>> index 901f894..723dfc8 100644
>> --- a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
>> +++ b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.toml
>> @@ -10,6 +10,7 @@ root-password = "12345678"
>> source = "from-answer"
>> cidr = "10.10.10.10/24"
>> dns = "10.10.10.1"
>> +vlan = 123
>
> Any reason for adding it to this test too, as the `network_vlan` test
> above seems to be the exact same?
>
>> gateway = "10.10.10.1"
>> filter.ID_NET_NAME_MAC = "*a0369f0ab382"
>>
> [..]
>> diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
>> index 66cea72..23e43d2 100644
>> --- a/proxmox-installer-common/src/setup.rs
>> +++ b/proxmox-installer-common/src/setup.rs
>> @@ -580,6 +580,7 @@ pub struct InstallConfig {
>> #[serde(serialize_with = "serialize_as_display")]
>> pub cidr: CidrAddress,
>> pub gateway: IpAddr,
>> + pub vlan: Option<u16>,
>
> Should be annotated with
>
> #[serde(skip_serializing_if = "Option::is_none")]
>
> to avoid serializing it as `null` if unset.
>
>> pub dns: IpAddr,
>>
>> pub first_boot: InstallFirstBootSetup,
>> diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
>> index 15ee5d3..21ef16f 100644
>> --- a/proxmox-tui-installer/src/main.rs
>> +++ b/proxmox-tui-installer/src/main.rs
> [..]
>> @@ -552,6 +560,23 @@ fn network_dialog(siv: &mut Cursive) -> InstallerView {
>> .parse::<IpAddr>()
>> .map_err(|err| err.to_string())?;
>>
>> + let vlan_str = view
>> + .get_value::<EditView, _>(5)
>> + .ok_or("failed to retrieve VLAN")?;
>> +
>> + let vlan = if vlan_str.trim().is_empty() {
>> + None
>> + } else {
>> + let parsed_vlan = vlan_str.trim().parse::<u16>()
>> + .map_err(|e| format!("Invalid VLAN: {e}"))?;
>> +
>> + if parsed_vlan >= 4094 {
>> + return Err(format!("VLAN must be smaller than 4094."));
>> + }
>
> Same tag 0 check as for the GUI.
>
> [..]
>> diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
>> index c80877f..c59712e 100644
>> --- a/proxmox-tui-installer/src/options.rs
>> +++ b/proxmox-tui-installer/src/options.rs
>> @@ -72,6 +72,7 @@ impl InstallerOptions {
>> SummaryOption::new("Keyboard layout", kb_layout),
>> SummaryOption::new("Administrator email", &self.password.email),
>> SummaryOption::new("Management interface", &self.network.ifname),
>> + SummaryOption::new("Management interface vlan tag", &self.network.vlan.map(|v| v.to_string()).unwrap_or("None".to_string())),
>
> Uppercase spelling as in the GUI.
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [relevance 8%]
* [PATCH installer 11/15] auto: pass trough management network bond options to low-level installer
@ 2026-09-08 10:16 20% ` Christoph Heiss
0 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-09-08 10:16 UTC (permalink / raw)
To: pve-devel
Partially fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a management bond:
[network.bond]
members = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
This then just passes through the given bond options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message that bonding is enabled.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Cargo.toml | 2 +
debian/control | 1 +
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 38 ++++++++++++++++++-
proxmox-auto-installer/tests/parse-answer.rs | 7 +++-
.../tests/resources/parse_answer/btrfs.json | 5 +++
.../btrfs_raid_level_uppercase.json | 5 +++
.../resources/parse_answer/disk_match.json | 5 +++
.../parse_answer/disk_match_all.json | 5 +++
.../parse_answer/disk_match_any.json | 5 +++
.../resources/parse_answer/first_boot.json | 5 +++
.../parse_answer/fqdn_from_dhcp.json | 5 +++
...n_from_dhcp_empty_dhcp_domain_setting.json | 5 +++
...cp_no_dhcp_domain_with_default_domain.json | 5 +++
...ll_fqdn_from_dhcp_with_default_domain.json | 5 +++
.../parse_answer/hashed_root_password.json | 5 +++
.../tests/resources/parse_answer/minimal.json | 5 +++
.../resources/parse_answer/network_bond.json | 25 ++++++++++++
.../resources/parse_answer/network_bond.toml | 20 ++++++++++
.../network_interface_pinning.json | 5 +++
...face_pinning_mixed_case_mac_addresses.json | 5 +++
.../resources/parse_answer/nic_matching.json | 5 +++
.../resources/parse_answer/no_network.json | 5 +++
.../resources/parse_answer/specific_nic.json | 5 +++
.../tests/resources/parse_answer/zfs.json | 5 +++
.../zfs_raid_level_uppercase.json | 5 +++
.../network_bond_invalid_hash_policy.json | 3 ++
.../network_bond_invalid_hash_policy.toml | 20 ++++++++++
.../network_bond_invalid_mode.json | 3 ++
.../network_bond_invalid_mode.toml | 18 +++++++++
.../network_bond_primary_not_member.json | 3 ++
.../network_bond_primary_not_member.toml | 19 ++++++++++
.../network_bond_single_interface.json | 3 ++
.../network_bond_single_interface.toml | 18 +++++++++
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 38 +++++++++++++------
proxmox-installer-common/src/setup.rs | 10 ++++-
37 files changed, 310 insertions(+), 15 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
diff --git a/Cargo.toml b/Cargo.toml
index 335fb58..3849ed3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,6 +27,7 @@ serde_plain = "1.0"
toml = "0.8"
proxmox-auto-installer.path = "./proxmox-auto-installer"
proxmox-installer-common.path = "./proxmox-installer-common"
+proxmox-network-api = "1.0"
proxmox-network-types = "1.1"
proxmox-installer-types = { version = "0.2", features = ["legacy"] }
@@ -34,4 +35,5 @@ proxmox-installer-types = { version = "0.2", features = ["legacy"] }
# NOTE: You must run `cargo update` after changing this for it to take effect!
[patch.crates-io]
# proxmox-network-types.path = "../proxmox/proxmox-network-types"
+# proxmox-installer-api.path = "../proxmox/proxmox-installer-api"
# proxmox-installer-types.path = "../proxmox/proxmox-installer-types"
diff --git a/debian/control b/debian/control
index a1d648f..75bbefd 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Build-Depends: cargo:native,
librust-pico-args-0.5-dev,
librust-pretty-assertions-1.4-dev,
librust-proxmox-installer-types-0.2+legacy-dev (>= 0.1.1-~~),
+ librust-proxmox-network-api-1-dev,
librust-proxmox-network-types-1-dev (>= 1.1-~~),
librust-proxmox-sys+crypt-dev,
librust-regex-1+default-dev (>= 1.7~~),
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 5ef2f4f..b7ca85d 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -15,6 +15,7 @@ anyhow.workspace = true
log.workspace = true
proxmox-installer-common = { workspace = true, features = ["http"] }
proxmox-network-types.workspace = true
+proxmox-network-api.workspace = true
proxmox-installer-types.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 7205ae3..aa8a0fd 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -11,7 +11,7 @@ use proxmox_installer_types::{
answer::{
AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
- NetworkConfig,
+ NetworkBondOptions, NetworkConfig,
},
};
@@ -48,6 +48,7 @@ fn get_network_settings(
&runtime_info.network,
None,
pinning_opts.as_ref(),
+ answer.network.bond(),
);
opts.fqdn = name.to_owned();
opts
@@ -76,6 +77,7 @@ fn get_network_settings(
&runtime_info.network,
domain.as_deref(),
pinning_opts.as_ref(),
+ answer.network.bond(),
)
}
};
@@ -92,6 +94,33 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.bond_opts {
+ let members = opts.members.iter().fold(String::new(), |acc, mac| {
+ // Resolve either to the pinned name, if enabled, otherwise to the kernel-assigned one.
+ let name = network_options
+ .pinning_opts
+ .as_ref()
+ .and_then(|o| o.mapping.get(mac).cloned())
+ .or_else(|| {
+ runtime_info
+ .network
+ .interfaces
+ .iter()
+ .find_map(|(_, iface)| (iface.mac == *mac).then_some(iface.name.to_owned()))
+ })
+ .unwrap_or("<unknown>".to_owned());
+
+ if acc.is_empty() {
+ name
+ } else {
+ format!("{acc}, {name}")
+ }
+ });
+
+ info!("Network interface bonding enabled on: {members}");
+ opts.verify()?;
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -493,6 +522,10 @@ pub fn verify_network_settings(
}
}
+ if let Some(opts) = network.bond() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -552,6 +585,9 @@ pub fn parse_answer(
subscription_key: answer.global.subscription_key.clone(),
mngmt_nic: network_settings.ifname,
+ mngmt_bond: network_settings
+ .bond_opts
+ .unwrap_or_else(NetworkBondOptions::disabled),
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index ae5b87d..0320bba 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -127,6 +127,7 @@ mod tests {
full_fqdn_from_dhcp_with_default_domain,
hashed_root_password,
minimal,
+ network_bond,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
nic_matching,
@@ -150,11 +151,15 @@ mod tests {
fqdn_hostname_only,
ipv4_and_subnet_mask_33,
lvm_swapsize_greater_than_hdsize,
+ network_bond_invalid_hash_policy,
+ network_bond_invalid_mode,
+ network_bond_primary_not_member,
+ network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
- zfs_raid_single_disk
+ zfs_raid_single_disk,
);
}
}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json b/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
index 0c1f032..ce27d41 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"btrfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
index cb6711c..cc0bbe9 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"btrfs_opts": { "compress": "off" },
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
index d5ffddd..0c13325 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
@@ -18,6 +18,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
index 78a5e0c..4f2150d 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
@@ -15,6 +15,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
index 2e65fce..5adb9c6 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
@@ -22,6 +22,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
index fafde51..e3012a8 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
index 5ec6656..3424487 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
index 5ec6656..3424487 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
index 7ed46a2..78e32a7 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json b/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
index 7ed46a2..78e32a7 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json b/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
index 4e049bd..e3bf44f 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": {
"hashed": "$y$j9T$VgMv8lsz/TEvzesCZU3xD.$SK.h4QW51Jr/EmjuaTz5Bt4kYiX2Iezz6omzoqVEwj9"
},
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/minimal.json b/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
index 0339dbc..1262832 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
new file mode 100644
index 0000000..cf0aa98
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
@@ -0,0 +1,25 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
new file mode 100644
index 0000000..dc6b7b0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
index 76723c8..42bc5a3 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "mgmt",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"network_interface_pin_map": {
"1c:34:da:5c:5e:24": "nic2",
"1c:34:da:5c:5e:25": "nic3",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
index 76723c8..42bc5a3 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "mgmt",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"network_interface_pin_map": {
"1c:34:da:5c:5e:24": "nic2",
"1c:34:da:5c:5e:25": "nic3",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
index 5d707c4..defcfa5 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "enp65s0f0",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/no_network.json b/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
index de5f263..1bc3567 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json b/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
index 49240b4..bd4a459 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "enp129s0f1np1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs.json b/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
index 622f6d6..149588f 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
index 46b8344..99ac240 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
@@ -17,6 +17,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
new file mode 100644
index 0000000..b76c9d6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `vlan+srcmac`, expected one of `layer2`, `layer2+3`, `layer3+4`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
new file mode 100644
index 0000000..af2789b
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "vlan+srcmac"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
new file mode 100644
index 0000000..95461dc
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `non-existent-mode`, expected one of `balance-rr`, `active-backup`, `balance-xor`, `broadcast`, `802.3ad`, `balance-tlb`, `balance-alb`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
new file mode 100644
index 0000000..79695da
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "non-existent-mode"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
new file mode 100644
index 0000000..7e64e92
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
@@ -0,0 +1,3 @@
+{
+ "error": "primary bond interface B4:2E:99:AC:AD:B6 must be a member of the bond (members: B4:2E:99:AC:AD:B4, B4:2E:99:AC:AD:B5)"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
new file mode 100644
index 0000000..fab400a
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
@@ -0,0 +1,19 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+primary-interface = "b4:2e:99:ac:ad:b6"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
new file mode 100644
index 0000000..730fad6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
@@ -0,0 +1,3 @@
+{
+ "error": "bond setup requires at least 2 interfaces, got 1"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
new file mode 100644
index 0000000..b035cef
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4"]
+mode = "balance-rr"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/Cargo.toml b/proxmox-installer-common/Cargo.toml
index 7682680..a283094 100644
--- a/proxmox-installer-common/Cargo.toml
+++ b/proxmox-installer-common/Cargo.toml
@@ -13,6 +13,7 @@ regex.workspace = true
serde = { workspace = true, features = [ "derive" ] }
serde_json.workspace = true
serde_plain.workspace = true
+proxmox-network-api.workspace = true
proxmox-network-types.workspace = true
proxmox-installer-types.workspace = true
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index fbbfe77..1add63b 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -15,8 +15,8 @@ use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
- BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkInterfacePinningOptionsAnswer,
- ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
+ NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -395,6 +395,7 @@ pub struct NetworkOptions {
pub gateway: IpAddr,
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
+ pub bond_opts: Option<NetworkBondOptions>,
}
impl NetworkOptions {
@@ -405,6 +406,7 @@ impl NetworkOptions {
network: &NetworkInfo,
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
+ bond_opts: Option<&NetworkBondOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -417,6 +419,7 @@ impl NetworkOptions {
gateway: Ipv4Addr::new(192, 168, 100, 1).into(),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
+ bond_opts: bond_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -479,6 +482,10 @@ impl NetworkOptions {
}
}
+ if this.bond_opts.is_some() {
+ this.ifname = "bond0".to_owned();
+ }
+
this
}
@@ -632,7 +639,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -640,12 +647,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -653,12 +661,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -666,12 +675,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -679,6 +689,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -726,7 +737,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -734,6 +745,7 @@ mod tests {
gateway: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1)),
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -743,7 +755,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -751,12 +763,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -764,12 +777,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -777,6 +791,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -813,7 +828,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -821,6 +836,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 100, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 14882bc..139d276 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -16,7 +16,10 @@ use crate::options::{
};
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
- answer::{BtrfsCompressOption, FilesystemType, ZfsChecksumOption, ZfsCompressOption},
+ answer::{
+ BtrfsCompressOption, FilesystemType, NetworkBondOptions, ZfsChecksumOption,
+ ZfsCompressOption,
+ },
};
use proxmox_network_types::{Cidr, MacAddress};
@@ -326,7 +329,8 @@ pub struct NetworkInfo {
pub dns: Dns,
pub routes: Routes,
- /// Maps devices to their configuration, if it has a usable configuration.
+ /// Maps devices to their configuration, if it has a usable configuration, keyed by their
+ /// kernel-assigned interface name.
/// (Contains no entries for devices with only link-local addresses.)
#[serde(default)]
pub interfaces: BTreeMap<String, Interface>,
@@ -530,6 +534,8 @@ pub struct InstallConfig {
pub subscription_key: Option<String>,
pub mngmt_nic: String,
+ pub mngmt_bond: NetworkBondOptions,
+
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
#[serde(
--
2.55.0
^ permalink raw reply related [relevance 20%]
* [PATCH installer 11/15] auto: pass trough management network bond options to low-level installer
@ 2026-10-20 11:23 20% ` Christoph Heiss
0 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-10-20 11:23 UTC (permalink / raw)
To: pve-devel
Partially fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a management bond:
[network.bond]
members = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
This then just passes through the given bond options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message that bonding is enabled.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
* no changes
Cargo.toml | 2 +
debian/control | 1 +
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 38 ++++++++++++++++++-
proxmox-auto-installer/tests/parse-answer.rs | 7 +++-
.../tests/resources/parse_answer/btrfs.json | 5 +++
.../btrfs_raid_level_uppercase.json | 5 +++
.../resources/parse_answer/disk_match.json | 5 +++
.../parse_answer/disk_match_all.json | 5 +++
.../parse_answer/disk_match_any.json | 5 +++
.../resources/parse_answer/first_boot.json | 5 +++
.../parse_answer/fqdn_from_dhcp.json | 5 +++
...n_from_dhcp_empty_dhcp_domain_setting.json | 5 +++
...cp_no_dhcp_domain_with_default_domain.json | 5 +++
...ll_fqdn_from_dhcp_with_default_domain.json | 5 +++
.../parse_answer/hashed_root_password.json | 5 +++
.../tests/resources/parse_answer/minimal.json | 5 +++
.../resources/parse_answer/network_bond.json | 25 ++++++++++++
.../resources/parse_answer/network_bond.toml | 20 ++++++++++
.../network_interface_pinning.json | 5 +++
...face_pinning_mixed_case_mac_addresses.json | 5 +++
.../resources/parse_answer/nic_matching.json | 5 +++
.../resources/parse_answer/no_network.json | 5 +++
.../resources/parse_answer/specific_nic.json | 5 +++
.../tests/resources/parse_answer/zfs.json | 5 +++
.../zfs_raid_level_uppercase.json | 5 +++
.../network_bond_invalid_hash_policy.json | 3 ++
.../network_bond_invalid_hash_policy.toml | 20 ++++++++++
.../network_bond_invalid_mode.json | 3 ++
.../network_bond_invalid_mode.toml | 18 +++++++++
.../network_bond_primary_not_member.json | 3 ++
.../network_bond_primary_not_member.toml | 19 ++++++++++
.../network_bond_single_interface.json | 3 ++
.../network_bond_single_interface.toml | 18 +++++++++
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 38 +++++++++++++------
proxmox-installer-common/src/setup.rs | 10 ++++-
37 files changed, 310 insertions(+), 15 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
diff --git a/Cargo.toml b/Cargo.toml
index cda950c..d020dbc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,6 +27,7 @@ serde_plain = "1.0"
toml = "0.8"
proxmox-auto-installer.path = "./proxmox-auto-installer"
proxmox-installer-common.path = "./proxmox-installer-common"
+proxmox-network-api = "1.0"
proxmox-network-types = "1.1"
proxmox-installer-types = { version = "0.2.1", features = ["legacy"] }
@@ -34,4 +35,5 @@ proxmox-installer-types = { version = "0.2.1", features = ["legacy"] }
# NOTE: You must run `cargo update` after changing this for it to take effect!
[patch.crates-io]
# proxmox-network-types.path = "../proxmox/proxmox-network-types"
+# proxmox-installer-api.path = "../proxmox/proxmox-installer-api"
# proxmox-installer-types.path = "../proxmox/proxmox-installer-types"
diff --git a/debian/control b/debian/control
index eb99820..e3d09f4 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Build-Depends: cargo:native,
librust-pico-args-0.5-dev,
librust-pretty-assertions-1.4-dev,
librust-proxmox-installer-types-0.2+legacy-dev (>= 0.2.1-~~),
+ librust-proxmox-network-api-1-dev,
librust-proxmox-network-types-1-dev (>= 1.1-~~),
librust-proxmox-sys+crypt-dev,
librust-regex-1+default-dev (>= 1.7~~),
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 5ef2f4f..b7ca85d 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -15,6 +15,7 @@ anyhow.workspace = true
log.workspace = true
proxmox-installer-common = { workspace = true, features = ["http"] }
proxmox-network-types.workspace = true
+proxmox-network-api.workspace = true
proxmox-installer-types.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 9d27086..f89aea0 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -11,7 +11,7 @@ use proxmox_installer_types::{
answer::{
AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
- NetworkConfig,
+ NetworkBondOptions, NetworkConfig,
},
};
@@ -48,6 +48,7 @@ fn get_network_settings(
&runtime_info.network,
None,
pinning_opts.as_ref(),
+ answer.network.bond(),
);
opts.fqdn = name.to_owned();
opts
@@ -76,6 +77,7 @@ fn get_network_settings(
&runtime_info.network,
domain.as_deref(),
pinning_opts.as_ref(),
+ answer.network.bond(),
)
}
};
@@ -92,6 +94,33 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.bond_opts {
+ let members = opts.members.iter().fold(String::new(), |acc, mac| {
+ // Resolve either to the pinned name, if enabled, otherwise to the kernel-assigned one.
+ let name = network_options
+ .pinning_opts
+ .as_ref()
+ .and_then(|o| o.mapping.get(mac).cloned())
+ .or_else(|| {
+ runtime_info
+ .network
+ .interfaces
+ .iter()
+ .find_map(|(_, iface)| (iface.mac == *mac).then_some(iface.name.to_owned()))
+ })
+ .unwrap_or("<unknown>".to_owned());
+
+ if acc.is_empty() {
+ name
+ } else {
+ format!("{acc}, {name}")
+ }
+ });
+
+ info!("Network interface bonding enabled on: {members}");
+ opts.verify()?;
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -493,6 +522,10 @@ pub fn verify_network_settings(
}
}
+ if let Some(opts) = network.bond() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -552,6 +585,9 @@ pub fn parse_answer(
subscription_key: answer.global.subscription_key.clone(),
mngmt_nic: network_settings.ifname,
+ mngmt_bond: network_settings
+ .bond_opts
+ .unwrap_or_else(NetworkBondOptions::disabled),
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index ae5b87d..0320bba 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -127,6 +127,7 @@ mod tests {
full_fqdn_from_dhcp_with_default_domain,
hashed_root_password,
minimal,
+ network_bond,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
nic_matching,
@@ -150,11 +151,15 @@ mod tests {
fqdn_hostname_only,
ipv4_and_subnet_mask_33,
lvm_swapsize_greater_than_hdsize,
+ network_bond_invalid_hash_policy,
+ network_bond_invalid_mode,
+ network_bond_primary_not_member,
+ network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
- zfs_raid_single_disk
+ zfs_raid_single_disk,
);
}
}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json b/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
index 0c1f032..ce27d41 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"btrfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
index cb6711c..cc0bbe9 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"btrfs_opts": { "compress": "off" },
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
index d5ffddd..0c13325 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.json
@@ -18,6 +18,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
index 78a5e0c..4f2150d 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.json
@@ -15,6 +15,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
index 2e65fce..5adb9c6 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.json
@@ -22,6 +22,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
index fafde51..e3012a8 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
index 5ec6656..3424487 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
index 5ec6656..3424487 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_empty_dhcp_domain_setting.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
index 7ed46a2..78e32a7 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/fqdn_from_dhcp_no_dhcp_domain_with_default_domain.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json b/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
index 7ed46a2..78e32a7 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/full_fqdn_from_dhcp_with_default_domain.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json b/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
index 4e049bd..e3bf44f 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/hashed_root_password.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": {
"hashed": "$y$j9T$VgMv8lsz/TEvzesCZU3xD.$SK.h4QW51Jr/EmjuaTz5Bt4kYiX2Iezz6omzoqVEwj9"
},
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/minimal.json b/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
index 0339dbc..1262832 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/minimal.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
new file mode 100644
index 0000000..cf0aa98
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
@@ -0,0 +1,25 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
new file mode 100644
index 0000000..dc6b7b0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
index 76723c8..42bc5a3 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "mgmt",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"network_interface_pin_map": {
"1c:34:da:5c:5e:24": "nic2",
"1c:34:da:5c:5e:25": "nic3",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
index 76723c8..42bc5a3 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_interface_pinning_mixed_case_mac_addresses.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "mgmt",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"network_interface_pin_map": {
"1c:34:da:5c:5e:24": "nic2",
"1c:34:da:5c:5e:25": "nic3",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
index 5d707c4..defcfa5 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/nic_matching.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "enp65s0f0",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/no_network.json b/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
index de5f263..1bc3567 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/no_network.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json b/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
index 49240b4..bd4a459 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/specific_nic.json
@@ -12,6 +12,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "enp129s0f1np1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"target_hd": "/dev/sda",
"timezone": "Europe/Vienna",
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs.json b/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
index 622f6d6..149588f 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs.json
@@ -16,6 +16,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
index 46b8344..99ac240 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
@@ -17,6 +17,11 @@
"keymap": "de",
"mailto": "mail@no.invalid",
"mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": [],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
"root_password": { "plain": "12345678" },
"timezone": "Europe/Vienna",
"zfs_opts": {
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
new file mode 100644
index 0000000..b76c9d6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `vlan+srcmac`, expected one of `layer2`, `layer2+3`, `layer3+4`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
new file mode 100644
index 0000000..af2789b
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "vlan+srcmac"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
new file mode 100644
index 0000000..95461dc
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `non-existent-mode`, expected one of `balance-rr`, `active-backup`, `balance-xor`, `broadcast`, `802.3ad`, `balance-tlb`, `balance-alb`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
new file mode 100644
index 0000000..79695da
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "non-existent-mode"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
new file mode 100644
index 0000000..7e64e92
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
@@ -0,0 +1,3 @@
+{
+ "error": "primary bond interface B4:2E:99:AC:AD:B6 must be a member of the bond (members: B4:2E:99:AC:AD:B4, B4:2E:99:AC:AD:B5)"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
new file mode 100644
index 0000000..fab400a
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
@@ -0,0 +1,19 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+primary-interface = "b4:2e:99:ac:ad:b6"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
new file mode 100644
index 0000000..730fad6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
@@ -0,0 +1,3 @@
+{
+ "error": "bond setup requires at least 2 interfaces, got 1"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
new file mode 100644
index 0000000..b035cef
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4"]
+mode = "balance-rr"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/Cargo.toml b/proxmox-installer-common/Cargo.toml
index 7682680..a283094 100644
--- a/proxmox-installer-common/Cargo.toml
+++ b/proxmox-installer-common/Cargo.toml
@@ -13,6 +13,7 @@ regex.workspace = true
serde = { workspace = true, features = [ "derive" ] }
serde_json.workspace = true
serde_plain.workspace = true
+proxmox-network-api.workspace = true
proxmox-network-types.workspace = true
proxmox-installer-types.workspace = true
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index fbbfe77..1add63b 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -15,8 +15,8 @@ use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
- BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkInterfacePinningOptionsAnswer,
- ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
+ NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -395,6 +395,7 @@ pub struct NetworkOptions {
pub gateway: IpAddr,
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
+ pub bond_opts: Option<NetworkBondOptions>,
}
impl NetworkOptions {
@@ -405,6 +406,7 @@ impl NetworkOptions {
network: &NetworkInfo,
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
+ bond_opts: Option<&NetworkBondOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -417,6 +419,7 @@ impl NetworkOptions {
gateway: Ipv4Addr::new(192, 168, 100, 1).into(),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
+ bond_opts: bond_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -479,6 +482,10 @@ impl NetworkOptions {
}
}
+ if this.bond_opts.is_some() {
+ this.ifname = "bond0".to_owned();
+ }
+
this
}
@@ -632,7 +639,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -640,12 +647,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -653,12 +661,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -666,12 +675,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -679,6 +689,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -726,7 +737,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -734,6 +745,7 @@ mod tests {
gateway: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1)),
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -743,7 +755,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -751,12 +763,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -764,12 +777,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -777,6 +791,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -813,7 +828,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -821,6 +836,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 100, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 14882bc..139d276 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -16,7 +16,10 @@ use crate::options::{
};
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
- answer::{BtrfsCompressOption, FilesystemType, ZfsChecksumOption, ZfsCompressOption},
+ answer::{
+ BtrfsCompressOption, FilesystemType, NetworkBondOptions, ZfsChecksumOption,
+ ZfsCompressOption,
+ },
};
use proxmox_network_types::{Cidr, MacAddress};
@@ -326,7 +329,8 @@ pub struct NetworkInfo {
pub dns: Dns,
pub routes: Routes,
- /// Maps devices to their configuration, if it has a usable configuration.
+ /// Maps devices to their configuration, if it has a usable configuration, keyed by their
+ /// kernel-assigned interface name.
/// (Contains no entries for devices with only link-local addresses.)
#[serde(default)]
pub interfaces: BTreeMap<String, Interface>,
@@ -530,6 +534,8 @@ pub struct InstallConfig {
pub subscription_key: Option<String>,
pub mngmt_nic: String,
+ pub mngmt_bond: NetworkBondOptions,
+
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
#[serde(
--
2.55.0
^ permalink raw reply related [relevance 20%]
* [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers
@ 2026-11-02 12:45 15% Christoph Heiss
2026-11-02 12:45 20% ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
` (3 more replies)
0 siblings, 4 replies; 14+ results
From: Christoph Heiss @ 2026-11-02 12:45 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0] by adding the possibility to set up a bond and set a
VLAN ID for the management interface during the installation, for all of
GUI, TUI and auto-installer.
For the GUI and TUI, the current name pinning dialog is converted into a
full-fledged advanced network options dialog, in the same vein as with
the bootdisk options.
This makes it practical to then add additional networking options, in
this case bond and VLAN options.
The auto-installer gains two new sections under [network]:
[network.bond]
members-list = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
# or, alternatively
members-filter.ID_NET_DRIVER = "igc"
members-filter-match = "all"
# general bond options
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
[network.vlan]
vid = 5
Both being of course independent of each other.
The respective PDM integration will be sent separately.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
History
=======
v3: off-list review sample
v2: https://lore.proxmox.com/pve-devel/20261020112327.641633-1-c.heiss@proxmox.com/
v1: https://lore.proxmox.com/pve-devel/20260908101647.1057780-1-c.heiss@proxmox.com/
Notable changes v3 -> v4:
* add some `Display` derives for proxmox-installer-types
* fixed expanding of tab page contents, which caused unnecessary padding
Notable changes v2 -> v3:
* added VLAN configuration support
* rebased atop @Thomas changes, including some patches from him
* split bond member selection into static list and udev filters
Notable changes v1 -> v2:
* rebased on latest masters for each repo
* fixed a bug in the GUI installer, passing an invalid index to GTK with a
bond set up
Questions
=========
1. Since we now discourage the use of the 'balance-alb' and 'balance-tlb'
modes in combination with a Linux bridge (as of [1]), should these not
even be available for selection here?
2. For the Rust part, it reuses the already existing bond types from the
'proxmox-network-api' crate. Given that they are pretty universal rather,
than just completely API-specific, would it make sense to move them into
'proxmox-network-types' instead?
@Stefan might have some comment on this as well, as we discussed that
off-list recently as well.
[1] https://lore.proxmox.com/pve-devel/20260828095721.263382-1-m.sandoval@proxmox.com/
Diffstat
========
proxmox:
Christoph Heiss (8):
installer-types: clippy: use .is_multiple_of() instead of manual
modulo
installer-types: use `MacAddress` type where applicable
installer-types: derive Display for RebootMode and FilterMatch
installer-types: answer: add options for configuring management bond
installer-types: answer: add options for configuring management vlan
installer-types: bump fetch schema for bond and VLAN answer options
installer-types: bump version to 0.3.0-1
network-api: derive Display and FromStr for network bond types
Cargo.toml | 1 +
proxmox-installer-types/Cargo.toml | 3 +-
proxmox-installer-types/debian/changelog | 21 +
proxmox-installer-types/debian/control | 18 +-
proxmox-installer-types/src/answer.rs | 486 ++++++++++++++++++++++-
proxmox-installer-types/src/post_hook.rs | 4 +-
proxmox-network-api/Cargo.toml | 1 +
proxmox-network-api/debian/control | 6 +-
proxmox-network-api/src/api_types.rs | 27 +-
9 files changed, 524 insertions(+), 43 deletions(-)
pve-installer:
Christoph Heiss (22):
install: run make tidy
tree-wide: use `MacAddress` type instead of string for MAC addresses
install: factor out ifupdown2 config generation into own subroutine
install: do not rely on interface name map to be fully populated
install: config: add option for setting up bond on management
interface
install: config: add option for setting up vlan on management
interface
install: network: set up management bond if requested
install: network: set up vlan on management interface if requested
gui: network: factor out name pinning into advanced options dialog
gui: network: add bond setup options to advanced options dialog
gui: network: add vlan setup options to advanced network dialog
auto: pass through management network bond options to low-level
installer
auto: pass through management network vlan options to low-level
installer
tui: drop long obsolete comment about logo formatting
tui: views: add widget for displaying a group of checkboxes
tui: network: factor out name pinning into advanced options dialog
tui: network: add bond setup options to advanced network dialog
tui: network: add vlan setup options to advanced network dialog
gui: network: split advanced options dialog into tabs
tui: network: split advanced options dialog into tabs
gui: network: list bond member candidates sharing a MAC address once
tui: network: list bond member candidates sharing a MAC address once
Cargo.toml | 4 +-
Proxmox/Install.pm | 244 ++++--
Proxmox/Install/Config.pm | 79 ++
Proxmox/Sys/Net.pm | 43 +
debian/control | 3 +-
proxinstall | 491 +++++++++--
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 115 ++-
proxmox-auto-installer/tests/parse-answer.rs | 12 +-
.../resources/parse_answer/network_bond.json | 25 +
.../resources/parse_answer/network_bond.toml | 20 +
.../parse_answer/network_bond_and_vlan.json | 29 +
.../parse_answer/network_bond_and_vlan.toml | 23 +
.../network_bond_with_filter.json | 24 +
.../network_bond_with_filter.toml | 22 +
...ace_pinning_mixed_case_mac_addresses.json} | 0
...ace_pinning_mixed_case_mac_addresses.toml} | 4 +-
.../resources/parse_answer/network_vlan.json | 23 +
.../resources/parse_answer/network_vlan.toml | 17 +
.../network_bond_invalid_hash_policy.json | 3 +
.../network_bond_invalid_hash_policy.toml | 20 +
.../network_bond_invalid_mode.json | 3 +
.../network_bond_invalid_mode.toml | 18 +
.../network_bond_primary_not_member.json | 3 +
.../network_bond_primary_not_member.toml | 19 +
.../network_bond_single_interface.json | 3 +
.../network_bond_single_interface.toml | 18 +
...rface_pinning_overlong_interface_name.json | 2 +-
.../network_vlan_invalid_vid.json | 3 +
.../network_vlan_invalid_vid.toml | 17 +
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 117 +--
proxmox-installer-common/src/setup.rs | 99 ++-
proxmox-post-hook/src/main.rs | 2 +-
proxmox-tui-installer/Cargo.toml | 1 +
proxmox-tui-installer/src/main.rs | 9 +-
proxmox-tui-installer/src/options.rs | 51 +-
proxmox-tui-installer/src/setup.rs | 20 +-
proxmox-tui-installer/src/views/mod.rs | 141 +++-
proxmox-tui-installer/src/views/network.rs | 762 ++++++++++++++----
.../src/views/tabbed_view.rs | 7 +
test/Makefile | 6 +-
test/generate-ifupdown2-config.pl | 541 +++++++++++++
43 files changed, 2661 insertions(+), 384 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.json => network_interface_pinning_mixed_case_mac_addresses.json} (100%)
rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.toml => network_interface_pinning_mixed_case_mac_addresses.toml} (85%)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
create mode 100755 test/generate-ifupdown2-config.pl
^ permalink raw reply [relevance 15%]
* [PATCH installer v4 21/30] auto: pass through management network vlan options to low-level installer
2026-11-02 12:45 15% [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-02 12:45 20% ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
@ 2026-11-02 12:45 22% ` Christoph Heiss
2026-11-02 12:45 18% ` [PATCH installer v4 26/30] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-06 13:12 7% ` [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-02 12:45 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a VLAN on the management interface during the
installation:
[network.vlan]
vid = 5
Where `vid` is the desired VLAN ID.
This then just passes through the given VLAN options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message if the management interface will be put on
a VLAN.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v3 -> v4:
* skip serializing disabled vlan options to low-level config
Changes v2 -> v3:
* new patch
proxmox-auto-installer/src/utils.rs | 14 ++++++++
proxmox-auto-installer/tests/parse-answer.rs | 3 ++
.../parse_answer/network_bond_and_vlan.json | 29 ++++++++++++++++
.../parse_answer/network_bond_and_vlan.toml | 23 +++++++++++++
.../resources/parse_answer/network_vlan.json | 23 +++++++++++++
.../resources/parse_answer/network_vlan.toml | 17 ++++++++++
.../network_vlan_invalid_vid.json | 3 ++
.../network_vlan_invalid_vid.toml | 17 ++++++++++
proxmox-installer-common/src/options.rs | 33 +++++++++++++------
proxmox-installer-common/src/setup.rs | 30 +++++++++++++++--
10 files changed, 180 insertions(+), 12 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index b9b3a8d..46598f9 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -48,6 +48,7 @@ fn get_network_settings(
None,
pinning_opts.as_ref(),
answer.network.bond(),
+ answer.network.vlan(),
);
opts.fqdn = name.to_owned();
opts
@@ -77,6 +78,7 @@ fn get_network_settings(
domain.as_deref(),
pinning_opts.as_ref(),
answer.network.bond(),
+ answer.network.vlan(),
)
}
};
@@ -124,6 +126,10 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.vlan_opts {
+ info!("Management interface reachable on VLAN {}", opts.vid);
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -555,6 +561,10 @@ pub fn verify_network_settings(
opts.verify()?;
}
+ if let Some(opts) = network.vlan() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -625,6 +635,10 @@ pub fn parse_answer(
})
})
.unwrap_or_else(|| Ok(InstallNetworkBondOptions::default()))?,
+ mngmt_vlan: network_settings
+ .vlan_opts
+ .map(|opts| opts.into())
+ .unwrap_or_default(),
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 0320bba..4776c4d 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -128,8 +128,10 @@ mod tests {
hashed_root_password,
minimal,
network_bond,
+ network_bond_and_vlan,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
+ network_vlan,
nic_matching,
no_network,
specific_nic,
@@ -156,6 +158,7 @@ mod tests {
network_bond_primary_not_member,
network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
+ network_vlan_invalid_vid,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
new file mode 100644
index 0000000..7a27868
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
@@ -0,0 +1,29 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "mngmt_vlan": {
+ "enabled": true,
+ "vid": 5
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
new file mode 100644
index 0000000..1352391
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
@@ -0,0 +1,23 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members-list = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[network.vlan]
+vid = 5
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
new file mode 100644
index 0000000..2761922
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
@@ -0,0 +1,23 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "eno1",
+ "mngmt_vlan": {
+ "enabled": true,
+ "vid": 5
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
new file mode 100644
index 0000000..c977711
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
@@ -0,0 +1,17 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.vlan]
+vid = 5
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
new file mode 100644
index 0000000..61ce63c
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
@@ -0,0 +1,3 @@
+{
+ "error": "VLAN id must be between 2 and 4094 inclusive, got 5000"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
new file mode 100644
index 0000000..c0e51c2
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
@@ -0,0 +1,17 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.vlan]
+vid = 5000
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 1add63b..e32b77d 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -16,7 +16,8 @@ use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
- NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ NetworkInterfacePinningOptionsAnswer, NetworkVlanOptions, ZfsChecksumOption,
+ ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -396,6 +397,7 @@ pub struct NetworkOptions {
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
pub bond_opts: Option<NetworkBondOptions>,
+ pub vlan_opts: Option<NetworkVlanOptions>,
}
impl NetworkOptions {
@@ -407,6 +409,7 @@ impl NetworkOptions {
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
bond_opts: Option<&NetworkBondOptions>,
+ vlan_opts: Option<&NetworkVlanOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -420,6 +423,7 @@ impl NetworkOptions {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
bond_opts: bond_opts.cloned(),
+ vlan_opts: vlan_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -639,7 +643,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -648,12 +652,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -662,12 +667,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -676,12 +682,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -690,6 +697,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -737,7 +745,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -746,6 +754,7 @@ mod tests {
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -755,7 +764,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -764,12 +773,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -778,12 +788,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -792,6 +803,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -828,7 +840,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -837,6 +849,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 31a1195..e5dfef4 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -17,8 +17,8 @@ use crate::options::{
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
answer::{
- BtrfsCompressOption, FilesystemType, ZfsChecksumOption,
- ZfsCompressOption,
+ BtrfsCompressOption, FilesystemType, NetworkVlanOptions,
+ ZfsChecksumOption, ZfsCompressOption,
},
};
use proxmox_network_api::{BondXmitHashPolicy, LinuxBondMode};
@@ -526,6 +526,30 @@ impl InstallNetworkBondOptions {
}
}
+#[derive(Clone, Default, Debug, Deserialize, Serialize, PartialEq)]
+/// Low-level installer options for setting up a VLAN configuration on the management interface.
+pub struct InstallNetworkVlanOptions {
+ /// Whether to enable VLAN tagging on the management interface
+ enabled: bool,
+ /// VLAN tag to configure.
+ pub vid: u16,
+}
+
+impl From<NetworkVlanOptions> for InstallNetworkVlanOptions {
+ fn from(opts: NetworkVlanOptions) -> Self {
+ Self {
+ enabled: true,
+ vid: opts.vid,
+ }
+ }
+}
+
+impl InstallNetworkVlanOptions {
+ fn is_disabled(&self) -> bool {
+ !self.enabled
+ }
+}
+
/// See Proxmox::Install::Config
#[derive(Debug, Deserialize, Serialize)]
pub struct InstallConfig {
@@ -570,6 +594,8 @@ pub struct InstallConfig {
pub mngmt_nic: String,
#[serde(skip_serializing_if = "InstallNetworkBondOptions::is_disabled")]
pub mngmt_bond: InstallNetworkBondOptions,
+ #[serde(skip_serializing_if = "InstallNetworkVlanOptions::is_disabled")]
+ pub mngmt_vlan: InstallNetworkVlanOptions,
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
--
2.55.0
^ permalink raw reply related [relevance 22%]
* [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer
2026-11-02 12:45 15% [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
@ 2026-11-02 12:45 20% ` Christoph Heiss
2026-11-02 12:45 22% ` [PATCH installer v4 21/30] auto: pass through management network vlan " Christoph Heiss
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-02 12:45 UTC (permalink / raw)
To: pve-devel
Partially fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a management bond:
[network.bond]
members = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
This then just passes through the given bond options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message that bonding is enabled.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v3 -> v4:
* skip serializing disabled bond options to low-level config
* adapt to updated proxmox-installer-types, add support for
`members-filter`
Changes v2 -> v3:
* fixed typo in subject
* fixed patch section in Cargo.toml
Changes v1 -> v2:
* no changes
Cargo.toml | 2 +
debian/control | 1 +
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 101 +++++++++++++++---
proxmox-auto-installer/tests/parse-answer.rs | 7 +-
.../resources/parse_answer/network_bond.json | 25 +++++
.../resources/parse_answer/network_bond.toml | 20 ++++
.../network_bond_with_filter.json | 24 +++++
.../network_bond_with_filter.toml | 22 ++++
.../network_bond_invalid_hash_policy.json | 3 +
.../network_bond_invalid_hash_policy.toml | 20 ++++
.../network_bond_invalid_mode.json | 3 +
.../network_bond_invalid_mode.toml | 18 ++++
.../network_bond_primary_not_member.json | 3 +
.../network_bond_primary_not_member.toml | 19 ++++
.../network_bond_single_interface.json | 3 +
.../network_bond_single_interface.toml | 18 ++++
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 38 +++++--
proxmox-installer-common/src/setup.rs | 45 +++++++-
20 files changed, 346 insertions(+), 28 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
diff --git a/Cargo.toml b/Cargo.toml
index 747608e..75b5628 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,11 +27,13 @@ serde_plain = "1.0"
toml = "0.8"
proxmox-auto-installer.path = "./proxmox-auto-installer"
proxmox-installer-common.path = "./proxmox-installer-common"
+proxmox-network-api = "1.0"
proxmox-network-types = "1.1"
proxmox-installer-types = { version = "0.3", features = ["legacy"] }
# Local path overrides
# NOTE: You must run `cargo update` after changing this for it to take effect!
[patch.crates-io]
+# proxmox-network-api.path = "../proxmox/proxmox-network-api"
# proxmox-network-types.path = "../proxmox/proxmox-network-types"
# proxmox-installer-types.path = "../proxmox/proxmox-installer-types"
diff --git a/debian/control b/debian/control
index e860819..0f09c02 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Build-Depends: cargo:native,
librust-pico-args-0.5-dev,
librust-pretty-assertions-1.4-dev,
librust-proxmox-installer-types-0.3+legacy-dev,
+ librust-proxmox-network-api-1-dev,
librust-proxmox-network-types-1-dev (>= 1.1-~~),
librust-proxmox-sys+crypt-dev,
librust-regex-1+default-dev (>= 1.7~~),
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 5ef2f4f..b7ca85d 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -15,6 +15,7 @@ anyhow.workspace = true
log.workspace = true
proxmox-installer-common = { workspace = true, features = ["http"] }
proxmox-network-types.workspace = true
+proxmox-network-api.workspace = true
proxmox-installer-types.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 9d27086..b9b3a8d 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -1,31 +1,30 @@
use anyhow::{Context, Result, bail};
use glob::Pattern;
use log::{info, warn};
+use serde::{Deserialize, Serialize};
use std::{
collections::{BTreeMap, HashSet},
process::Command,
};
-use proxmox_installer_types::{
- UdevInfo,
- answer::{
- AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
- FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
- NetworkConfig,
- },
-};
-
use proxmox_installer_common::{
ROOT_PASSWORD_MIN_LENGTH,
disk_checks::check_swapsize,
options::{FilesystemDiskInfo, NetworkInterfacePinningOptions, NetworkOptions, email_validate},
setup::{
- InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallRootPassword,
- InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
+ InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallNetworkBondOptions,
+ InstallRootPassword, InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
},
};
-
-use serde::{Deserialize, Serialize};
+use proxmox_installer_types::{
+ UdevInfo,
+ answer::{
+ AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
+ FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
+ NetworkBondMemberSelection, NetworkBondOptions, NetworkConfig,
+ },
+};
+use proxmox_network_types::MacAddress;
fn get_network_settings(
answer: &AutoInstallerConfig,
@@ -48,6 +47,7 @@ fn get_network_settings(
&runtime_info.network,
None,
pinning_opts.as_ref(),
+ answer.network.bond(),
);
opts.fqdn = name.to_owned();
opts
@@ -76,6 +76,7 @@ fn get_network_settings(
&runtime_info.network,
domain.as_deref(),
pinning_opts.as_ref(),
+ answer.network.bond(),
)
}
};
@@ -92,6 +93,37 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.bond_opts {
+ let members = match_selected_network_bond_members(opts, udev_info, runtime_info)?
+ .iter()
+ .fold(String::new(), |acc, mac| {
+ // Resolve either to the pinned name, if enabled, otherwise to the kernel-assigned one.
+ let name = network_options
+ .pinning_opts
+ .as_ref()
+ .and_then(|o| o.mapping.get(mac).cloned())
+ .or_else(|| {
+ runtime_info
+ .network
+ .interfaces
+ .iter()
+ .find_map(|(_, iface)| {
+ (iface.mac == *mac).then_some(iface.name.to_owned())
+ })
+ })
+ .unwrap_or("<unknown>".to_owned());
+
+ if acc.is_empty() {
+ name
+ } else {
+ format!("{acc}, {name}")
+ }
+ });
+
+ info!("Network interface bonding enabled on: {members}");
+ opts.verify()?;
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -192,7 +224,7 @@ pub fn get_matched_udev_indexes(
let mut did_match_all = true;
for (filter_key, filter_value) in filter {
let filter_pattern =
- Pattern::new(filter_value).context("invalid glob in disk selection")?;
+ Pattern::new(filter_value).context("invalid glob in filter selection")?;
for (udev_key, udev_value) in dev_values {
if udev_key == filter_key && filter_pattern.matches(udev_value) {
did_match_once = true;
@@ -328,6 +360,32 @@ fn set_selected_disks(
Ok(())
}
+fn match_selected_network_bond_members(
+ bond: &NetworkBondOptions,
+ udev_info: &UdevInfo,
+ runtime_info: &RuntimeInfo,
+) -> Result<Vec<MacAddress>> {
+ match bond.members()? {
+ None => Ok(Vec::new()),
+ Some(NetworkBondMemberSelection::Fixed(list)) => Ok(list),
+ Some(NetworkBondMemberSelection::Filter(filter)) => {
+ let filter_match = bond.members_filter_match.unwrap_or_default();
+ // list of kernel-assigned names
+ let selected = get_matched_udev_indexes(
+ &filter,
+ &udev_info.nics,
+ filter_match == FilterMatch::All,
+ )?
+ .into_iter()
+ .filter_map(|ifname| runtime_info.network.interfaces.get(&ifname))
+ .map(|iface| iface.mac)
+ .collect();
+
+ Ok(selected)
+ }
+ }
+}
+
fn get_first_selected_disk(config: &InstallConfig) -> usize {
config
.disk_selection
@@ -493,6 +551,10 @@ pub fn verify_network_settings(
}
}
+ if let Some(opts) = network.bond() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -552,6 +614,17 @@ pub fn parse_answer(
subscription_key: answer.global.subscription_key.clone(),
mngmt_nic: network_settings.ifname,
+ mngmt_bond: network_settings
+ .bond_opts
+ .map(|bond| -> Result<InstallNetworkBondOptions> {
+ Ok(InstallNetworkBondOptions {
+ members: match_selected_network_bond_members(&bond, udev_info, runtime_info)?,
+ mode: bond.mode,
+ hash_policy: bond.hash_policy,
+ primary_interface: bond.primary_interface,
+ })
+ })
+ .unwrap_or_else(|| Ok(InstallNetworkBondOptions::default()))?,
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index ae5b87d..0320bba 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -127,6 +127,7 @@ mod tests {
full_fqdn_from_dhcp_with_default_domain,
hashed_root_password,
minimal,
+ network_bond,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
nic_matching,
@@ -150,11 +151,15 @@ mod tests {
fqdn_hostname_only,
ipv4_and_subnet_mask_33,
lvm_swapsize_greater_than_hdsize,
+ network_bond_invalid_hash_policy,
+ network_bond_invalid_mode,
+ network_bond_primary_not_member,
+ network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
- zfs_raid_single_disk
+ zfs_raid_single_disk,
);
}
}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
new file mode 100644
index 0000000..cf0aa98
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
@@ -0,0 +1,25 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
new file mode 100644
index 0000000..31d748c
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members-list = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
new file mode 100644
index 0000000..91a4723
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
@@ -0,0 +1,24 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
new file mode 100644
index 0000000..a1af3a1
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
@@ -0,0 +1,22 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+# matches `eno1` and `eno2`
+members-filter.ID_NET_DRIVER = "igb"
+members-filter.ID_PATH = "pci-0000:c2:00.*"
+members-filter-match = "all"
+mode = "active-backup"
+hash-policy = "layer2"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
new file mode 100644
index 0000000..b76c9d6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `vlan+srcmac`, expected one of `layer2`, `layer2+3`, `layer3+4`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
new file mode 100644
index 0000000..af2789b
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "vlan+srcmac"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
new file mode 100644
index 0000000..95461dc
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `non-existent-mode`, expected one of `balance-rr`, `active-backup`, `balance-xor`, `broadcast`, `802.3ad`, `balance-tlb`, `balance-alb`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
new file mode 100644
index 0000000..79695da
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "non-existent-mode"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
new file mode 100644
index 0000000..7e64e92
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
@@ -0,0 +1,3 @@
+{
+ "error": "primary bond interface B4:2E:99:AC:AD:B6 must be a member of the bond (members: B4:2E:99:AC:AD:B4, B4:2E:99:AC:AD:B5)"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
new file mode 100644
index 0000000..f285828
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
@@ -0,0 +1,19 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members-list = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+primary-interface = "b4:2e:99:ac:ad:b6"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
new file mode 100644
index 0000000..730fad6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
@@ -0,0 +1,3 @@
+{
+ "error": "bond setup requires at least 2 interfaces, got 1"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
new file mode 100644
index 0000000..7ec6204
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members-list = ["b4:2e:99:ac:ad:b4"]
+mode = "balance-rr"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/Cargo.toml b/proxmox-installer-common/Cargo.toml
index 7682680..a283094 100644
--- a/proxmox-installer-common/Cargo.toml
+++ b/proxmox-installer-common/Cargo.toml
@@ -13,6 +13,7 @@ regex.workspace = true
serde = { workspace = true, features = [ "derive" ] }
serde_json.workspace = true
serde_plain.workspace = true
+proxmox-network-api.workspace = true
proxmox-network-types.workspace = true
proxmox-installer-types.workspace = true
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index fbbfe77..1add63b 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -15,8 +15,8 @@ use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
- BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkInterfacePinningOptionsAnswer,
- ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
+ NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -395,6 +395,7 @@ pub struct NetworkOptions {
pub gateway: IpAddr,
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
+ pub bond_opts: Option<NetworkBondOptions>,
}
impl NetworkOptions {
@@ -405,6 +406,7 @@ impl NetworkOptions {
network: &NetworkInfo,
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
+ bond_opts: Option<&NetworkBondOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -417,6 +419,7 @@ impl NetworkOptions {
gateway: Ipv4Addr::new(192, 168, 100, 1).into(),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
+ bond_opts: bond_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -479,6 +482,10 @@ impl NetworkOptions {
}
}
+ if this.bond_opts.is_some() {
+ this.ifname = "bond0".to_owned();
+ }
+
this
}
@@ -632,7 +639,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -640,12 +647,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -653,12 +661,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -666,12 +675,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -679,6 +689,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -726,7 +737,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -734,6 +745,7 @@ mod tests {
gateway: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1)),
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -743,7 +755,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -751,12 +763,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -764,12 +777,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -777,6 +791,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -813,7 +828,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -821,6 +836,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 100, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 14882bc..31a1195 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -16,8 +16,12 @@ use crate::options::{
};
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
- answer::{BtrfsCompressOption, FilesystemType, ZfsChecksumOption, ZfsCompressOption},
+ answer::{
+ BtrfsCompressOption, FilesystemType, ZfsChecksumOption,
+ ZfsCompressOption,
+ },
};
+use proxmox_network_api::{BondXmitHashPolicy, LinuxBondMode};
use proxmox_network_types::{Cidr, MacAddress};
/// Paths in the ISO environment containing installer data.
@@ -326,7 +330,8 @@ pub struct NetworkInfo {
pub dns: Dns,
pub routes: Routes,
- /// Maps devices to their configuration, if it has a usable configuration.
+ /// Maps devices to their configuration, if it has a usable configuration, keyed by their
+ /// kernel-assigned interface name.
/// (Contains no entries for devices with only link-local addresses.)
#[serde(default)]
pub interfaces: BTreeMap<String, Interface>,
@@ -488,6 +493,39 @@ pub fn spawn_low_level_installer(test_mode: bool) -> io::Result<process::Child>
.spawn()
}
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "kebab-case")]
+/// Options for creating a bond for the management interface with the given
+/// physical interfaces and mode.
+pub struct InstallNetworkBondOptions {
+ /// List of interface MAC addresses to add as bond members.
+ pub members: Vec<MacAddress>,
+ /// Mode for the bond to set.
+ pub mode: LinuxBondMode,
+ /// Bond hash policy. Only used with '802.3ad' and 'balance-xor' mode.
+ pub hash_policy: BondXmitHashPolicy,
+ /// Primary bond interface. Only used with 'active-backup' mode.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub primary_interface: Option<MacAddress>,
+}
+
+impl Default for InstallNetworkBondOptions {
+ fn default() -> Self {
+ Self {
+ members: Vec::new(),
+ mode: LinuxBondMode::ActiveBackup,
+ hash_policy: BondXmitHashPolicy::Layer2,
+ primary_interface: None,
+ }
+ }
+}
+
+impl InstallNetworkBondOptions {
+ fn is_disabled(&self) -> bool {
+ self.members.is_empty()
+ }
+}
+
/// See Proxmox::Install::Config
#[derive(Debug, Deserialize, Serialize)]
pub struct InstallConfig {
@@ -530,6 +568,9 @@ pub struct InstallConfig {
pub subscription_key: Option<String>,
pub mngmt_nic: String,
+ #[serde(skip_serializing_if = "InstallNetworkBondOptions::is_disabled")]
+ pub mngmt_bond: InstallNetworkBondOptions,
+
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
#[serde(
--
2.55.0
^ permalink raw reply related [relevance 20%]
* [PATCH installer v4 26/30] tui: network: add vlan setup options to advanced network dialog
2026-11-02 12:45 15% [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-02 12:45 20% ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-02 12:45 22% ` [PATCH installer v4 21/30] auto: pass through management network vlan " Christoph Heiss
@ 2026-11-02 12:45 18% ` Christoph Heiss
2026-11-06 13:12 7% ` [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-02 12:45 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0].
Adds a third panel to the advanced network options dialog, allowing the
user to set a VLAN ID for the management interface.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v3 -> v4:
* no changes
Changes v2 -> v3:
* no changes
Changes v1 -> v2:
* new patch
proxmox-tui-installer/src/main.rs | 1 +
proxmox-tui-installer/src/options.rs | 6 +-
proxmox-tui-installer/src/setup.rs | 5 +
proxmox-tui-installer/src/views/mod.rs | 35 +++++--
proxmox-tui-installer/src/views/network.rs | 112 ++++++++++++++++++++-
5 files changed, 147 insertions(+), 12 deletions(-)
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 6e7c691..cd3b0ec 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -178,6 +178,7 @@ fn main() {
// We enable network interface pinning by default in the TUI
Some(&NetworkInterfacePinningOptions::default()),
None,
+ None,
),
autoreboot: true,
},
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index 15b14a9..b6b5211 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -42,7 +42,7 @@ impl InstallerOptions {
.map(|l| &l.name)
.unwrap_or(&self.timezone.kb_layout);
- let mngmt_interface = if let Some(opts) = &self.network.bond_opts {
+ let mut mngmt_interface = if let Some(opts) = &self.network.bond_opts {
let members = self
.resolve_bond_member_names(opts, &runtime_info.network)
.join(" | ");
@@ -52,6 +52,10 @@ impl InstallerOptions {
self.network.ifname.to_owned()
};
+ if let Some(opts) = &self.network.vlan_opts {
+ mngmt_interface += &format!(", VLAN {}", opts.vid);
+ }
+
vec![
SummaryOption::new("Bootdisk filesystem", self.bootdisk.fstype.to_string()),
SummaryOption::new(
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index e06d99e..db59d9e 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -48,6 +48,11 @@ impl From<InstallerOptions> for InstallConfig {
}
})
.unwrap_or_default(),
+ mngmt_vlan: options
+ .network
+ .vlan_opts
+ .map(|opts| opts.into())
+ .unwrap_or_default(),
network_interface_pin_map: pinning_opts.map(|o| o.mapping.clone()).unwrap_or_default(),
hostname: options.network.fqdn.host().to_owned(),
diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
index b4896e2..9349a9c 100644
--- a/proxmox-tui-installer/src/views/mod.rs
+++ b/proxmox-tui-installer/src/views/mod.rs
@@ -31,6 +31,7 @@ pub use timezone::*;
pub struct NumericEditView<T> {
view: LinearLayout,
+ min_value: Option<T>,
max_value: Option<T>,
placeholder: Option<T>,
max_content_width: Option<usize>,
@@ -44,6 +45,7 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
Self {
view,
+ min_value: None,
max_value: None,
placeholder: None,
max_content_width: None,
@@ -63,6 +65,7 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
Self {
view,
+ min_value: None,
max_value: None,
placeholder: None,
max_content_width: None,
@@ -70,6 +73,16 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
}
}
+ pub fn enabled(mut self, enabled: bool) -> Self {
+ self.inner_mut().set_enabled(enabled);
+ self
+ }
+
+ pub fn min_value(mut self, min: T) -> Self {
+ self.min_value = Some(min);
+ self
+ }
+
pub fn max_value(mut self, max: T) -> Self {
self.max_value = Some(max);
self
@@ -139,13 +152,23 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
self.max_value = Some(max);
}
+ pub fn set_enabled(&mut self, enabled: bool) {
+ self.inner_mut().set_enabled(enabled);
+ }
+
+ /// Checks if the new value is actually valid according to the min and max value, if set
fn check_bounds(&mut self, original: Arc<String>, result: EventResult) -> EventResult {
- // Check if the new value is actually valid according to the max value, if set
- if let Some(max) = self.max_value
- && let Ok(val) = self.get_content()
- && result.is_consumed()
- && val > max
- {
+ let above_min = self
+ .min_value
+ .map(|min| self.get_content().map(|val| val >= min).unwrap_or(true))
+ .unwrap_or(true);
+
+ let below_max = self
+ .max_value
+ .map(|max| self.get_content().map(|val| val <= max).unwrap_or(true))
+ .unwrap_or(true);
+
+ if result.is_consumed() && (!above_min || !below_max) {
// Restore the original value, before the insert
let cb = self.inner_mut().set_content((*original).clone());
return EventResult::with_cb_once(move |siv| {
diff --git a/proxmox-tui-installer/src/views/network.rs b/proxmox-tui-installer/src/views/network.rs
index a7a5ec9..ad5d1d9 100644
--- a/proxmox-tui-installer/src/views/network.rs
+++ b/proxmox-tui-installer/src/views/network.rs
@@ -18,15 +18,16 @@ use proxmox_installer_common::{
options::{NetworkInterfacePinningOptions, NetworkOptions},
setup::{Interface, NetworkInfo},
};
-use proxmox_installer_types::answer::NetworkBondOptions;
+use proxmox_installer_types::answer::{NetworkBondOptions, NetworkVlanOptions};
use proxmox_network_api::{BondXmitHashPolicy, LinuxBondMode};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
-use super::{CheckboxGroup, CidrAddressEditView, FormView};
+use super::{CheckboxGroup, CidrAddressEditView, FormView, IntegerEditView};
struct NetworkViewOptions {
pinning_enabled: bool,
bond_enabled: bool,
+ vlan_enabled: bool,
interfaces: Vec<Interface>,
/// Last selected interface (by its MAC address) in the [SelectView].
/// Keeps track of the selected interface across enabling/disabling bonding, which replaces the
@@ -36,6 +37,7 @@ struct NetworkViewOptions {
// by the user - to preserve the state between toggling the checkbox
pinning_options: NetworkInterfacePinningOptions,
bond_options: NetworkBondOptions,
+ vlan_options: NetworkVlanOptions,
}
/// Convenience wrapper when needing to take a (interior-mutable) reference to
@@ -55,6 +57,7 @@ impl NetworkOptionsView {
const INTERFACE_PINNING_VIEW_NAME: &str = "network-name-pinning-view";
const BOND_OPTIONS_VIEW_NAME: &str = "network-bond-options-view";
+ const VLAN_OPTIONS_VIEW_NAME: &str = "network-vlan-options-view";
pub fn new(options: &NetworkOptions, network_info: &NetworkInfo) -> Self {
let mut interfaces = network_info
@@ -80,6 +83,7 @@ impl NetworkOptionsView {
let options_ref = Arc::new(Mutex::new(NetworkViewOptions {
pinning_enabled: options.pinning_opts.is_some(),
bond_enabled: options.bond_opts.is_some(),
+ vlan_enabled: options.vlan_opts.is_some(),
interfaces,
last_selected_iface: selected_mac,
pinning_options: options.pinning_opts.clone().unwrap_or_default(),
@@ -87,6 +91,10 @@ impl NetworkOptionsView {
.bond_opts
.clone()
.unwrap_or_else(NetworkBondOptions::disabled),
+ vlan_options: options
+ .vlan_opts
+ .clone()
+ .unwrap_or(NetworkVlanOptions { vid: 0 }),
}));
let iface_selection = Self::build_mgmt_ifname_selectview(options_ref.clone());
@@ -181,6 +189,7 @@ impl NetworkOptionsView {
.then_some(options.pinning_options.clone());
let bond_opts = options.bond_enabled.then_some(options.bond_options.clone());
+ let vlan_opts = options.vlan_enabled.then_some(options.vlan_options.clone());
let ifname = if options.bond_enabled {
"bond0".to_owned()
@@ -211,6 +220,7 @@ impl NetworkOptionsView {
dns_server,
pinning_opts,
bond_opts,
+ vlan_opts,
})
}
}
@@ -225,6 +235,10 @@ impl NetworkOptionsView {
.child(Panel::new(
BondOptionsView::new(options_ref.clone())
.with_name(Self::BOND_OPTIONS_VIEW_NAME),
+ ))
+ .child(Panel::new(
+ VlanOptionsView::new(options_ref.clone())
+ .with_name(Self::VLAN_OPTIONS_VIEW_NAME),
)),
);
@@ -233,11 +247,12 @@ impl NetworkOptionsView {
.button("Ok", {
move |siv| {
match Self::get_view_values(siv, options_ref.clone()) {
- Ok((pin_opts, bond_opts)) => {
+ Ok((pin_opts, bond_opts, vlan_opts)) => {
siv.pop_layer();
let options = &mut options_ref.lock().expect("unpoisoned lock");
options.pinning_options = pin_opts;
options.bond_options = bond_opts;
+ options.vlan_options = vlan_opts;
}
Err(err) => {
siv.add_layer(Dialog::info(err.to_string()));
@@ -254,7 +269,11 @@ impl NetworkOptionsView {
fn get_view_values(
siv: &mut Cursive,
options_ref: NetworkViewOptionsRef,
- ) -> Result<(NetworkInterfacePinningOptions, NetworkBondOptions)> {
+ ) -> Result<(
+ NetworkInterfacePinningOptions,
+ NetworkBondOptions,
+ NetworkVlanOptions,
+ )> {
let pin_opts = siv
.call_on_name(
Self::INTERFACE_PINNING_VIEW_NAME,
@@ -276,7 +295,19 @@ impl NetworkOptionsView {
bond_opts.verify()?;
}
- Ok((pin_opts, bond_opts))
+ let vlan_opts = siv
+ .call_on_name(Self::VLAN_OPTIONS_VIEW_NAME, VlanOptionsView::get_values)
+ .unwrap_or_else(|| bail!("failed to retrieve management network VLAN options"))?;
+
+ if options_ref
+ .lock()
+ .map(|opts| opts.vlan_enabled)
+ .unwrap_or(false)
+ {
+ vlan_opts.verify()?;
+ }
+
+ Ok((pin_opts, bond_opts, vlan_opts))
}
fn refresh_ifname_view(siv: &mut Cursive, options_ref: NetworkViewOptionsRef) {
@@ -747,3 +778,74 @@ impl BondOptionsView {
impl ViewWrapper for BondOptionsView {
cursive::wrap_impl!(self.view: LinearLayout);
}
+
+struct VlanOptionsView {
+ view: LinearLayout,
+}
+
+impl VlanOptionsView {
+ const FORM_NAME: &str = "network-vlan-form-view";
+
+ fn new(options_ref: NetworkViewOptionsRef) -> Self {
+ let options = &options_ref.lock().expect("unpoisoned lock");
+
+ let view = LinearLayout::vertical()
+ .child(
+ LinearLayout::horizontal()
+ .child(
+ Checkbox::new()
+ .with_checked(options.vlan_enabled)
+ .on_change({
+ let options_ref = options_ref.clone();
+ move |siv, enabled| {
+ options_ref.lock().expect("unpoisoned lock").vlan_enabled =
+ enabled;
+
+ siv.call_on_name(Self::FORM_NAME, |form: &mut FormView| {
+ if let Some(v) = form.get_child_mut::<IntegerEditView>(0) {
+ v.set_enabled(enabled);
+ }
+ });
+ }
+ }),
+ )
+ .child(TextView::new(" Enable VLAN setup on management interface").no_wrap()),
+ )
+ .child(DummyView::new())
+ .child(
+ FormView::<()>::new()
+ .child(
+ "VLAN ID",
+ IntegerEditView::new()
+ .min_value(1)
+ .max_value(4094)
+ .content(options.vlan_options.vid as usize)
+ .enabled(options.vlan_enabled),
+ )
+ .with_name(Self::FORM_NAME),
+ );
+
+ Self { view }
+ }
+
+ fn get_values(&mut self) -> Result<NetworkVlanOptions> {
+ let form = self
+ .view
+ .get_child_mut(2)
+ .and_then(|v| v.downcast_mut::<NamedView<FormView<()>>>())
+ .ok_or(anyhow!("failed to retrieve bond options form"))?
+ .get_mut();
+
+ let vid = form
+ .get_value::<IntegerEditView, _>(0)
+ .ok_or(anyhow!("failed to retrieve VLAN ID"))?;
+
+ Ok(NetworkVlanOptions {
+ vid: vid.try_into()?,
+ })
+ }
+}
+
+impl ViewWrapper for VlanOptionsView {
+ cursive::wrap_impl!(self.view: LinearLayout);
+}
--
2.55.0
^ permalink raw reply related [relevance 18%]
* [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers
@ 2026-11-06 13:10 16% Christoph Heiss
2026-11-06 13:10 20% ` [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer Christoph Heiss
` (3 more replies)
0 siblings, 4 replies; 14+ results
From: Christoph Heiss @ 2026-11-06 13:10 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0] by adding the possibility to set up a bond and a VLAN tag for
the management interface during the installation, for all of GUI, TUI and
auto-installer.
For the GUI and TUI, the current name pinning dialog is converted into a
full-fledged advanced network options dialog, in the same vein as with
the bootdisk options.
This makes it practical to then add additional networking options, in
this case bond and VLAN options.
The auto-installer gains two new sections under [network]:
[network.bond]
members = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
# or, alternatively
filter.ID_NET_DRIVER = "igc"
filter-match = "all"
# general bond options
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
[network.vlan]
vid = 5
Both being of course independent of each other. [network.vlan] can only be set
in combination with
[network]
source = "from-answer"
The respective PDM integration will be sent separately.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
History
=======
v4: https://lore.proxmox.com/pve-devel/20261102124539.1008075-1-c.heiss@proxmox.com/
v3: off-list review sample
v2: https://lore.proxmox.com/pve-devel/20261020112327.641633-1-c.heiss@proxmox.com/
v1: https://lore.proxmox.com/pve-devel/20260908101647.1057780-1-c.heiss@proxmox.com/
Notable changes v4 -> v5:
* dropped now-applied `proxmox` patches
* rebased on applied `proxmox-{installer,network}-types` changes
* fixed (de-)serialization mismatch for low-level config w.r.t. what the Perl
side generates
Notable changes v3 -> v4:
* add some `Display` derives for proxmox-installer-types
* fixed expanding of tab page contents, which caused unnecessary padding
Notable changes v2 -> v3:
* added VLAN configuration support
* rebased atop @Thomas changes, including some patches from him
* split bond member selection into static list and udev filters
Notable changes v1 -> v2:
* rebased on latest masters for each repo
* fixed a bug in the GUI installer, passing an invalid index to GTK with a
bond set up
Questions
=========
1. Since we now discourage the use of the 'balance-alb' and 'balance-tlb'
modes in combination with a Linux bridge (as of [1]), should these not
even be available for selection here?
[1] https://lore.proxmox.com/pve-devel/20260828095721.263382-1-m.sandoval@proxmox.com/
Diffstat
========
pve-installer:
Christoph Heiss (23):
install: run make tidy
tree-wide: use `MacAddress` type instead of string for MAC addresses
install: factor out ifupdown2 config generation into own subroutine
install: do not rely on interface name map to be fully populated
install: config: add option for setting up bond on management
interface
install: config: add option for setting up vlan on management
interface
install: network: set up management bond if requested
install: network: set up vlan on management interface if requested
gui: network: factor out name pinning into advanced options dialog
gui: network: add bond setup options to advanced options dialog
gui: network: add vlan setup options to advanced network dialog
auto: pass through management network bond options to low-level
installer
auto: pass through management network vlan options to low-level
installer
tui: drop long obsolete comment about logo formatting
tui: views: add widget for displaying a group of checkboxes
tui: network: factor out name pinning into advanced options dialog
tui: network: match form label style when enabling/disabling elements
tui: network: add bond setup options to advanced network dialog
tui: network: add vlan setup options to advanced network dialog
gui: network: split advanced options dialog into tabs
tui: network: split advanced options dialog into tabs
gui: network: list bond member candidates sharing a MAC address once
tui: network: list bond member candidates sharing a MAC address once
Cargo.toml | 4 +-
Proxmox/Install.pm | 244 ++++--
Proxmox/Install/Config.pm | 79 ++
Proxmox/Sys/Net.pm | 43 +
debian/control | 3 +-
proxinstall | 491 +++++++++--
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 113 ++-
proxmox-auto-installer/tests/parse-answer.rs | 12 +-
.../resources/parse_answer/network_bond.json | 25 +
.../resources/parse_answer/network_bond.toml | 20 +
.../parse_answer/network_bond_and_vlan.json | 29 +
.../parse_answer/network_bond_and_vlan.toml | 27 +
.../network_bond_with_filter.json | 24 +
.../network_bond_with_filter.toml | 22 +
...ace_pinning_mixed_case_mac_addresses.json} | 0
...ace_pinning_mixed_case_mac_addresses.toml} | 4 +-
.../resources/parse_answer/network_vlan.json | 23 +
.../resources/parse_answer/network_vlan.toml | 21 +
.../network_bond_invalid_hash_policy.json | 3 +
.../network_bond_invalid_hash_policy.toml | 20 +
.../network_bond_invalid_mode.json | 3 +
.../network_bond_invalid_mode.toml | 18 +
.../network_bond_primary_not_member.json | 3 +
.../network_bond_primary_not_member.toml | 19 +
.../network_bond_single_interface.json | 3 +
.../network_bond_single_interface.toml | 18 +
...rface_pinning_overlong_interface_name.json | 2 +-
.../network_vlan_invalid_vid.json | 3 +
.../network_vlan_invalid_vid.toml | 21 +
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 117 +--
proxmox-installer-common/src/setup.rs | 103 ++-
proxmox-post-hook/src/main.rs | 2 +-
proxmox-tui-installer/Cargo.toml | 1 +
proxmox-tui-installer/src/main.rs | 9 +-
proxmox-tui-installer/src/options.rs | 51 +-
proxmox-tui-installer/src/setup.rs | 20 +-
proxmox-tui-installer/src/views/mod.rs | 186 ++++-
proxmox-tui-installer/src/views/network.rs | 766 ++++++++++++++----
.../src/views/tabbed_view.rs | 7 +
test/Makefile | 6 +-
test/generate-ifupdown2-config.pl | 541 +++++++++++++
43 files changed, 2723 insertions(+), 385 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.json => network_interface_pinning_mixed_case_mac_addresses.json} (100%)
rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.toml => network_interface_pinning_mixed_case_mac_addresses.toml} (85%)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
create mode 100755 test/generate-ifupdown2-config.pl
^ permalink raw reply [relevance 16%]
* [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer
2026-11-06 13:10 16% [PATCH installer v5 00/23] fix #2164: add bond and vlan " Christoph Heiss
@ 2026-11-06 13:10 20% ` Christoph Heiss
2026-11-06 13:10 22% ` [PATCH installer v5 13/23] auto: pass through management network vlan " Christoph Heiss
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-06 13:10 UTC (permalink / raw)
To: pve-devel
Partially fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a management bond:
[network.bond]
members = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
mode = "active-backup"
hash-policy = "layer2+3"
primary-interface = "ab:cd:ef:12:34:57"
This then just passes through the given bond options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message that bonding is enabled.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v4 -> v5:
* rebased on applied `proxmox-installer-types` changes
Changes v3 -> v4:
* skip serializing disabled bond options to low-level config
* adapt to updated proxmox-installer-types, add support for
`members-filter`
Changes v2 -> v3:
* fixed typo in subject
* fixed patch section in Cargo.toml
Changes v1 -> v2:
* no changes
Cargo.toml | 2 +
debian/control | 1 +
proxmox-auto-installer/Cargo.toml | 1 +
proxmox-auto-installer/src/utils.rs | 99 ++++++++++++++++---
proxmox-auto-installer/tests/parse-answer.rs | 7 +-
.../resources/parse_answer/network_bond.json | 25 +++++
.../resources/parse_answer/network_bond.toml | 20 ++++
.../network_bond_with_filter.json | 24 +++++
.../network_bond_with_filter.toml | 22 +++++
.../network_bond_invalid_hash_policy.json | 3 +
.../network_bond_invalid_hash_policy.toml | 20 ++++
.../network_bond_invalid_mode.json | 3 +
.../network_bond_invalid_mode.toml | 18 ++++
.../network_bond_primary_not_member.json | 3 +
.../network_bond_primary_not_member.toml | 19 ++++
.../network_bond_single_interface.json | 3 +
.../network_bond_single_interface.toml | 18 ++++
proxmox-installer-common/Cargo.toml | 1 +
proxmox-installer-common/src/options.rs | 38 ++++---
proxmox-installer-common/src/setup.rs | 45 ++++++++-
20 files changed, 344 insertions(+), 28 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
diff --git a/Cargo.toml b/Cargo.toml
index 747608e..75b5628 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,11 +27,13 @@ serde_plain = "1.0"
toml = "0.8"
proxmox-auto-installer.path = "./proxmox-auto-installer"
proxmox-installer-common.path = "./proxmox-installer-common"
+proxmox-network-api = "1.0"
proxmox-network-types = "1.1"
proxmox-installer-types = { version = "0.3", features = ["legacy"] }
# Local path overrides
# NOTE: You must run `cargo update` after changing this for it to take effect!
[patch.crates-io]
+# proxmox-network-api.path = "../proxmox/proxmox-network-api"
# proxmox-network-types.path = "../proxmox/proxmox-network-types"
# proxmox-installer-types.path = "../proxmox/proxmox-installer-types"
diff --git a/debian/control b/debian/control
index e860819..0f09c02 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Build-Depends: cargo:native,
librust-pico-args-0.5-dev,
librust-pretty-assertions-1.4-dev,
librust-proxmox-installer-types-0.3+legacy-dev,
+ librust-proxmox-network-api-1-dev,
librust-proxmox-network-types-1-dev (>= 1.1-~~),
librust-proxmox-sys+crypt-dev,
librust-regex-1+default-dev (>= 1.7~~),
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 5ef2f4f..b7ca85d 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -15,6 +15,7 @@ anyhow.workspace = true
log.workspace = true
proxmox-installer-common = { workspace = true, features = ["http"] }
proxmox-network-types.workspace = true
+proxmox-network-api.workspace = true
proxmox-installer-types.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 9d27086..1a37314 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -1,31 +1,30 @@
use anyhow::{Context, Result, bail};
use glob::Pattern;
use log::{info, warn};
+use serde::{Deserialize, Serialize};
use std::{
collections::{BTreeMap, HashSet},
process::Command,
};
-use proxmox_installer_types::{
- UdevInfo,
- answer::{
- AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
- FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
- NetworkConfig,
- },
-};
-
use proxmox_installer_common::{
ROOT_PASSWORD_MIN_LENGTH,
disk_checks::check_swapsize,
options::{FilesystemDiskInfo, NetworkInterfacePinningOptions, NetworkOptions, email_validate},
setup::{
- InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallRootPassword,
- InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
+ InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallNetworkBondOptions,
+ InstallRootPassword, InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
},
};
-
-use serde::{Deserialize, Serialize};
+use proxmox_installer_types::{
+ UdevInfo,
+ answer::{
+ AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType,
+ FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode,
+ NetworkBondOptions, NetworkConfig,
+ },
+};
+use proxmox_network_types::MacAddress;
fn get_network_settings(
answer: &AutoInstallerConfig,
@@ -48,6 +47,7 @@ fn get_network_settings(
&runtime_info.network,
None,
pinning_opts.as_ref(),
+ answer.network.bond(),
);
opts.fqdn = name.to_owned();
opts
@@ -76,6 +76,7 @@ fn get_network_settings(
&runtime_info.network,
domain.as_deref(),
pinning_opts.as_ref(),
+ answer.network.bond(),
)
}
};
@@ -92,6 +93,37 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.bond_opts {
+ let members = match_selected_network_bond_members(opts, udev_info, runtime_info)?
+ .iter()
+ .fold(String::new(), |acc, mac| {
+ // Resolve either to the pinned name, if enabled, otherwise to the kernel-assigned one.
+ let name = network_options
+ .pinning_opts
+ .as_ref()
+ .and_then(|o| o.mapping.get(mac).cloned())
+ .or_else(|| {
+ runtime_info
+ .network
+ .interfaces
+ .iter()
+ .find_map(|(_, iface)| {
+ (iface.mac == *mac).then_some(iface.name.to_owned())
+ })
+ })
+ .unwrap_or("<unknown>".to_owned());
+
+ if acc.is_empty() {
+ name
+ } else {
+ format!("{acc}, {name}")
+ }
+ });
+
+ info!("Network interface bonding enabled on: {members}");
+ opts.verify()?;
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -192,7 +224,7 @@ pub fn get_matched_udev_indexes(
let mut did_match_all = true;
for (filter_key, filter_value) in filter {
let filter_pattern =
- Pattern::new(filter_value).context("invalid glob in disk selection")?;
+ Pattern::new(filter_value).context("invalid glob in filter selection")?;
for (udev_key, udev_value) in dev_values {
if udev_key == filter_key && filter_pattern.matches(udev_value) {
did_match_once = true;
@@ -328,6 +360,30 @@ fn set_selected_disks(
Ok(())
}
+fn match_selected_network_bond_members(
+ bond: &NetworkBondOptions,
+ udev_info: &UdevInfo,
+ runtime_info: &RuntimeInfo,
+) -> Result<Vec<MacAddress>> {
+ if bond.filter.is_empty() {
+ Ok(bond.members.clone())
+ } else {
+ let filter_match = bond.filter_match.unwrap_or_default();
+ // list of kernel-assigned names
+ let selected = get_matched_udev_indexes(
+ &bond.filter,
+ &udev_info.nics,
+ filter_match == FilterMatch::All,
+ )?
+ .into_iter()
+ .filter_map(|ifname| runtime_info.network.interfaces.get(&ifname))
+ .map(|iface| iface.mac)
+ .collect();
+
+ Ok(selected)
+ }
+}
+
fn get_first_selected_disk(config: &InstallConfig) -> usize {
config
.disk_selection
@@ -493,6 +549,10 @@ pub fn verify_network_settings(
}
}
+ if let Some(opts) = network.bond() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -552,6 +612,17 @@ pub fn parse_answer(
subscription_key: answer.global.subscription_key.clone(),
mngmt_nic: network_settings.ifname,
+ mngmt_bond: network_settings
+ .bond_opts
+ .map(|bond| -> Result<InstallNetworkBondOptions> {
+ Ok(InstallNetworkBondOptions {
+ members: match_selected_network_bond_members(&bond, udev_info, runtime_info)?,
+ mode: bond.mode,
+ hash_policy: bond.hash_policy,
+ primary_interface: bond.primary_interface,
+ })
+ })
+ .unwrap_or_else(|| Ok(InstallNetworkBondOptions::default()))?,
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index ae5b87d..0320bba 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -127,6 +127,7 @@ mod tests {
full_fqdn_from_dhcp_with_default_domain,
hashed_root_password,
minimal,
+ network_bond,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
nic_matching,
@@ -150,11 +151,15 @@ mod tests {
fqdn_hostname_only,
ipv4_and_subnet_mask_33,
lvm_swapsize_greater_than_hdsize,
+ network_bond_invalid_hash_policy,
+ network_bond_invalid_mode,
+ network_bond_primary_not_member,
+ network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
- zfs_raid_single_disk
+ zfs_raid_single_disk,
);
}
}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
new file mode 100644
index 0000000..cf0aa98
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
@@ -0,0 +1,25 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
new file mode 100644
index 0000000..dc6b7b0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
new file mode 100644
index 0000000..91a4723
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
@@ -0,0 +1,24 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "bond0",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer2"
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
new file mode 100644
index 0000000..849d93f
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
@@ -0,0 +1,22 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+# matches `eno1` and `eno2`
+filter.ID_NET_DRIVER = "igb"
+filter.ID_PATH = "pci-0000:c2:00.*"
+filter-match = "all"
+mode = "active-backup"
+hash-policy = "layer2"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
new file mode 100644
index 0000000..b76c9d6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `vlan+srcmac`, expected one of `layer2`, `layer2+3`, `layer3+4`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
new file mode 100644
index 0000000..af2789b
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
@@ -0,0 +1,20 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "vlan+srcmac"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
new file mode 100644
index 0000000..95461dc
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
@@ -0,0 +1,3 @@
+{
+ "parse-error": "error parsing answer.toml: unknown variant `non-existent-mode`, expected one of `balance-rr`, `active-backup`, `balance-xor`, `broadcast`, `802.3ad`, `balance-tlb`, `balance-alb`"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
new file mode 100644
index 0000000..79695da
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "non-existent-mode"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
new file mode 100644
index 0000000..7e64e92
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
@@ -0,0 +1,3 @@
+{
+ "error": "primary bond interface B4:2E:99:AC:AD:B6 must be a member of the bond (members: B4:2E:99:AC:AD:B4, B4:2E:99:AC:AD:B5)"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
new file mode 100644
index 0000000..fab400a
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
@@ -0,0 +1,19 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+primary-interface = "b4:2e:99:ac:ad:b6"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
new file mode 100644
index 0000000..730fad6
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
@@ -0,0 +1,3 @@
+{
+ "error": "bond setup requires at least 2 interfaces, got 1"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
new file mode 100644
index 0000000..b035cef
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
@@ -0,0 +1,18 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-dhcp"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4"]
+mode = "balance-rr"
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/Cargo.toml b/proxmox-installer-common/Cargo.toml
index 7682680..a283094 100644
--- a/proxmox-installer-common/Cargo.toml
+++ b/proxmox-installer-common/Cargo.toml
@@ -13,6 +13,7 @@ regex.workspace = true
serde = { workspace = true, features = [ "derive" ] }
serde_json.workspace = true
serde_plain.workspace = true
+proxmox-network-api.workspace = true
proxmox-network-types.workspace = true
proxmox-installer-types.workspace = true
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index fbbfe77..1add63b 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -15,8 +15,8 @@ use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
- BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkInterfacePinningOptionsAnswer,
- ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
+ NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -395,6 +395,7 @@ pub struct NetworkOptions {
pub gateway: IpAddr,
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
+ pub bond_opts: Option<NetworkBondOptions>,
}
impl NetworkOptions {
@@ -405,6 +406,7 @@ impl NetworkOptions {
network: &NetworkInfo,
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
+ bond_opts: Option<&NetworkBondOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -417,6 +419,7 @@ impl NetworkOptions {
gateway: Ipv4Addr::new(192, 168, 100, 1).into(),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
+ bond_opts: bond_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -479,6 +482,10 @@ impl NetworkOptions {
}
}
+ if this.bond_opts.is_some() {
+ this.ifname = "bond0".to_owned();
+ }
+
this
}
@@ -632,7 +639,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -640,12 +647,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -653,12 +661,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -666,12 +675,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -679,6 +689,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -726,7 +737,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -734,6 +745,7 @@ mod tests {
gateway: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1)),
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -743,7 +755,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -751,12 +763,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -764,12 +777,13 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -777,6 +791,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
@@ -813,7 +828,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -821,6 +836,7 @@ mod tests {
gateway: IpAddr::V4(Ipv4Addr::new(192, 168, 100, 1)),
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
+ bond_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 14882bc..31a1195 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -16,8 +16,12 @@ use crate::options::{
};
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
- answer::{BtrfsCompressOption, FilesystemType, ZfsChecksumOption, ZfsCompressOption},
+ answer::{
+ BtrfsCompressOption, FilesystemType, ZfsChecksumOption,
+ ZfsCompressOption,
+ },
};
+use proxmox_network_api::{BondXmitHashPolicy, LinuxBondMode};
use proxmox_network_types::{Cidr, MacAddress};
/// Paths in the ISO environment containing installer data.
@@ -326,7 +330,8 @@ pub struct NetworkInfo {
pub dns: Dns,
pub routes: Routes,
- /// Maps devices to their configuration, if it has a usable configuration.
+ /// Maps devices to their configuration, if it has a usable configuration, keyed by their
+ /// kernel-assigned interface name.
/// (Contains no entries for devices with only link-local addresses.)
#[serde(default)]
pub interfaces: BTreeMap<String, Interface>,
@@ -488,6 +493,39 @@ pub fn spawn_low_level_installer(test_mode: bool) -> io::Result<process::Child>
.spawn()
}
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "kebab-case")]
+/// Options for creating a bond for the management interface with the given
+/// physical interfaces and mode.
+pub struct InstallNetworkBondOptions {
+ /// List of interface MAC addresses to add as bond members.
+ pub members: Vec<MacAddress>,
+ /// Mode for the bond to set.
+ pub mode: LinuxBondMode,
+ /// Bond hash policy. Only used with '802.3ad' and 'balance-xor' mode.
+ pub hash_policy: BondXmitHashPolicy,
+ /// Primary bond interface. Only used with 'active-backup' mode.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub primary_interface: Option<MacAddress>,
+}
+
+impl Default for InstallNetworkBondOptions {
+ fn default() -> Self {
+ Self {
+ members: Vec::new(),
+ mode: LinuxBondMode::ActiveBackup,
+ hash_policy: BondXmitHashPolicy::Layer2,
+ primary_interface: None,
+ }
+ }
+}
+
+impl InstallNetworkBondOptions {
+ fn is_disabled(&self) -> bool {
+ self.members.is_empty()
+ }
+}
+
/// See Proxmox::Install::Config
#[derive(Debug, Deserialize, Serialize)]
pub struct InstallConfig {
@@ -530,6 +568,9 @@ pub struct InstallConfig {
pub subscription_key: Option<String>,
pub mngmt_nic: String,
+ #[serde(skip_serializing_if = "InstallNetworkBondOptions::is_disabled")]
+ pub mngmt_bond: InstallNetworkBondOptions,
+
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
#[serde(
--
2.56.0
^ permalink raw reply related [relevance 20%]
* [PATCH installer v5 13/23] auto: pass through management network vlan options to low-level installer
2026-11-06 13:10 16% [PATCH installer v5 00/23] fix #2164: add bond and vlan " Christoph Heiss
2026-11-06 13:10 20% ` [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer Christoph Heiss
@ 2026-11-06 13:10 22% ` Christoph Heiss
2026-11-06 13:10 18% ` [PATCH installer v5 19/23] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-07 22:07 15% ` applied: [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers Thomas Lamprecht
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-06 13:10 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0].
The auto-installer gains a new section under [network] in its answer
file for setting up a VLAN on the management interface during the
installation:
[network.vlan]
vid = 5
Where `vid` is the desired VLAN ID.
This then just passes through the given VLAN options in the answer file
to the low-level installation configuration, verifying them beforehand
and printing a status message if the management interface will be put on
a VLAN.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v4 -> v5:
* make `InstallNetworkVlanOptions::enabled` de-/serialize from/to
an integer to make it compatible with the Perl-generated JSON
Changes v3 -> v4:
* skip serializing disabled vlan options to low-level config
Changes v2 -> v3:
* new patch
proxmox-auto-installer/src/utils.rs | 14 ++++++++
proxmox-auto-installer/tests/parse-answer.rs | 3 ++
.../parse_answer/network_bond_and_vlan.json | 29 ++++++++++++++++
.../parse_answer/network_bond_and_vlan.toml | 27 +++++++++++++++
.../resources/parse_answer/network_vlan.json | 23 +++++++++++++
.../resources/parse_answer/network_vlan.toml | 21 ++++++++++++
.../network_vlan_invalid_vid.json | 3 ++
.../network_vlan_invalid_vid.toml | 21 ++++++++++++
proxmox-installer-common/src/options.rs | 33 +++++++++++++------
proxmox-installer-common/src/setup.rs | 32 +++++++++++++++++-
10 files changed, 195 insertions(+), 11 deletions(-)
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 1a37314..b24dc9d 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -48,6 +48,7 @@ fn get_network_settings(
None,
pinning_opts.as_ref(),
answer.network.bond(),
+ answer.network.vlan(),
);
opts.fqdn = name.to_owned();
opts
@@ -77,6 +78,7 @@ fn get_network_settings(
domain.as_deref(),
pinning_opts.as_ref(),
answer.network.bond(),
+ answer.network.vlan(),
)
}
};
@@ -124,6 +126,10 @@ fn get_network_settings(
opts.verify()?;
}
+ if let Some(opts) = &network_options.vlan_opts {
+ info!("Management interface reachable on VLAN {}", opts.vid);
+ }
+
info!("Network interface used is '{}'", &network_options.ifname);
Ok(network_options)
}
@@ -553,6 +559,10 @@ pub fn verify_network_settings(
opts.verify()?;
}
+ if let Some(opts) = network.vlan() {
+ opts.verify()?;
+ }
+
Ok(())
}
@@ -623,6 +633,10 @@ pub fn parse_answer(
})
})
.unwrap_or_else(|| Ok(InstallNetworkBondOptions::default()))?,
+ mngmt_vlan: network_settings
+ .vlan_opts
+ .map(|opts| opts.into())
+ .unwrap_or_default(),
network_interface_pin_map: network_settings
.pinning_opts
.map(|o| o.mapping)
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 0320bba..4776c4d 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -128,8 +128,10 @@ mod tests {
hashed_root_password,
minimal,
network_bond,
+ network_bond_and_vlan,
network_interface_pinning,
network_interface_pinning_mixed_case_mac_addresses,
+ network_vlan,
nic_matching,
no_network,
specific_nic,
@@ -156,6 +158,7 @@ mod tests {
network_bond_primary_not_member,
network_bond_single_interface,
network_interface_pinning_overlong_interface_name,
+ network_vlan_invalid_vid,
no_fqdn_from_dhcp,
no_root_password_set,
short_password,
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
new file mode 100644
index 0000000..ef67609
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
@@ -0,0 +1,29 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "eno1",
+ "mngmt_bond": {
+ "members": ["B4:2E:99:AC:AD:B4", "B4:2E:99:AC:AD:B5"],
+ "mode": "active-backup",
+ "hash-policy": "layer3+4",
+ "primary-interface": "B4:2E:99:AC:AD:B5"
+ },
+ "mngmt_vlan": {
+ "enabled": 1,
+ "vid": 5
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
new file mode 100644
index 0000000..4c76f8f
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
@@ -0,0 +1,27 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-answer"
+cidr = "192.168.1.114/24"
+gateway = "192.168.1.1"
+dns = "192.168.1.254"
+filter.ID_NET_NAME = "eno1"
+
+[network.bond]
+members = ["b4:2e:99:ac:ad:b4", "b4:2e:99:ac:ad:b5"]
+mode = "active-backup"
+hash-policy = "layer3+4"
+primary-interface = "b4:2e:99:ac:ad:b5"
+
+[network.vlan]
+vid = 5
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
new file mode 100644
index 0000000..e579eb0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
@@ -0,0 +1,23 @@
+{
+ "autoreboot": 1,
+ "cidr": "192.168.1.114/24",
+ "country": "at",
+ "dns": "192.168.1.254",
+ "domain": "testinstall",
+ "filesys": "ext4",
+ "gateway": "192.168.1.1",
+ "hdsize": 223.57088470458984,
+ "existing_storage_auto_rename": 1,
+ "hostname": "pveauto",
+ "keymap": "de",
+ "mailto": "mail@no.invalid",
+ "mngmt_nic": "eno1",
+ "mngmt_vlan": {
+ "enabled": 1,
+ "vid": 5
+ },
+ "root_password": { "plain": "12345678" },
+ "target_hd": "/dev/sda",
+ "timezone": "Europe/Vienna",
+ "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
new file mode 100644
index 0000000..981aa80
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
@@ -0,0 +1,21 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-answer"
+cidr = "192.168.1.114/24"
+gateway = "192.168.1.1"
+dns = "192.168.1.254"
+filter.ID_NET_NAME = "eno1"
+
+[network.vlan]
+vid = 5
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
new file mode 100644
index 0000000..91590fa
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
@@ -0,0 +1,3 @@
+{
+ "error": "VLAN tag must be between 2 and 4094 inclusive, got 5000"
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
new file mode 100644
index 0000000..0e8cba0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
@@ -0,0 +1,21 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root-password = "12345678"
+
+[network]
+source = "from-answer"
+cidr = "192.168.0.10/24"
+gateway = "192.168.0.1"
+dns = "192.168.0.1"
+filter.ID_NET_NAME = "eno1"
+
+[network.vlan]
+vid = 5000
+
+[disk-setup]
+filesystem = "ext4"
+disk-list = ["sda"]
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 1add63b..e32b77d 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -16,7 +16,8 @@ use proxmox_installer_types::{
EMAIL_DEFAULT_PLACEHOLDER,
answer::{
BtrfsCompressOption, BtrfsRaidLevel, FilesystemType, NetworkBondOptions,
- NetworkInterfacePinningOptionsAnswer, ZfsChecksumOption, ZfsCompressOption, ZfsRaidLevel,
+ NetworkInterfacePinningOptionsAnswer, NetworkVlanOptions, ZfsChecksumOption,
+ ZfsCompressOption, ZfsRaidLevel,
},
};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
@@ -396,6 +397,7 @@ pub struct NetworkOptions {
pub dns_server: IpAddr,
pub pinning_opts: Option<NetworkInterfacePinningOptions>,
pub bond_opts: Option<NetworkBondOptions>,
+ pub vlan_opts: Option<NetworkVlanOptions>,
}
impl NetworkOptions {
@@ -407,6 +409,7 @@ impl NetworkOptions {
default_domain: Option<&str>,
pinning_opts: Option<&NetworkInterfacePinningOptions>,
bond_opts: Option<&NetworkBondOptions>,
+ vlan_opts: Option<&NetworkVlanOptions>,
) -> Self {
// Sets up sensible defaults as much as possible, such that even in the
// worse case nothing breaks down *completely*.
@@ -420,6 +423,7 @@ impl NetworkOptions {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: pinning_opts.cloned(),
bond_opts: bond_opts.cloned(),
+ vlan_opts: vlan_opts.cloned(),
};
let iface = if let Some(gw) = &network.routes.gateway4
@@ -639,7 +643,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -648,12 +652,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.hostname = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.bar.com").unwrap(),
@@ -662,12 +667,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -676,12 +682,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.hostname = Some("foo".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.example.invalid").unwrap(),
@@ -690,6 +697,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -737,7 +745,7 @@ mod tests {
let (setup, info) = mock_setup_network_v6_only();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -746,6 +754,7 @@ mod tests {
dns_server: IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x53)),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -755,7 +764,7 @@ mod tests {
let (setup, mut info) = mock_setup_network();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.bar.com").unwrap(),
@@ -764,12 +773,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = None;
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -778,12 +788,13 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
info.dns.domain = Some("some.domain.local".to_owned());
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None),
+ NetworkOptions::defaults_from(&setup, &info, Some("custom.local"), None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("foo.custom.local").unwrap(),
@@ -792,6 +803,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
@@ -828,7 +840,7 @@ mod tests {
let setup = SetupInfo::mocked();
pretty_assertions::assert_eq!(
- NetworkOptions::defaults_from(&setup, &info, None, None, None),
+ NetworkOptions::defaults_from(&setup, &info, None, None, None, None),
NetworkOptions {
ifname: "eth0".to_owned(),
fqdn: Fqdn::from("pve.example.invalid").unwrap(),
@@ -837,6 +849,7 @@ mod tests {
dns_server: Ipv4Addr::new(192, 168, 100, 1).into(),
pinning_opts: None,
bond_opts: None,
+ vlan_opts: None,
}
);
}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 31a1195..c8888d2 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -17,7 +17,7 @@ use crate::options::{
use proxmox_installer_types::{
BootType, IsoInfo, ProductConfig,
answer::{
- BtrfsCompressOption, FilesystemType, ZfsChecksumOption,
+ BtrfsCompressOption, FilesystemType, NetworkVlanOptions, ZfsChecksumOption,
ZfsCompressOption,
},
};
@@ -526,6 +526,34 @@ impl InstallNetworkBondOptions {
}
}
+#[derive(Clone, Default, Debug, Deserialize, Serialize, PartialEq)]
+/// Low-level installer options for setting up a VLAN configuration on the management interface.
+pub struct InstallNetworkVlanOptions {
+ /// Whether to enable VLAN tagging on the management interface
+ #[serde(
+ serialize_with = "serialize_bool_as_u32",
+ deserialize_with = "deserialize_bool_from_int"
+ )]
+ enabled: bool,
+ /// VLAN tag to configure.
+ pub vid: u16,
+}
+
+impl From<NetworkVlanOptions> for InstallNetworkVlanOptions {
+ fn from(opts: NetworkVlanOptions) -> Self {
+ Self {
+ enabled: true,
+ vid: opts.vid,
+ }
+ }
+}
+
+impl InstallNetworkVlanOptions {
+ fn is_disabled(&self) -> bool {
+ !self.enabled
+ }
+}
+
/// See Proxmox::Install::Config
#[derive(Debug, Deserialize, Serialize)]
pub struct InstallConfig {
@@ -570,6 +598,8 @@ pub struct InstallConfig {
pub mngmt_nic: String,
#[serde(skip_serializing_if = "InstallNetworkBondOptions::is_disabled")]
pub mngmt_bond: InstallNetworkBondOptions,
+ #[serde(skip_serializing_if = "InstallNetworkVlanOptions::is_disabled")]
+ pub mngmt_vlan: InstallNetworkVlanOptions,
// Maps MAC addresses -> custom name. If set, enables pinning for all
// interfaces present.
--
2.56.0
^ permalink raw reply related [relevance 22%]
* Re: [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers
2026-11-02 12:45 15% [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
` (2 preceding siblings ...)
2026-11-02 12:45 18% ` [PATCH installer v4 26/30] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
@ 2026-11-06 13:12 7% ` Christoph Heiss
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-06 13:12 UTC (permalink / raw)
To: pve-devel
Superseded by:
https://lore.proxmox.com/pve-devel/20261106131058.804870-1-c.heiss@proxmox.com/
On 11/2/26 13:46, Christoph Heiss wrote:
> Fixes #2164 [0] by adding the possibility to set up a bond and set a
> VLAN ID for the management interface during the installation, for all of
> GUI, TUI and auto-installer.
>
> For the GUI and TUI, the current name pinning dialog is converted into a
> full-fledged advanced network options dialog, in the same vein as with
> the bootdisk options.
>
> This makes it practical to then add additional networking options, in
> this case bond and VLAN options.
>
> The auto-installer gains two new sections under [network]:
>
> [network.bond]
> members-list = ["ab:cd:ef:12:34:56", "ab:cd:ef:12:34:57"]
> # or, alternatively
> members-filter.ID_NET_DRIVER = "igc"
> members-filter-match = "all"
> # general bond options
> mode = "active-backup"
> hash-policy = "layer2+3"
> primary-interface = "ab:cd:ef:12:34:57"
>
> [network.vlan]
> vid = 5
>
> Both being of course independent of each other.
>
> The respective PDM integration will be sent separately.
>
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
>
> History
> =======
> v3: off-list review sample
> v2: https://lore.proxmox.com/pve-devel/20261020112327.641633-1-c.heiss@proxmox.com/
> v1: https://lore.proxmox.com/pve-devel/20260908101647.1057780-1-c.heiss@proxmox.com/
>
> Notable changes v3 -> v4:
> * add some `Display` derives for proxmox-installer-types
> * fixed expanding of tab page contents, which caused unnecessary padding
>
> Notable changes v2 -> v3:
> * added VLAN configuration support
> * rebased atop @Thomas changes, including some patches from him
> * split bond member selection into static list and udev filters
>
> Notable changes v1 -> v2:
> * rebased on latest masters for each repo
> * fixed a bug in the GUI installer, passing an invalid index to GTK with a
> bond set up
>
> Questions
> =========
>
> 1. Since we now discourage the use of the 'balance-alb' and 'balance-tlb'
> modes in combination with a Linux bridge (as of [1]), should these not
> even be available for selection here?
>
> 2. For the Rust part, it reuses the already existing bond types from the
> 'proxmox-network-api' crate. Given that they are pretty universal rather,
> than just completely API-specific, would it make sense to move them into
> 'proxmox-network-types' instead?
> @Stefan might have some comment on this as well, as we discussed that
> off-list recently as well.
>
> [1] https://lore.proxmox.com/pve-devel/20260828095721.263382-1-m.sandoval@proxmox.com/
>
> Diffstat
> ========
>
> proxmox:
>
> Christoph Heiss (8):
> installer-types: clippy: use .is_multiple_of() instead of manual
> modulo
> installer-types: use `MacAddress` type where applicable
> installer-types: derive Display for RebootMode and FilterMatch
> installer-types: answer: add options for configuring management bond
> installer-types: answer: add options for configuring management vlan
> installer-types: bump fetch schema for bond and VLAN answer options
> installer-types: bump version to 0.3.0-1
> network-api: derive Display and FromStr for network bond types
>
> Cargo.toml | 1 +
> proxmox-installer-types/Cargo.toml | 3 +-
> proxmox-installer-types/debian/changelog | 21 +
> proxmox-installer-types/debian/control | 18 +-
> proxmox-installer-types/src/answer.rs | 486 ++++++++++++++++++++++-
> proxmox-installer-types/src/post_hook.rs | 4 +-
> proxmox-network-api/Cargo.toml | 1 +
> proxmox-network-api/debian/control | 6 +-
> proxmox-network-api/src/api_types.rs | 27 +-
> 9 files changed, 524 insertions(+), 43 deletions(-)
>
> pve-installer:
>
> Christoph Heiss (22):
> install: run make tidy
> tree-wide: use `MacAddress` type instead of string for MAC addresses
> install: factor out ifupdown2 config generation into own subroutine
> install: do not rely on interface name map to be fully populated
> install: config: add option for setting up bond on management
> interface
> install: config: add option for setting up vlan on management
> interface
> install: network: set up management bond if requested
> install: network: set up vlan on management interface if requested
> gui: network: factor out name pinning into advanced options dialog
> gui: network: add bond setup options to advanced options dialog
> gui: network: add vlan setup options to advanced network dialog
> auto: pass through management network bond options to low-level
> installer
> auto: pass through management network vlan options to low-level
> installer
> tui: drop long obsolete comment about logo formatting
> tui: views: add widget for displaying a group of checkboxes
> tui: network: factor out name pinning into advanced options dialog
> tui: network: add bond setup options to advanced network dialog
> tui: network: add vlan setup options to advanced network dialog
> gui: network: split advanced options dialog into tabs
> tui: network: split advanced options dialog into tabs
> gui: network: list bond member candidates sharing a MAC address once
> tui: network: list bond member candidates sharing a MAC address once
>
> Cargo.toml | 4 +-
> Proxmox/Install.pm | 244 ++++--
> Proxmox/Install/Config.pm | 79 ++
> Proxmox/Sys/Net.pm | 43 +
> debian/control | 3 +-
> proxinstall | 491 +++++++++--
> proxmox-auto-installer/Cargo.toml | 1 +
> proxmox-auto-installer/src/utils.rs | 115 ++-
> proxmox-auto-installer/tests/parse-answer.rs | 12 +-
> .../resources/parse_answer/network_bond.json | 25 +
> .../resources/parse_answer/network_bond.toml | 20 +
> .../parse_answer/network_bond_and_vlan.json | 29 +
> .../parse_answer/network_bond_and_vlan.toml | 23 +
> .../network_bond_with_filter.json | 24 +
> .../network_bond_with_filter.toml | 22 +
> ...ace_pinning_mixed_case_mac_addresses.json} | 0
> ...ace_pinning_mixed_case_mac_addresses.toml} | 4 +-
> .../resources/parse_answer/network_vlan.json | 23 +
> .../resources/parse_answer/network_vlan.toml | 17 +
> .../network_bond_invalid_hash_policy.json | 3 +
> .../network_bond_invalid_hash_policy.toml | 20 +
> .../network_bond_invalid_mode.json | 3 +
> .../network_bond_invalid_mode.toml | 18 +
> .../network_bond_primary_not_member.json | 3 +
> .../network_bond_primary_not_member.toml | 19 +
> .../network_bond_single_interface.json | 3 +
> .../network_bond_single_interface.toml | 18 +
> ...rface_pinning_overlong_interface_name.json | 2 +-
> .../network_vlan_invalid_vid.json | 3 +
> .../network_vlan_invalid_vid.toml | 17 +
> proxmox-installer-common/Cargo.toml | 1 +
> proxmox-installer-common/src/options.rs | 117 +--
> proxmox-installer-common/src/setup.rs | 99 ++-
> proxmox-post-hook/src/main.rs | 2 +-
> proxmox-tui-installer/Cargo.toml | 1 +
> proxmox-tui-installer/src/main.rs | 9 +-
> proxmox-tui-installer/src/options.rs | 51 +-
> proxmox-tui-installer/src/setup.rs | 20 +-
> proxmox-tui-installer/src/views/mod.rs | 141 +++-
> proxmox-tui-installer/src/views/network.rs | 762 ++++++++++++++----
> .../src/views/tabbed_view.rs | 7 +
> test/Makefile | 6 +-
> test/generate-ifupdown2-config.pl | 541 +++++++++++++
> 43 files changed, 2661 insertions(+), 384 deletions(-)
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_and_vlan.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_bond_with_filter.toml
> rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.json => network_interface_pinning_mixed_case_mac_addresses.json} (100%)
> rename proxmox-auto-installer/tests/resources/parse_answer/{network_interface_pinning_uppercase_mac_address.toml => network_interface_pinning_mixed_case_mac_addresses.toml} (85%)
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/network_vlan.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_hash_policy.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_invalid_mode.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_primary_not_member.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_bond_single_interface.toml
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.json
> create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/network_vlan_invalid_vid.toml
> create mode 100755 test/generate-ifupdown2-config.pl
^ permalink raw reply [relevance 7%]
* [PATCH installer v5 19/23] tui: network: add vlan setup options to advanced network dialog
2026-11-06 13:10 16% [PATCH installer v5 00/23] fix #2164: add bond and vlan " Christoph Heiss
2026-11-06 13:10 20% ` [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-06 13:10 22% ` [PATCH installer v5 13/23] auto: pass through management network vlan " Christoph Heiss
@ 2026-11-06 13:10 18% ` Christoph Heiss
2026-11-07 22:07 15% ` applied: [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers Thomas Lamprecht
3 siblings, 0 replies; 14+ results
From: Christoph Heiss @ 2026-11-06 13:10 UTC (permalink / raw)
To: pve-devel
Fixes #2164 [0].
Adds a third panel to the advanced network options dialog, allowing the
user to set a VLAN ID for the management interface.
[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2164
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v4 -> v5:
* also toggle form labels with the state
Changes v3 -> v4:
* no changes
Changes v2 -> v3:
* no changes
Changes v1 -> v2:
* new patch
proxmox-tui-installer/src/main.rs | 1 +
proxmox-tui-installer/src/options.rs | 6 +-
proxmox-tui-installer/src/setup.rs | 5 +
proxmox-tui-installer/src/views/mod.rs | 35 +++++--
proxmox-tui-installer/src/views/network.rs | 116 ++++++++++++++++++++-
5 files changed, 151 insertions(+), 12 deletions(-)
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 6e7c691..cd3b0ec 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -178,6 +178,7 @@ fn main() {
// We enable network interface pinning by default in the TUI
Some(&NetworkInterfacePinningOptions::default()),
None,
+ None,
),
autoreboot: true,
},
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index 6fcdecb..fc54b99 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -42,7 +42,7 @@ impl InstallerOptions {
.map(|l| &l.name)
.unwrap_or(&self.timezone.kb_layout);
- let mngmt_interface = if let Some(opts) = &self.network.bond_opts {
+ let mut mngmt_interface = if let Some(opts) = &self.network.bond_opts {
let members = self
.resolve_bond_member_names(opts, &runtime_info.network)
.join(" | ");
@@ -52,6 +52,10 @@ impl InstallerOptions {
self.network.ifname.to_owned()
};
+ if let Some(opts) = &self.network.vlan_opts {
+ mngmt_interface += &format!(", VLAN {}", opts.vid);
+ }
+
vec![
SummaryOption::new("Bootdisk filesystem", self.bootdisk.fstype.to_string()),
SummaryOption::new(
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index aecbe10..9410bfe 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -48,6 +48,11 @@ impl From<InstallerOptions> for InstallConfig {
}
})
.unwrap_or_default(),
+ mngmt_vlan: options
+ .network
+ .vlan_opts
+ .map(|opts| opts.into())
+ .unwrap_or_default(),
network_interface_pin_map: pinning_opts.map(|o| o.mapping.clone()).unwrap_or_default(),
hostname: options.network.fqdn.host().to_owned(),
diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
index 3a6a00d..760b467 100644
--- a/proxmox-tui-installer/src/views/mod.rs
+++ b/proxmox-tui-installer/src/views/mod.rs
@@ -31,6 +31,7 @@ pub use timezone::*;
pub struct NumericEditView<T> {
view: LinearLayout,
+ min_value: Option<T>,
max_value: Option<T>,
placeholder: Option<T>,
max_content_width: Option<usize>,
@@ -44,6 +45,7 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
Self {
view,
+ min_value: None,
max_value: None,
placeholder: None,
max_content_width: None,
@@ -63,6 +65,7 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
Self {
view,
+ min_value: None,
max_value: None,
placeholder: None,
max_content_width: None,
@@ -70,6 +73,16 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
}
}
+ pub fn enabled(mut self, enabled: bool) -> Self {
+ self.inner_mut().set_enabled(enabled);
+ self
+ }
+
+ pub fn min_value(mut self, min: T) -> Self {
+ self.min_value = Some(min);
+ self
+ }
+
pub fn max_value(mut self, max: T) -> Self {
self.max_value = Some(max);
self
@@ -139,13 +152,23 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
self.max_value = Some(max);
}
+ pub fn set_enabled(&mut self, enabled: bool) {
+ self.inner_mut().set_enabled(enabled);
+ }
+
+ /// Checks if the new value is actually valid according to the min and max value, if set
fn check_bounds(&mut self, original: Arc<String>, result: EventResult) -> EventResult {
- // Check if the new value is actually valid according to the max value, if set
- if let Some(max) = self.max_value
- && let Ok(val) = self.get_content()
- && result.is_consumed()
- && val > max
- {
+ let above_min = self
+ .min_value
+ .map(|min| self.get_content().map(|val| val >= min).unwrap_or(true))
+ .unwrap_or(true);
+
+ let below_max = self
+ .max_value
+ .map(|max| self.get_content().map(|val| val <= max).unwrap_or(true))
+ .unwrap_or(true);
+
+ if result.is_consumed() && (!above_min || !below_max) {
// Restore the original value, before the insert
let cb = self.inner_mut().set_content((*original).clone());
return EventResult::with_cb_once(move |siv| {
diff --git a/proxmox-tui-installer/src/views/network.rs b/proxmox-tui-installer/src/views/network.rs
index 785f957..929cb9c 100644
--- a/proxmox-tui-installer/src/views/network.rs
+++ b/proxmox-tui-installer/src/views/network.rs
@@ -18,15 +18,16 @@ use proxmox_installer_common::{
options::{NetworkInterfacePinningOptions, NetworkOptions},
setup::{Interface, NetworkInfo},
};
-use proxmox_installer_types::answer::NetworkBondOptions;
+use proxmox_installer_types::answer::{NetworkBondOptions, NetworkVlanOptions};
use proxmox_network_api::{BondXmitHashPolicy, LinuxBondMode};
use proxmox_network_types::{MacAddress, fqdn::Fqdn, ip_address::Cidr};
-use super::{CheckboxGroup, CidrAddressEditView, FormView};
+use super::{CheckboxGroup, CidrAddressEditView, FormView, IntegerEditView};
struct NetworkViewOptions {
pinning_enabled: bool,
bond_enabled: bool,
+ vlan_enabled: bool,
interfaces: Vec<Interface>,
/// Last selected interface (by its MAC address) in the [SelectView].
/// Keeps track of the selected interface across enabling/disabling bonding, which replaces the
@@ -36,6 +37,7 @@ struct NetworkViewOptions {
// by the user - to preserve the state between toggling the checkbox
pinning_options: NetworkInterfacePinningOptions,
bond_options: NetworkBondOptions,
+ vlan_options: NetworkVlanOptions,
}
/// Convenience wrapper when needing to take a (interior-mutable) reference to
@@ -55,6 +57,7 @@ impl NetworkOptionsView {
const INTERFACE_PINNING_VIEW_NAME: &str = "network-name-pinning-view";
const BOND_OPTIONS_VIEW_NAME: &str = "network-bond-options-view";
+ const VLAN_OPTIONS_VIEW_NAME: &str = "network-vlan-options-view";
pub fn new(options: &NetworkOptions, network_info: &NetworkInfo) -> Self {
let mut interfaces = network_info
@@ -80,10 +83,15 @@ impl NetworkOptionsView {
let options_ref = Arc::new(Mutex::new(NetworkViewOptions {
pinning_enabled: options.pinning_opts.is_some(),
bond_enabled: options.bond_opts.is_some(),
+ vlan_enabled: options.vlan_opts.is_some(),
interfaces,
last_selected_iface: selected_mac,
pinning_options: options.pinning_opts.clone().unwrap_or_default(),
bond_options: options.bond_opts.clone().unwrap_or_default(),
+ vlan_options: options
+ .vlan_opts
+ .clone()
+ .unwrap_or(NetworkVlanOptions { vid: 0 }),
}));
let iface_selection = Self::build_mgmt_ifname_selectview(options_ref.clone());
@@ -178,6 +186,7 @@ impl NetworkOptionsView {
.then_some(options.pinning_options.clone());
let bond_opts = options.bond_enabled.then_some(options.bond_options.clone());
+ let vlan_opts = options.vlan_enabled.then_some(options.vlan_options.clone());
let ifname = if options.bond_enabled {
"bond0".to_owned()
@@ -208,6 +217,7 @@ impl NetworkOptionsView {
dns_server,
pinning_opts,
bond_opts,
+ vlan_opts,
})
}
}
@@ -222,6 +232,10 @@ impl NetworkOptionsView {
.child(Panel::new(
BondOptionsView::new(options_ref.clone())
.with_name(Self::BOND_OPTIONS_VIEW_NAME),
+ ))
+ .child(Panel::new(
+ VlanOptionsView::new(options_ref.clone())
+ .with_name(Self::VLAN_OPTIONS_VIEW_NAME),
)),
);
@@ -230,11 +244,12 @@ impl NetworkOptionsView {
.button("Ok", {
move |siv| {
match Self::get_view_values(siv, options_ref.clone()) {
- Ok((pin_opts, bond_opts)) => {
+ Ok((pin_opts, bond_opts, vlan_opts)) => {
siv.pop_layer();
let options = &mut options_ref.lock().expect("unpoisoned lock");
options.pinning_options = pin_opts;
options.bond_options = bond_opts;
+ options.vlan_options = vlan_opts;
}
Err(err) => {
siv.add_layer(Dialog::info(err.to_string()));
@@ -251,7 +266,11 @@ impl NetworkOptionsView {
fn get_view_values(
siv: &mut Cursive,
options_ref: NetworkViewOptionsRef,
- ) -> Result<(NetworkInterfacePinningOptions, NetworkBondOptions)> {
+ ) -> Result<(
+ NetworkInterfacePinningOptions,
+ NetworkBondOptions,
+ NetworkVlanOptions,
+ )> {
let pin_opts = siv
.call_on_name(
Self::INTERFACE_PINNING_VIEW_NAME,
@@ -273,7 +292,19 @@ impl NetworkOptionsView {
bond_opts.verify()?;
}
- Ok((pin_opts, bond_opts))
+ let vlan_opts = siv
+ .call_on_name(Self::VLAN_OPTIONS_VIEW_NAME, VlanOptionsView::get_values)
+ .unwrap_or_else(|| bail!("failed to retrieve management network VLAN options"))?;
+
+ if options_ref
+ .lock()
+ .map(|opts| opts.vlan_enabled)
+ .unwrap_or(false)
+ {
+ vlan_opts.verify()?;
+ }
+
+ Ok((pin_opts, bond_opts, vlan_opts))
}
fn refresh_ifname_view(siv: &mut Cursive, options_ref: NetworkViewOptionsRef) {
@@ -747,3 +778,78 @@ impl BondOptionsView {
impl ViewWrapper for BondOptionsView {
cursive::wrap_impl!(self.view: LinearLayout);
}
+
+struct VlanOptionsView {
+ view: LinearLayout,
+}
+
+impl VlanOptionsView {
+ const FORM_NAME: &str = "network-vlan-form-view";
+
+ fn new(options_ref: NetworkViewOptionsRef) -> Self {
+ let options = &options_ref.lock().expect("unpoisoned lock");
+
+ let view = LinearLayout::vertical()
+ .child(
+ LinearLayout::horizontal()
+ .child(
+ Checkbox::new()
+ .with_checked(options.vlan_enabled)
+ .on_change({
+ let options_ref = options_ref.clone();
+ move |siv, enabled| {
+ options_ref.lock().expect("unpoisoned lock").vlan_enabled =
+ enabled;
+ Self::toggle_all(siv, enabled);
+ }
+ }),
+ )
+ .child(TextView::new(" Enable VLAN setup on management interface").no_wrap()),
+ )
+ .child(DummyView::new())
+ .child(
+ FormView::<()>::new()
+ .child(
+ "VLAN ID",
+ IntegerEditView::new()
+ .min_value(1)
+ .max_value(4094)
+ .content(options.vlan_options.vid as usize)
+ .enabled(options.vlan_enabled),
+ )
+ .with_name(Self::FORM_NAME),
+ );
+
+ Self { view }
+ }
+
+ fn toggle_all(siv: &mut Cursive, enabled: bool) {
+ siv.call_on_name(Self::FORM_NAME, |form: &mut FormView| {
+ form.set_labels_enabled(enabled);
+ if let Some(v) = form.get_child_mut::<IntegerEditView>(0) {
+ v.set_enabled(enabled);
+ }
+ });
+ }
+
+ fn get_values(&mut self) -> Result<NetworkVlanOptions> {
+ let form = self
+ .view
+ .get_child_mut(2)
+ .and_then(|v| v.downcast_mut::<NamedView<FormView<()>>>())
+ .ok_or(anyhow!("failed to retrieve bond options form"))?
+ .get_mut();
+
+ let vid = form
+ .get_value::<IntegerEditView, _>(0)
+ .ok_or(anyhow!("failed to retrieve VLAN ID"))?;
+
+ Ok(NetworkVlanOptions {
+ vid: vid.try_into()?,
+ })
+ }
+}
+
+impl ViewWrapper for VlanOptionsView {
+ cursive::wrap_impl!(self.view: LinearLayout);
+}
--
2.56.0
^ permalink raw reply related [relevance 18%]
* applied: [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers
2026-11-06 13:10 16% [PATCH installer v5 00/23] fix #2164: add bond and vlan " Christoph Heiss
` (2 preceding siblings ...)
2026-11-06 13:10 18% ` [PATCH installer v5 19/23] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
@ 2026-11-07 22:07 15% ` Thomas Lamprecht
3 siblings, 0 replies; 14+ results
From: Thomas Lamprecht @ 2026-11-07 22:07 UTC (permalink / raw)
To: pve-devel, Christoph Heiss
On Fri, 06 Nov 2026 14:10:29 +0100, Christoph Heiss wrote:
> Fixes #2164 [0] by adding the possibility to set up a bond and a VLAN tag for
> the management interface during the installation, for all of GUI, TUI and
> auto-installer.
>
> For the GUI and TUI, the current name pinning dialog is converted into a
> full-fledged advanced network options dialog, in the same vein as with
> the bootdisk options.
>
> [...]
Applied, many thanks!
I folded a few changes into your patches, each noted in a [TL: ...]
block of the commit message. The main ones:
- generator: name the VLAN interface 'vlan<ID>' with an explicit raw
device, as '<device>.<ID>' can exceed the interface name length limit
with long predictable names. Resolve bond members to physical links,
the first by name for a MAC address shared by several, and keep the
generated configuration unchanged for setups without a bond or VLAN.
- auto-installer: pass the bond options with the keys and lowercase MAC
addresses the low-level installer expects, reject unknown members and
DHCP leases not received on a member, also set up the bond with the
'from-answer' source, and mark all members as management interfaces
in the post-hook data (schema 1.3).
- GUI and TUI: read and check the options only while bonding or the VLAN
is enabled, take the VLAN tag from a plain entry, as the spin button
silently replaced invalid tags by the nearest valid one, show 802.3ad
as LACP and label members with their pinned names. Patches 22 and 23
are folded into 10 and 18.
- the TUI and auto-installer leave out links without an Ethernet MAC
address, like InfiniBand ones, which the `MacAddress` type cannot
hold.
- structs are adapted in the commits changing them, so that every commit
builds, and the series requires proxmox-installer-types 0.3.1.
On top, as separate commits:
- GUI: keep the advanced options dialog open if it is closed via the
window with invalid input, and modal until it is closed.
- note the balance-alb and balance-tlb modes as unsuitable with a
bridge, in all installers.
- support a tagged network in the installation environment, via the
'proxmox-vlan' kernel parameter or 'prepare-iso --vlan-id', and use
its tag for the management network by default.
- reject pinned names of the form bondN, vlanN and vmbrN.
- select bond members by udev properties in the answer file.
- label bond members with the pinned names as entered in the dialog.
- TUI: avoid an underflow in the tabbed view with narrow tab contents.
[01/23] install: run make tidy
commit: e2644833648f89de89b95345b0858cdc3880eda9
[02/23] tree-wide: use `MacAddress` type instead of string for MAC addresses
commit: 6fe01041152e5ceb27cfcce588a08d0ae18b8c26
[03/23] install: factor out ifupdown2 config generation into own subroutine
commit: ab268db2123c476069ac2014ab8a690ecf136f79
[04/23] install: do not rely on interface name map to be fully populated
commit: 48acddf76734b3d3282d88a85082360eedb0b64c
[05/23] install: config: add option for setting up bond on management interface
commit: 7855417047658554183d941a23e2cf4f50701ade
[06/23] install: config: add option for setting up vlan on management interface
commit: 61c0c6f361ce86468aa24c6afa2a373b780c3662
[07/23] install: network: set up management bond if requested
commit: 0543d1e123d52142929906e025f59651bd9a5f40
[08/23] install: network: set up vlan on management interface if requested
commit: 6fec9d7fd40fa77fef3fa84d8b6a055f30dcf0bf
[09/23] gui: network: factor out name pinning into advanced options dialog
commit: 210ec2c7a6760610c4ea0d38bf8f52bb0db62c74
[10/23] gui: network: add bond setup options to advanced options dialog
commit: 9855583d1be34897ba698739b5e4f767a46296c2
[11/23] gui: network: add vlan setup options to advanced network dialog
commit: 0d38555bffc8eb07ccec38336fa10e0ffe0e983c
[12/23] auto: pass through management network bond options to low-level installer
commit: cf6717a51358b7e8544daf15f2a114e955e326c3
[13/23] auto: pass through management network vlan options to low-level installer
commit: 8c0b5f5ec25de4608e8b2e3961b936a1d15b0f02
[14/23] tui: drop long obsolete comment about logo formatting
commit: 2cd910fc3511a715d362874977eb996c500fe4e4
[15/23] tui: views: add widget for displaying a group of checkboxes
commit: f0ac4c5d9f284fdc8a00abd63b0ce8478e509324
[16/23] tui: network: factor out name pinning into advanced options dialog
commit: 7afba62dcf3e1930504c8168fd97b151c27250ba
[17/23] tui: network: match form label style when enabling/disabling elements
commit: 854425f8e0327b56bc38919b49259fe8e939e4bb
[18/23] tui: network: add bond setup options to advanced network dialog
commit: b492fc69543c70a5fba44aa31dec28f5586eaa0f
[19/23] tui: network: add vlan setup options to advanced network dialog
commit: 065c9ba43454d38d8810d1019230a33c2d5624c5
[20/23] gui: network: split advanced options dialog into tabs
commit: 3e15d0376b44d86f34edd10fd8421b3ab4091731
[21/23] tui: network: split advanced options dialog into tabs
commit: 6d0b559ecbd67d1a6073b2d904bf7ef493a15ecf
[22/23] gui: network: list bond member candidates sharing a MAC address once
(folded into 10/23)
[23/23] tui: network: list bond member candidates sharing a MAC address once
(folded into 18/23)
^ permalink raw reply [relevance 15%]
Results 1-14 of 14 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
[not found] <3978889E-73FA-4473-A70B-2C660662CC3D@credativ.de>
2025-09-23 12:07 12% ` [pve-devel] [PATCH installer 1/1] fix #2164: add option to define a vlan tag within the installer Christoph Heiss
2025-09-24 8:48 8% ` Aaron Lauterer
2026-09-08 10:16 [PATCH installer/proxmox 00/15] partially fix #2164: add bond setup across all installers Christoph Heiss
2026-09-08 10:16 20% ` [PATCH installer 11/15] auto: pass trough management network bond options to low-level installer Christoph Heiss
2026-10-20 11:23 [PATCH installer/proxmox 00/15] partially fix #2164: add bond setup across all installers Christoph Heiss
2026-10-20 11:23 20% ` [PATCH installer 11/15] auto: pass trough management network bond options to low-level installer Christoph Heiss
2026-11-02 12:45 15% [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-02 12:45 20% ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-02 12:45 22% ` [PATCH installer v4 21/30] auto: pass through management network vlan " Christoph Heiss
2026-11-02 12:45 18% ` [PATCH installer v4 26/30] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-06 13:12 7% ` [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-06 13:10 16% [PATCH installer v5 00/23] fix #2164: add bond and vlan " Christoph Heiss
2026-11-06 13:10 20% ` [PATCH installer v5 12/23] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-06 13:10 22% ` [PATCH installer v5 13/23] auto: pass through management network vlan " Christoph Heiss
2026-11-06 13:10 18% ` [PATCH installer v5 19/23] tui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-07 22:07 15% ` applied: [PATCH installer v5 00/23] fix #2164: add bond and vlan setup across all installers Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox