diff --git a/qemu/qmp.go b/qemu/qmp.go index 134608ec7d..43daed369d 100644 --- a/qemu/qmp.go +++ b/qemu/qmp.go @@ -912,15 +912,21 @@ func (q *QMP) ExecuteNetPCIDeviceAdd(ctx context.Context, netdevID, devID, macAd args := map[string]interface{}{ "id": devID, "driver": VirtioNetPCI, - "netdev": netdevID, - "mac": macAddr, - "addr": addr, "romfile": romfile, } if bus != "" { args["bus"] = bus } + if addr != "" { + args["addr"] = addr + } + if macAddr != "" { + args["mac"] = macAddr + } + if netdevID != "" { + args["netdev"] = netdevID + } if queues > 0 { // (2N+2 vectors, N for tx queues, N for rx queues, 1 for config, and one for possible control vq)