From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id C3B9A1FF09C for ; Mon, 02 Nov 2026 15:57:38 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 364C9217E4; Mon, 02 Nov 2026 15:57:03 +0100 (CET) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 10/11] network: sdn: push the DHCP mappings of a guest when it resumes Date: Mon, 2 Nov 2026 15:56:29 +0100 Message-ID: <20261102145630.1555953-11-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261102145630.1555953-1-h.laimer@proxmox.com> References: <20261102145630.1555953-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793631404876 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.360 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: RULAWLD3SY4OA3WUAYXUJK2XLJLLUYQH X-Message-ID-Hash: RULAWLD3SY4OA3WUAYXUJK2XLJLLUYQH X-MailFrom: h.laimer@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: A mapping edit updates the reservation on the guest's node, taken from the vmlist, which names the source of a live migration until the config moves at its end. An edit in that window went to the source, while the target kept the record it started with. Every resume now pushes the current mapping of each NIC first. The last step of a migration resumes the target after the config moved, so the target catches up there, or at the later resume of a guest the migration left paused. Signed-off-by: Hannes Laimer --- src/PVE/QemuServer/Network.pm | 14 ++++++++++++++ src/PVE/QemuServer/RunState.pm | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/PVE/QemuServer/Network.pm b/src/PVE/QemuServer/Network.pm index b4893c015646..88a2290672e6 100644 --- a/src/PVE/QemuServer/Network.pm +++ b/src/PVE/QemuServer/Network.pm @@ -272,6 +272,20 @@ sub add_random_macs { } } +# an edit made while the guest migrated went to the source, which the vmlist +# still named. Every resume pushes the current mapping of each NIC, so the +# target catches up +sub add_nets_dhcp_mapping { + my ($conf) = @_; + + for my $opt (keys %$conf) { + next if $opt !~ m/^net\d+$/; + my $net = parse_net($conf->{$opt}, 1) or next; + next if !$net->{bridge} || !$net->{macaddr}; + PVE::Network::SDN::Dhcp::update_mapping($net->{bridge}, $net->{macaddr}); + } +} + sub add_nets_bridge_fdb { my ($conf, $vmid) = @_; diff --git a/src/PVE/QemuServer/RunState.pm b/src/PVE/QemuServer/RunState.pm index 889ddd28287b..828d79159e90 100644 --- a/src/PVE/QemuServer/RunState.pm +++ b/src/PVE/QemuServer/RunState.pm @@ -181,6 +181,8 @@ sub vm_resume($vmid, $skiplock = undef, $nocheck = undef) { PVE::QemuServer::Network::add_nets_bridge_fdb($conf, $vmid) if $resume_cmd eq 'cont'; + PVE::QemuServer::Network::add_nets_dhcp_mapping($conf) + if $resume_cmd eq 'cont'; mon_cmd($vmid, $resume_cmd); }, -- 2.47.3