public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH container/manager/qemu-server 0/6] persist auto-generated MAC addresses of guest network devices
Date: Tue, 24 Nov 2026 19:06:13 +0100	[thread overview]
Message-ID: <3ff8d2c7-9dbe-4101-9d99-a0cb1a0395f5@proxmox.com> (raw)
In-Reply-To: <20261124145651.335234-1-s.hanreich@proxmox.com>

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

code wise looks fine to me, some minor comments on one container and
qemu patch (see the individual mails)

otherwise:

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>

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(-)
> 





  parent reply	other threads:[~2026-11-24 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:56 [PATCH container/manager/qemu-server 0/6] persist auto-generated MAC addresses of guest network devices Stefan Hanreich
2026-11-24 14:56 ` [PATCH pve-container 1/6] setup: do not read datacenter.cfg inside the container's root Stefan Hanreich
2026-11-24 14:56 ` [PATCH pve-container 2/6] start: persist a MAC address for network devices without one Stefan Hanreich
2026-11-24 18:06   ` Dominik Csapak
2026-11-24 14:56 ` [PATCH pve-container 3/6] restore: add missing MAC addresses of the backup config Stefan Hanreich
2026-11-24 14:56 ` [PATCH qemu-server 4/6] start: persist a MAC address for network devices without one Stefan Hanreich
2026-11-24 18:06   ` Dominik Csapak
2026-11-24 14:56 ` [PATCH qemu-server 5/6] restore: add missing MAC addresses of the backup config Stefan Hanreich
2026-11-24 14:56 ` [PATCH pve-manager 6/6] ui: lxc: network: handle network devices without a MAC address Stefan Hanreich
2026-11-24 18:06 ` Dominik Csapak [this message]
2026-11-24 18:38   ` [PATCH container/manager/qemu-server 0/6] persist auto-generated MAC addresses of guest network devices Dominik Csapak
2026-11-24 19:09   ` Stefan Hanreich
2026-11-24 23:45 ` applied: " Thomas Lamprecht

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=3ff8d2c7-9dbe-4101-9d99-a0cb1a0395f5@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@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