all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-network v3 0/3] make sure to use subnet config if available at point
@ 2026-09-07 14:28 Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 1/3] vnets: introduce get_subnets_with_config Daniel Herzig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Herzig @ 2026-09-07 14:28 UTC (permalink / raw)
  To: pve-devel

At certain places (SimplePlugin, EvpnPlugin) subnets were read from the
running config instead of the one passed in, so callers that generate without
committing first, like the dry-run, never saw pending subnet changes in the result.

This series changes this behaviour by introducing a function that makes use of
an existing subnet configuration if available at point.

To avoid code duplication, the function is also used from the original 'get_subnets'
for by callers, that do not have the subnet configuration by hand, here passing in the
configuration retrieved by the the original call to PVE::Network::SDN::Subnets::config.

Changes since v1:
* use 'get_subnets_with_config' in original 'get_subnets' as well.
* use 'get_subnets_with_config' in EvpnPlugin and Dhcp in addition to SimplePlugin.

Changes since v2:
* make use of 'for' instead of 'foreach' in introduced sub.
* drop patch for Dhcp.pm (offtopic).

Daniel Herzig (3):
  vnets: introduce get_subnets_with_config
  fix #7837: simpleplugin: make use of get_subnets_with_config
  evpnplugin: make use of get_subnets_with_config

 src/PVE/Network/SDN/Vnets.pm              | 9 +++++++--
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm   | 2 +-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.47.3




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

* [pve-network v3 1/3] vnets: introduce get_subnets_with_config
  2026-09-07 14:28 [pve-network v3 0/3] make sure to use subnet config if available at point Daniel Herzig
@ 2026-09-07 14:28 ` Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 2/3] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 3/3] evpnplugin: " Daniel Herzig
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Herzig @ 2026-09-07 14:28 UTC (permalink / raw)
  To: pve-devel

Add 'get_subnets_with_config' to return the subnets of a vnet with
certain subnet configuration and integrate into the current
'get_subnets'.

This allows to keep the original behaviour of 'get_subnets' --
retrieving subnet configurations (retreiving it either from the
running sdn-config, or from the 'subnets.cfg' config file) when it's
not available to the caller -- without doubling doubling up the code
to to loop through the subnet ids to handle the other case (subnet
configuration already present at the callsite).

Suggested-by: Gabriel Goller <g.goller@proxmox.com>
Suggested-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
---
 src/PVE/Network/SDN/Vnets.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm
index c327a4b..5248596 100644
--- a/src/PVE/Network/SDN/Vnets.pm
+++ b/src/PVE/Network/SDN/Vnets.pm
@@ -70,10 +70,15 @@ sub get_vnet {
 sub get_subnets {
     my ($vnetid, $running) = @_;
 
-    my $subnets = undef;
     my $subnets_cfg = PVE::Network::SDN::Subnets::config($running);
+    return get_subnets_with_config($vnetid, $subnets_cfg);
+}
 
-    foreach my $subnetid (sort keys %{ $subnets_cfg->{ids} }) {
+sub get_subnets_with_config {
+    my ($vnetid, $subnets_cfg) = @_;
+
+    my $subnets = undef;
+    for my $subnetid (sort keys %{ $subnets_cfg->{ids} }) {
         my $subnet = PVE::Network::SDN::Subnets::sdn_subnets_config($subnets_cfg, $subnetid);
         next if !$subnet->{vnet} || ($vnetid && $subnet->{vnet} ne $vnetid);
         $subnets->{$subnetid} = $subnet;
-- 
2.47.3




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

* [pve-network v3 2/3] fix #7837: simpleplugin: make use of get_subnets_with_config
  2026-09-07 14:28 [pve-network v3 0/3] make sure to use subnet config if available at point Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 1/3] vnets: introduce get_subnets_with_config Daniel Herzig
@ 2026-09-07 14:28 ` Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 3/3] evpnplugin: " Daniel Herzig
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Herzig @ 2026-09-07 14:28 UTC (permalink / raw)
  To: pve-devel

At the given point we already have the subnet configuration by hand,
so make sure to use it, instead of inherently falling back to
re-reading '/etc/pve/sdn/.running-config' via the original
'get_subnets($vnet_id, 1)'.

Suggested-by: Gabriel Goller <g.goller@proxmox.com>
Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
---
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index 347eee9..d922035 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -75,7 +75,7 @@ sub generate_sdn_config {
     my @iface_config = ();
 
     my $address = {};
-    my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1);
+    my $subnets = PVE::Network::SDN::Vnets::get_subnets_with_config($vnetid, $subnet_cfg);
 
     my $ipv4 = undef;
     my $ipv6 = undef;
-- 
2.47.3




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

* [pve-network v3 3/3] evpnplugin: make use of get_subnets_with_config
  2026-09-07 14:28 [pve-network v3 0/3] make sure to use subnet config if available at point Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 1/3] vnets: introduce get_subnets_with_config Daniel Herzig
  2026-09-07 14:28 ` [pve-network v3 2/3] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
@ 2026-09-07 14:28 ` Daniel Herzig
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Herzig @ 2026-09-07 14:28 UTC (permalink / raw)
  To: pve-devel

At the given point we already have the subnet configuration by hand,
so make sure to use it, instead of inherently falling back to
re-reading '/etc/pve/sdn/.running-config' via the original
'get_subnets($vnet_id, 1)'.

Suggested-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
---
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 0e79707..04fef78 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -239,7 +239,7 @@ sub generate_sdn_config {
     my $ipv6 = undef;
     my $enable_forward_v4 = undef;
     my $enable_forward_v6 = undef;
-    my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1);
+    my $subnets = PVE::Network::SDN::Vnets::get_subnets_with_config($vnetid, $subnet_cfg);
     foreach my $subnetid (sort keys %{$subnets}) {
         my $subnet = $subnets->{$subnetid};
         my $cidr = $subnet->{cidr};
-- 
2.47.3




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

end of thread, other threads:[~2026-09-07 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 14:28 [pve-network v3 0/3] make sure to use subnet config if available at point Daniel Herzig
2026-09-07 14:28 ` [pve-network v3 1/3] vnets: introduce get_subnets_with_config Daniel Herzig
2026-09-07 14:28 ` [pve-network v3 2/3] fix #7837: simpleplugin: make use of get_subnets_with_config Daniel Herzig
2026-09-07 14:28 ` [pve-network v3 3/3] evpnplugin: " Daniel Herzig

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal