* [pve-devel] [PATCH sdn 0/1] fix #7152: avoid repeated ip link calls during SDN configuration
@ 2025-12-17 15:10 Krzysztof Klimonda
2025-12-17 15:10 ` [pve-devel] [PATCH sdn 1/1] fix #7152: sdn: pass interfaces config to avoid repeated ip link calls Krzysztof Klimonda
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Klimonda @ 2025-12-17 15:10 UTC (permalink / raw)
To: pve-devel; +Cc: Krzysztof Klimonda
This patch addresses issue #7152 where repeated calls to
PVE::INotify::read_etc_network_interfaces (which internally spawns
ip -details -json link show) were slowing down SDN configuration.
Reuse the interfaces configuration already prepared in
Controllers::generate_frr_config and pass it through to the
functions that need it.
Krzysztof Klimonda (1):
fix #7152: sdn: pass interfaces config to avoid repeated ip link calls
src/PVE/Network/SDN/Controllers.pm | 4 ++--
src/PVE/Network/SDN/Controllers/BgpPlugin.pm | 4 ++--
src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 8 ++++----
src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 4 ++--
src/PVE/Network/SDN/Controllers/Plugin.pm | 4 ++--
src/PVE/Network/SDN/Zones/EvpnPlugin.pmh | 2 +-
src/PVE/Network/SDN/Zones/Plugin.pm | 5 ++---
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 2 +-
8 files changed, 16 insertions(+), 17 deletions(-)
--
2.52.0
_______________________________________________
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] [PATCH sdn 1/1] fix #7152: sdn: pass interfaces config to avoid repeated ip link calls
2025-12-17 15:10 [pve-devel] [PATCH sdn 0/1] fix #7152: avoid repeated ip link calls during SDN configuration Krzysztof Klimonda
@ 2025-12-17 15:10 ` Krzysztof Klimonda
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Klimonda @ 2025-12-17 15:10 UTC (permalink / raw)
To: pve-devel; +Cc: Krzysztof Klimonda
During FRR configuration generation, find_local_ip_interface_peers is
called multiple times from various controller and zone plugins, each
call triggering a subprocess execution of ip -details -json link show
(via PVE::INotify::read_etc_network_interfaces).
Reuse the return value of read_etc_network_interfaces by reading it
once in Controllers::generate_frr_config and passing it to functions
that need it.
---
src/PVE/Network/SDN/Controllers.pm | 4 ++--
src/PVE/Network/SDN/Controllers/BgpPlugin.pm | 4 ++--
src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 8 ++++----
src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 4 ++--
src/PVE/Network/SDN/Controllers/Plugin.pm | 4 ++--
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 2 +-
src/PVE/Network/SDN/Zones/Plugin.pm | 5 ++---
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 2 +-
8 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/PVE/Network/SDN/Controllers.pm b/src/PVE/Network/SDN/Controllers.pm
index 3c18552..6bf02aa 100644
--- a/src/PVE/Network/SDN/Controllers.pm
+++ b/src/PVE/Network/SDN/Controllers.pm
@@ -106,7 +106,7 @@ sub generate_frr_config {
foreach my $id (sort keys %{ $controller_cfg->{ids} }) {
my $plugin_config = $controller_cfg->{ids}->{$id};
my $plugin = PVE::Network::SDN::Controllers::Plugin->lookup($plugin_config->{type});
- $plugin->generate_frr_config($plugin_config, $controller_cfg, $id, $uplinks, $frr_config);
+ $plugin->generate_frr_config($plugin_config, $controller_cfg, $id, $uplinks, $frr_config, $interfaces_config);
}
foreach my $id (sort keys %{ $zone_cfg->{ids} }) {
@@ -118,7 +118,7 @@ sub generate_frr_config {
my $controller_plugin =
PVE::Network::SDN::Controllers::Plugin->lookup($controller->{type});
$controller_plugin->generate_zone_frr_config(
- $plugin_config, $controller, $controller_cfg, $id, $uplinks, $frr_config,
+ $plugin_config, $controller, $controller_cfg, $id, $uplinks, $frr_config, $interfaces_config,
);
}
}
diff --git a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
index c84b384..c3e7910 100644
--- a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -57,7 +57,7 @@ sub options {
# Plugin implementation
sub generate_frr_config {
- my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller, $id, $uplinks, $config, $interfaces_config) = @_;
my @peers;
@peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
@@ -76,7 +76,7 @@ sub generate_frr_config {
my $bgp = $config->{frr}->{router}->{"bgp $asn"} //= {};
my ($ifaceip, $interface) =
- PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+ PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback, $interfaces_config);
my $routerid = PVE::Network::SDN::Controllers::Plugin::get_router_id($ifaceip, $interface);
my $remoteas = $ebgp ? "external" : $asn;
diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index e53000a..8e42a05 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -50,7 +50,7 @@ sub options {
# Plugin implementation
sub generate_frr_config {
- my ($class, $plugin_config, $controller_cfg, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller_cfg, $id, $uplinks, $config, $interfaces_config) = @_;
my $local_node = PVE::INotify::nodename();
@@ -109,7 +109,7 @@ sub generate_frr_config {
}
($ifaceip, my $interface) =
- PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+ PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback, $interfaces_config);
$routerid = PVE::Network::SDN::Controllers::Plugin::get_router_id($ifaceip, $interface);
} else {
log_warn("neither fabric nor peers configured for EVPN controller $plugin_config->{id}");
@@ -173,7 +173,7 @@ sub generate_frr_config {
}
sub generate_zone_frr_config {
- my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config, $interfaces_config) = @_;
my $local_node = PVE::INotify::nodename();
@@ -242,7 +242,7 @@ sub generate_zone_frr_config {
}
($ifaceip, my $interface) =
- PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+ PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback, $interfaces_config);
$routerid = PVE::Network::SDN::Controllers::Plugin::get_router_id($ifaceip, $interface);
} else {
diff --git a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
index 3a9acfd..cc92f72 100644
--- a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
@@ -59,7 +59,7 @@ sub options {
# Plugin implementation
sub generate_frr_config {
- my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller, $id, $uplinks, $config, $interfaces_config) = @_;
my $isis_ifaces = $plugin_config->{'isis-ifaces'};
my $isis_net = $plugin_config->{'isis-net'};
@@ -92,7 +92,7 @@ sub generate_frr_config {
}
sub generate_zone_frr_config {
- my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config, $interfaces_config) = @_;
}
diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
index d70e518..4c82af1 100644
--- a/src/PVE/Network/SDN/Controllers/Plugin.pm
+++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
@@ -73,13 +73,13 @@ sub parse_section_header {
}
sub generate_frr_config {
- my ($class, $plugin_config, $controller_cfg, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller_cfg, $id, $uplinks, $config, $interfaces_config) = @_;
die "please implement inside plugin";
}
sub generate_zone_frr_config {
- my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config) = @_;
+ my ($class, $plugin_config, $controller, $controller_cfg, $id, $uplinks, $config, $interfaces_config) = @_;
die "please implement inside plugin";
}
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 6d89499..a496c4a 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -164,7 +164,7 @@ sub generate_sdn_config {
}
($ifaceip, $iface) =
- PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+ PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback, $interfaces_config);
} elsif ($controller->{fabric}) {
my $config = PVE::Network::SDN::Fabrics::config(1);
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 826ebdf..11d1ca9 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -300,10 +300,9 @@ sub get_local_route_ip {
}
sub find_local_ip_interface_peers {
- my ($peers, $iface) = @_;
+ my ($peers, $iface, $interfaces_config) = @_;
- my $network_config = PVE::INotify::read_file('interfaces');
- my $ifaces = $network_config->{ifaces};
+ my $ifaces = $interfaces_config->{ifaces};
#if iface is defined, return ip if exist (if not,try to find it on other ifaces)
if ($iface) {
diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
index 1db610f..553e07d 100644
--- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
@@ -91,7 +91,7 @@ sub generate_sdn_config {
if ($plugin_config->{peers}) {
@peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
($ifaceip, $iface) =
- PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers);
+ PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, undef, $interfaces_config);
} elsif ($plugin_config->{fabric}) {
my $local_node = PVE::INotify::nodename();
my $config = PVE::Network::SDN::Fabrics::config(1);
--
2.52.0
_______________________________________________
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-12-18 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-17 15:10 [pve-devel] [PATCH sdn 0/1] fix #7152: avoid repeated ip link calls during SDN configuration Krzysztof Klimonda
2025-12-17 15:10 ` [pve-devel] [PATCH sdn 1/1] fix #7152: sdn: pass interfaces config to avoid repeated ip link calls Krzysztof Klimonda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.