[PATCH v1 07/24] qemu_command.c: move QEMU_CAPS_VIRTIO_TX_ALG check to qemu_validate.c

Daniel Henrique Barboza danielhb413 at gmail.com
Wed Oct 14 20:42:50 UTC 2020


Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_command.c  | 4 ----
 src/qemu/qemu_validate.c | 8 ++++++++
 tests/qemuxml2xmltest.c  | 4 ++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 06ac175b67..1629fac659 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3330,10 +3330,6 @@ qemuBuildNicDevStr(virDomainDefPtr def,
                                             net->driver.virtio.txmode);
                     return NULL;
             }
-        } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("virtio-net-pci 'tx' option not supported in this QEMU binary"));
-            return NULL;
         }
     }
     if (usingVirtio) {
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index beaa1aedce..c874a05f5b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1253,6 +1253,14 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
     }
 
     if (virDomainNetIsVirtioModel(net)) {
+        if (net->driver.virtio.txmode &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_TX_ALG)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("virtio-net-pci 'tx' option not supported in "
+                             "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 f4a5aa18f7..c1b70025b1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -467,7 +467,7 @@ mymain(void)
     DO_TEST("net-user", NONE);
     DO_TEST("net-user-addr", NONE);
     DO_TEST("net-virtio", NONE);
-    DO_TEST("net-virtio-device", NONE);
+    DO_TEST("net-virtio-device", QEMU_CAPS_VIRTIO_TX_ALG);
     DO_TEST("net-virtio-disable-offloads", NONE);
     DO_TEST("net-eth", NONE);
     DO_TEST("net-eth-ifname", NONE);
@@ -795,7 +795,7 @@ mymain(void)
     DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", NONE);
     DO_TEST("numad-auto-memory-vcpu-cpuset", NONE);
     DO_TEST("usb-ich9-ehci-addr", NONE);
-    DO_TEST("disk-copy_on_read", NONE);
+    DO_TEST("disk-copy_on_read", QEMU_CAPS_VIRTIO_TX_ALG);
     DO_TEST_CAPS_LATEST("tpm-passthrough");
     DO_TEST_CAPS_LATEST("tpm-passthrough-crb");
     DO_TEST_CAPS_LATEST("tpm-emulator");
-- 
2.26.2




More information about the libvir-list mailing list