From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D6E211FF066 for ; Tue, 24 Nov 2026 19:38:49 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 59C16214DE; Tue, 24 Nov 2026 19:38:49 +0100 (CET) Message-ID: Date: Tue, 24 Nov 2026 19:38:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH container/manager/qemu-server 0/6] persist auto-generated MAC addresses of guest network devices From: Dominik Csapak To: Stefan Hanreich , pve-devel@lists.proxmox.com References: <20261124145651.335234-1-s.hanreich@proxmox.com> <3ff8d2c7-9dbe-4101-9d99-a0cb1a0395f5@proxmox.com> Content-Language: en-US In-Reply-To: <3ff8d2c7-9dbe-4101-9d99-a0cb1a0395f5@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795545522342 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.262 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: N6WNJLGUT7WJAHYN7OEUT6SYCKLN774G X-Message-ID-Hash: N6WNJLGUT7WJAHYN7OEUT6SYCKLN774G X-MailFrom: d.csapak@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: On 11/24/26 7:06 PM, Dominik Csapak wrote: > tested through with most container types, and some vms: > * starting generated a hwaddr as expected > * as did restore > * gui for containers now didn't fail > * starting such a vm got assigned an ip from the dhcp dnsmasq ipam > * the cloudinit config contained the correct hwaddress > > (couldn't easily test the hotplug path, since that would require quite a > bit of downgrades on my side) > > one thing i noticed is that editing a qemu vm with such config > still yielded: > > ``` > Unable to parse network options > ``` > > but that could be fixed in a follow up btw, this is fixed by my recent patch for the parseQemuNetwork parser to allow unknown fields: https://lore.proxmox.com/pve-devel/20261119092930.830046-5-d.csapak@proxmox.com/ (just so we avoid duplicate work) > > code wise looks fine to me, some minor comments on one container and > qemu patch (see the individual mails) > > otherwise: > > Reviewed-by: Dominik Csapak > Tested-by: Dominik Csapak > > On 11/24/26 3:57 PM, Stefan Hanreich wrote: >> A guest network device without a MAC address is valid for qemu-server >> and pve-container, which generate a random one each time they parse the >> device. The API always stores one, but manual edits and restored >> backups can lack it, as can containers created with pve-container >> 3.0-8 to 3.0-10. >> >> Since libpve-cluster-perl 9.1.11, such a container fails to start, as >> the setup code reads datacenter.cfg from pmxcfs for the random MAC >> address, from within the container's root: >> >>    Transport endpoint is not connected >>    error in setup task PVE::LXC::Setup::pre_start_hook >> >> Without a persisted MAC address, the guest, the SDN DHCP mapping and >> cloud-init each use a different random address. So persist a generated >> MAC address when starting a guest, and when restoring a backup without >> 'unique', for containers and VMs. Starting such a guest now writes a >> MAC address into the config. >> >> Resuming or live-migrating a VM is intentionally left out, as the VM >> already runs with the auto-generated MAC address. It needs a cold start >> for this fix to apply. >> >> The last patch keeps the container network panel working for devices >> without a MAC address. >> >> >> pve-container: >> >> Stefan Hanreich (3): >>    setup: do not read datacenter.cfg inside the container's root >>    start: persist a MAC address for network devices without one >>    restore: add missing MAC addresses of the backup config >> >>   src/PVE/LXC.pm              |  7 ++++- >>   src/PVE/LXC/Config.pm       | 23 ++++++++++++++-- >>   src/PVE/LXC/Create.pm       |  3 +++ >>   src/PVE/LXC/Setup/Alpine.pm |  2 +- >>   src/PVE/LXC/Setup/Base.pm   |  2 +- >>   src/PVE/LXC/Setup/CentOS.pm |  4 +-- >>   src/PVE/LXC/Setup/Debian.pm |  2 +- >>   src/PVE/LXC/Setup/Gentoo.pm |  2 +- >>   src/PVE/LXC/Setup/SUSE.pm   |  2 +- >>   src/test/config_tests.pl    | 53 +++++++++++++++++++++++++++++++++++++ >>   src/test/run_setup_tests.pl |  3 +-- >>   11 files changed, 91 insertions(+), 12 deletions(-) >> >> >> qemu-server: >> >> Stefan Hanreich (2): >>    start: persist a MAC address for network devices without one >>    restore: add missing MAC addresses of the backup config >> >>   src/PVE/QemuServer.pm                     | 11 +++++++ >>   src/PVE/QemuServer/Network.pm             | 30 ++++++++++++++++++ >>   src/test/Makefile                         |  5 ++- >>   src/test/run_network_tests.pl             | 38 +++++++++++++++++++++++ >>   src/test/run_qemu_restore_config_tests.pl | 18 +++++++++++ >>   5 files changed, 101 insertions(+), 1 deletion(-) >>   create mode 100755 src/test/run_network_tests.pl >> >> >> pve-manager: >> >> Stefan Hanreich (1): >>    ui: lxc: network: handle network devices without a MAC address >> >>   www/manager6/lxc/Network.js | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> Summary over all repositories: >>    17 files changed, 193 insertions(+), 14 deletions(-) >> >