public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
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	[thread overview]
Message-ID: <20261102145630.1555953-11-h.laimer@proxmox.com> (raw)
In-Reply-To: <20261102145630.1555953-1-h.laimer@proxmox.com>

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 <h.laimer@proxmox.com>
---
 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





  parent reply	other threads:[~2026-11-02 14:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 14:56 [PATCH docs/network/qemu-server v2 00/11] sdn: improve MAC cache, DHCP reservations and scope both to the vnet Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 01/11] sdn: ipam: stop caching IPAM misses Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 02/11] sdn: ipam: write the lookup's cache entry under the cluster lock Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 03/11] sdn: ipam: read the MAC cache case-insensitively Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 04/11] sdn: dhcp: replace a stale dnsmasq reservation instead of dropping it Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 05/11] sdn: ipam: release an address the built-in IPAM no longer holds Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 06/11] sdn: dhcp: update reservations when ip mappings change Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 07/11] sdn: ipam: look a MAC up within the vnet's subnets Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 08/11] sdn: ipam: keep the MAC cache per vnet Hannes Laimer
2026-11-02 14:56 ` [PATCH pve-network v2 09/11] sdn: ipam: give each zone a VRF in NetBox and a section in phpIPAM Hannes Laimer
2026-11-02 14:56 ` Hannes Laimer [this message]
2026-11-02 14:56 ` [PATCH pve-docs v2 11/11] sdn: ipam: document the per-zone VRF and section in NetBox and phpIPAM Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102145630.1555953-11-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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