Blob Blame History Raw
From a682106b5bda7c88f14b7505d1e10ed457728e68 Mon Sep 17 00:00:00 2001
Message-Id: <a682106b5bda7c88f14b7505d1e10ed457728e68@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Fri, 11 Sep 2015 17:00:19 +0200
Subject: [PATCH] qemu: Introduce QEMU_CAPS_DEVICE_VIRTIO_NET

This capability can be used to detect whether or not the QEMU
binary supports the virtio-net-* network device.

(cherry picked from commit fedbb015a9084aa4dfa674cdfd813865cd3542ad)

Conflicts:
        src/qemu/qemu_capabilities.h

Conflicts are caused by the fact that some members are missing from
the virQEMUCaps enumeration because the relevant commits have not
been backported.

The value of QEMU_CAPS_DEVICE_VIRTIO_NET has been changed from 198
to 194 to avoid making the enumeration sparse.

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1254044

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_capabilities.c                  |  5 +++++
 src/qemu/qemu_capabilities.h                  |  1 +
 tests/qemucapabilitiesdata/caps_1.2.2-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.3.1-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.4.2-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.5.3-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.6.0-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.6.50-1.caps |  1 +
 tests/qemucapabilitiesdata/caps_2.1.1-1.caps  |  1 +
 tests/qemuhelptest.c                          | 18 ++++++++++++------
 10 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 927b3f9..faebeac 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -290,6 +290,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "migration-event",
               "rtl8139",
               "e1000",
+              "virtio-net",
     );
 
 
@@ -1573,6 +1574,10 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "pci-serial", QEMU_CAPS_DEVICE_PCI_SERIAL },
     { "rtl8139", QEMU_CAPS_DEVICE_RTL8139 },
     { "e1000", QEMU_CAPS_DEVICE_E1000 },
+    { "virtio-net-pci", QEMU_CAPS_DEVICE_VIRTIO_NET },
+    { "virtio-net-ccw", QEMU_CAPS_DEVICE_VIRTIO_NET },
+    { "virtio-net-s390", QEMU_CAPS_DEVICE_VIRTIO_NET },
+    { "virtio-net-device", QEMU_CAPS_DEVICE_VIRTIO_NET },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a876eb4..8ba202e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -233,6 +233,7 @@ typedef enum {
     QEMU_CAPS_MIGRATION_EVENT    = 191, /* MIGRATION event */
     QEMU_CAPS_DEVICE_RTL8139 = 192, /* -device rtl8139 */
     QEMU_CAPS_DEVICE_E1000 = 193, /* -device e1000 */
+    QEMU_CAPS_DEVICE_VIRTIO_NET = 194, /* -device virtio-net-* */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index f2fefab..6fd45d5 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -122,4 +122,5 @@
     <flag name='qxl-vga.vgamem_mb'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index 5e3bdeb..1d25452 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -137,4 +137,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index e8979a2..96879fd 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -138,4 +138,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 7a108a1..3fda753 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -147,4 +147,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index 2084f80..9203cc8 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -153,4 +153,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 5b2087d..636daae 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -153,4 +153,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
index 4b637d4..3fae0d0 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
@@ -169,4 +169,5 @@
     <flag name='pci-serial'/>
     <flag name='rtl8139'/>
     <flag name='e1000'/>
+    <flag name='virtio-net'/>
   </qemuCaps>
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 9b1515e..f7f322e 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -411,7 +411,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_KBD,
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -528,7 +529,8 @@ mymain(void)
             QEMU_CAPS_HOST_PCI_MULTIDOMAIN,
             QEMU_CAPS_DEVICE_IVSHMEM,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -597,7 +599,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_KBD,
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -674,7 +677,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_KBD,
             QEMU_CAPS_DEVICE_USB_STORAGE,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST("qemu-1.0", 1000000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -763,7 +767,8 @@ mymain(void)
             QEMU_CAPS_SPLASH_TIMEOUT,
             QEMU_CAPS_DEVICE_IVSHMEM,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST("qemu-1.1.0", 1001000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -865,7 +870,8 @@ mymain(void)
             QEMU_CAPS_SPLASH_TIMEOUT,
             QEMU_CAPS_DEVICE_IVSHMEM,
             QEMU_CAPS_DEVICE_RTL8139,
-            QEMU_CAPS_DEVICE_E1000);
+            QEMU_CAPS_DEVICE_E1000,
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
     DO_TEST_FULL("qemu-1.2.0", 1002000, 0, 0, VIR_ERR_CONFIG_UNSUPPORTED,
             QEMU_CAPS_LAST);
     DO_TEST_FULL("qemu-kvm-1.2.0", 1002000, 1, 0, VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.5.2