public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] proxinstall: replace usage of hacky `mngmt_nic_id` config option
@ 2025-03-24 13:19 Christoph Heiss
  2025-04-04  8:33 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2025-03-24 13:19 UTC (permalink / raw)
  To: pve-devel

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH installer] proxinstall: replace usage of hacky `mngmt_nic_id` config option
  2025-03-24 13:19 [pve-devel] [PATCH installer] proxinstall: replace usage of hacky `mngmt_nic_id` config option Christoph Heiss
@ 2025-04-04  8:33 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-04-04  8:33 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 24.03.25 um 14:19 schrieb Christoph Heiss:
> 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@proxmox.com>
> ---
>  Proxmox/Install/Config.pm | 6 ------
>  proxinstall               | 9 ++++-----
>  2 files changed, 4 insertions(+), 11 deletions(-)
> 
>

applied, thanks! lets see if anything subtle breaks ^^


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-04-04  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-24 13:19 [pve-devel] [PATCH installer] proxinstall: replace usage of hacky `mngmt_nic_id` config option Christoph Heiss
2025-04-04  8:33 ` [pve-devel] applied: " Thomas Lamprecht

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