Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/qemu/qemu_command.c | 9 ++------- src/qemu/qemu_validate.c | 8 ++++++++ tests/qemuxml2xmltest.c | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9f45faa490..62b8df1a13 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3408,14 +3408,9 @@ qemuBuildNicDevStr(virDomainDefPtr def, if (usingVirtio && net->driver.virtio.tx_queue_size) virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size); - if (usingVirtio && net->mtu) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting MTU is not supported with this QEMU binary")); - return NULL; - } + if (usingVirtio && net->mtu) virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu); - } + if (usingVirtio && net->teaming.type == VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT) virBufferAddLit(&buf, ",failover=on"); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 9623ebed96..ebc70aaf00 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1277,6 +1277,14 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, return -1; } + if (net->mtu && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting MTU is not supported with this " + "QEMU binary")); + return -1; + } + if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("rx_queue_size has to be a power of two")); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e85f2188db..a9037101de 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -499,7 +499,7 @@ mymain(void) DO_TEST("watchdog", NONE); DO_TEST("net-bandwidth", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC); DO_TEST("net-bandwidth2", QEMU_CAPS_DEVICE_VGA, QEMU_CAPS_VNC); - DO_TEST("net-mtu", NONE); + DO_TEST("net-mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU); DO_TEST("net-coalesce", NONE); DO_TEST("net-many-models", NONE); -- 2.26.2