]> git.proxmox.com Git - qemu-server.git/commit - PVE/QemuServer.pm
net devs: avoid registering MAC to fdb if not static
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 13 Nov 2022 12:38:55 +0000 (13:38 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 13 Nov 2022 13:56:57 +0000 (14:56 +0100)
commit4ddd2ca29310206a93d1ed78c63bdcb7dfb85e45
tree36e654a6b1d2d29d91e89b55330ffb783a76cf42
parent1b5ba4ddc63f7e0b916131c7882f638c49cd4558
net devs: avoid registering MAC to fdb if not static

In theory we can have a config with netX records that do not specify
a `macaddr` property, we just auto-generate on in config2cmd for
startup transitively, but don't save that explicitly back to the
config; so while we could parse the /proc/$pid/cmdline or try to get
the info from QMP (not fully straight forward) it seems rather a
hassle; especially if one has in mind that this cannot happen via the
API FWICT; as there a "deletion" *saves* a newly auto generated value
out to the config, same with clone of a VM and restore of a backup.

So, in basically all reasonable cases we got the `macaddr` available,
but if we don't it makes no sense to add a FDB variable for a *newly*
generated one by the parse_net call, as the VM won't use that (well,
at least if one doesn't get "lucky" and it randomly re-generates the
same as on startup), so allow telling parse_net to skip auto
generating MACs and use that in the add-fdb-entries helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm