feat(vm_provision_mixin): pin explicit NIC MAC when given

nics[i]['mac'] is set via virtio=<mac>,bridge=... instead of the bare
virtio,bridge=... form, so a caller-supplied MAC actually takes effect
(needed for DHCP reservations created before the VM exists).
This commit is contained in:
Christian Manivong
2026-07-08 09:09:28 +02:00
parent c8d45e4336
commit 1d6aabb5a1
2 changed files with 105 additions and 2 deletions
+3 -2
View File
@@ -313,8 +313,9 @@ class ProxmoxVMProvisionMixin:
if not bridge:
raise ValueError(f"NIC {i}: bridge is required")
# Build base config: model + bridge
net_config = f"virtio,bridge={bridge}"
# Build base config: model[=mac] + bridge
mac = nic.get("mac")
net_config = f"virtio={mac},bridge={bridge}" if mac else f"virtio,bridge={bridge}"
# Add VLAN configuration (access vs trunk)
if "trunk_vlan_tags" in nic and nic["trunk_vlan_tags"]: