According to docs, if you want to override something in the generated /run/incus/<instance>/qemu.conf then you’d use the key raw.qemu.conf
However, it’s not immediately obvious to me how the NICs are configured. I’m running a VM with two NICs, which works fine, but the NICs aren’t defined in qemu.conf, nor are they seen on the qemu command line.
Inside the VM, dmesg shows the NICs are presented as virtio10 and virtio11 before being renamed, and lspci shows me:
05:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
06:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
So I’m wondering if they are hot-plugged?
I found the following in internal/server/instance/drivers/driver_qemu.go:
// Attach NIC to running instance.
if len(runConf.NetworkInterface) > 0 {
err = d.deviceAttachNIC(dev.Name(), configCopy, runConf.NetworkInterface)
if err != nil {
return nil, err
}
}
d.logger.Debug("Using PCI bus device to hotplug NIC into", logger.Ctx{"device": deviceName, "port": pciDeviceName})
qemuDev["bus"] = pciDeviceName
qemuDev["addr"] = "00.0"
if slices.Contains([]string{"pcie", "pci"}, busName) {
qemuDev["driver"] = "virtio-net-pci"
} else if busName == "ccw" {
qemuDev["driver"] = "virtio-net-ccw"
}
And this ultimately calls m.AddNIC() in internal/server/instance/drivers/qmp/commands.go, which sends a netdev_add message.
So, without fully understanding the code here, it seems to me that incus-created NICs are dynamically added, and the use of virtio-net for network devices is hard-coded. (qemuDev is passed through from deviceAttachNIC() to addNetDevConfig(), but it looks like qemuDev["driver"] is forced in the code above).