From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2E2A01FF13C for ; Thu, 11 Jun 2026 17:00:25 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A40ECF9E3; Thu, 11 Jun 2026 17:00:11 +0200 (CEST) From: David Riley To: pve-devel@lists.proxmox.com Subject: [PATCH pve-network 6/9] fix #7294: sdn: vnet: update pool members on vnet migration and deletion Date: Thu, 11 Jun 2026 16:59:32 +0200 Message-ID: <20260611145935.147788-7-d.riley@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260611145935.147788-1-d.riley@proxmox.com> References: <20260611145935.147788-1-d.riley@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1781189943464 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.181 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ARYSVCMDGIQPTQARY5N3L5H23STIYOUX X-Message-ID-Hash: ARYSVCMDGIQPTQARY5N3L5H23STIYOUX X-MailFrom: d.riley@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Update or remove corresponding resource pool allocations in user.cfg whenever a VNet is altered or deleted. This prevents stale paths and dangling references from breaking the configuration integrity. Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294 Signed-off-by: David Riley --- src/PVE/Network/SDN.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm index 6a49621..1541f8e 100644 --- a/src/PVE/Network/SDN.pm +++ b/src/PVE/Network/SDN.pm @@ -259,11 +259,26 @@ sub cleanup { PVE::AccessControl::migrate_sdn_resource_access($vnet_move_paths); } + foreach my $move (@$vnet_move_paths) { + my ($src_type, $src_zone, $vnet) = @{ $move->{src_path} }; + my ($dest_type, $dest_zone, $dest_vnet) = @{ $move->{dest_path} }; + + if (defined($src_type) && $src_type eq 'zones' && $src_zone && $vnet && $dest_zone) { + PVE::AccessControl::migrate_vnet_zone_in_pool($src_zone, $dest_zone, $vnet); + } + } + my @paths_to_delete = (@$vnet_delete_paths, @$route_map_paths, @$generic_paths); if (@paths_to_delete) { PVE::AccessControl::remove_sdn_resource_access(\@paths_to_delete); } + foreach my $path (@$vnet_delete_paths) { + my ($type, $zone, $vnet) = @$path; + if ($type && $type eq 'zones' && $zone && $vnet) { + PVE::AccessControl::remove_vnet_from_pool($zone, $vnet); + } + } } sub diff_generic_resources { -- 2.47.3