[pve-devel] [PATCH installer] proxinstall: replace usage of hacky `mngmt_nic_id` config option
Christoph Heiss
c.heiss at proxmox.com
Mon Mar 24 14:19:58 CET 2025
The option was more or less a hack from the beginning anyway, introduced
during the split of the GUI and the installation configuration.
The required information is already there from `mngmt_nic` - which
carries the name of the network interface - and is easily reused to
replace the functionality.
In short, the `mngmt_nic_id` setting was only used to check whether
another NIC was selected, avoiding needless updates to the IP address
and mask textboxes.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Proxmox/Install/Config.pm | 6 ------
proxinstall | 9 ++++-----
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/Proxmox/Install/Config.pm b/Proxmox/Install/Config.pm
index b3a257e..0adb019 100644
--- a/Proxmox/Install/Config.pm
+++ b/Proxmox/Install/Config.pm
@@ -102,9 +102,6 @@ my sub init_cfg {
# network related
mngmt_nic => undef,
- # FIXME: fix call sites and remove below, it's just an ugly relict of GTK GUI and time
- # pressure on creating the single source of truth for installation config
- mngmt_nic_id => undef,
hostname => undef,
domain => undef,
cidr => undef,
@@ -248,9 +245,6 @@ sub get_root_ssh_keys { return get('root_ssh_keys'); }
sub set_mngmt_nic { set_key('mngmt_nic', $_[0]); }
sub get_mngmt_nic { return get('mngmt_nic'); }
-sub set_mngmt_nic_id { set_key('mngmt_nic_id', $_[0]); }
-sub get_mngmt_nic_id { return get('mngmt_nic_id'); }
-
sub set_hostname { set_key('hostname', $_[0]); }
sub get_hostname { return get('hostname'); }
diff --git a/proxinstall b/proxinstall
index fe7e29f..9bbd2f9 100755
--- a/proxinstall
+++ b/proxinstall
@@ -377,11 +377,11 @@ sub create_ipconf_view {
my $current = shift;
my $new = $device_active_map->{$current->get_active()};
- my $selected = Proxmox::Install::Config::get_mngmt_nic_id();
- return if defined($selected) && $new eq $selected;
-
- Proxmox::Install::Config::set_mngmt_nic_id($new);
my $iface = $ipconf->{ifaces}->{$new};
+
+ my $selected = Proxmox::Install::Config::get_mngmt_nic();
+ return if defined($selected) && $iface->{name} eq $selected;
+
Proxmox::Install::Config::set_mngmt_nic($iface->{name});
$ipconf_entry_addr->set_text($iface->{inet}->{addr} || $iface->{inet6}->{addr})
if $iface->{inet}->{addr} || $iface->{inet6}->{addr};
@@ -414,7 +414,6 @@ sub create_ipconf_view {
$initial_active_device_pos = $device_active_reverse_map->{$nic};
} elsif ($initial_active_device_pos >= 0) {
my $iface_id = $device_active_map->{$initial_active_device_pos};
- Proxmox::Install::Config::set_mngmt_nic_id($iface_id);
my $iface = $ipconf->{ifaces}->{$iface_id};
Proxmox::Install::Config::set_mngmt_nic($iface->{name});
}
--
2.48.1
More information about the pve-devel
mailing list