render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From a682106b5bda7c88f14b7505d1e10ed457728e68 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <a682106b5bda7c88f14b7505d1e10ed457728e68@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Fri, 11 Sep 2015 17:00:19 +0200
7a3408
Subject: [PATCH] qemu: Introduce QEMU_CAPS_DEVICE_VIRTIO_NET
7a3408
7a3408
This capability can be used to detect whether or not the QEMU
7a3408
binary supports the virtio-net-* network device.
7a3408
7a3408
(cherry picked from commit fedbb015a9084aa4dfa674cdfd813865cd3542ad)
7a3408
7a3408
Conflicts:
7a3408
        src/qemu/qemu_capabilities.h
7a3408
7a3408
Conflicts are caused by the fact that some members are missing from
7a3408
the virQEMUCaps enumeration because the relevant commits have not
7a3408
been backported.
7a3408
7a3408
The value of QEMU_CAPS_DEVICE_VIRTIO_NET has been changed from 198
7a3408
to 194 to avoid making the enumeration sparse.
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1254044
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_capabilities.c                  |  5 +++++
7a3408
 src/qemu/qemu_capabilities.h                  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.2.2-1.caps  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.3.1-1.caps  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.4.2-1.caps  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.5.3-1.caps  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.6.0-1.caps  |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_1.6.50-1.caps |  1 +
7a3408
 tests/qemucapabilitiesdata/caps_2.1.1-1.caps  |  1 +
7a3408
 tests/qemuhelptest.c                          | 18 ++++++++++++------
7a3408
 10 files changed, 25 insertions(+), 6 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
7a3408
index 927b3f9..faebeac 100644
7a3408
--- a/src/qemu/qemu_capabilities.c
7a3408
+++ b/src/qemu/qemu_capabilities.c
7a3408
@@ -290,6 +290,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
7a3408
               "migration-event",
7a3408
               "rtl8139",
7a3408
               "e1000",
7a3408
+              "virtio-net",
7a3408
     );
7a3408
 
7a3408
 
7a3408
@@ -1573,6 +1574,10 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
7a3408
     { "pci-serial", QEMU_CAPS_DEVICE_PCI_SERIAL },
7a3408
     { "rtl8139", QEMU_CAPS_DEVICE_RTL8139 },
7a3408
     { "e1000", QEMU_CAPS_DEVICE_E1000 },
7a3408
+    { "virtio-net-pci", QEMU_CAPS_DEVICE_VIRTIO_NET },
7a3408
+    { "virtio-net-ccw", QEMU_CAPS_DEVICE_VIRTIO_NET },
7a3408
+    { "virtio-net-s390", QEMU_CAPS_DEVICE_VIRTIO_NET },
7a3408
+    { "virtio-net-device", QEMU_CAPS_DEVICE_VIRTIO_NET },
7a3408
 };
7a3408
 
7a3408
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
7a3408
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
7a3408
index a876eb4..8ba202e 100644
7a3408
--- a/src/qemu/qemu_capabilities.h
7a3408
+++ b/src/qemu/qemu_capabilities.h
7a3408
@@ -233,6 +233,7 @@ typedef enum {
7a3408
     QEMU_CAPS_MIGRATION_EVENT    = 191, /* MIGRATION event */
7a3408
     QEMU_CAPS_DEVICE_RTL8139 = 192, /* -device rtl8139 */
7a3408
     QEMU_CAPS_DEVICE_E1000 = 193, /* -device e1000 */
7a3408
+    QEMU_CAPS_DEVICE_VIRTIO_NET = 194, /* -device virtio-net-* */
7a3408
 
7a3408
     QEMU_CAPS_LAST,                   /* this must always be the last item */
7a3408
 } virQEMUCapsFlags;
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
7a3408
index f2fefab..6fd45d5 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
7a3408
@@ -122,4 +122,5 @@
7a3408
     <flag name='qxl-vga.vgamem_mb'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
7a3408
index 5e3bdeb..1d25452 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
7a3408
@@ -137,4 +137,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
7a3408
index e8979a2..96879fd 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
7a3408
@@ -138,4 +138,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
7a3408
index 7a108a1..3fda753 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
7a3408
@@ -147,4 +147,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
7a3408
index 2084f80..9203cc8 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
7a3408
@@ -153,4 +153,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
7a3408
index 5b2087d..636daae 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
7a3408
@@ -153,4 +153,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
7a3408
index 4b637d4..3fae0d0 100644
7a3408
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
7a3408
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
7a3408
@@ -169,4 +169,5 @@
7a3408
     <flag name='pci-serial'/>
7a3408
     <flag name='rtl8139'/>
7a3408
     <flag name='e1000'/>
7a3408
+    <flag name='virtio-net'/>
7a3408
   </qemuCaps>
7a3408
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
7a3408
index 9b1515e..f7f322e 100644
7a3408
--- a/tests/qemuhelptest.c
7a3408
+++ b/tests/qemuhelptest.c
7a3408
@@ -411,7 +411,8 @@ mymain(void)
7a3408
             QEMU_CAPS_DEVICE_USB_KBD,
7a3408
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
7a3408
             QEMU_CAPS_VNC_COLON,
7a3408
             QEMU_CAPS_NO_REBOOT,
7a3408
@@ -528,7 +529,8 @@ mymain(void)
7a3408
             QEMU_CAPS_HOST_PCI_MULTIDOMAIN,
7a3408
             QEMU_CAPS_DEVICE_IVSHMEM,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
7a3408
             QEMU_CAPS_VNC_COLON,
7a3408
             QEMU_CAPS_NO_REBOOT,
7a3408
@@ -597,7 +599,8 @@ mymain(void)
7a3408
             QEMU_CAPS_DEVICE_USB_KBD,
7a3408
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
7a3408
             QEMU_CAPS_VNC_COLON,
7a3408
             QEMU_CAPS_NO_REBOOT,
7a3408
@@ -674,7 +677,8 @@ mymain(void)
7a3408
             QEMU_CAPS_DEVICE_USB_KBD,
7a3408
             QEMU_CAPS_DEVICE_USB_STORAGE,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST("qemu-1.0", 1000000, 0, 0,
7a3408
             QEMU_CAPS_VNC_COLON,
7a3408
             QEMU_CAPS_NO_REBOOT,
7a3408
@@ -763,7 +767,8 @@ mymain(void)
7a3408
             QEMU_CAPS_SPLASH_TIMEOUT,
7a3408
             QEMU_CAPS_DEVICE_IVSHMEM,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST("qemu-1.1.0", 1001000, 0, 0,
7a3408
             QEMU_CAPS_VNC_COLON,
7a3408
             QEMU_CAPS_NO_REBOOT,
7a3408
@@ -865,7 +870,8 @@ mymain(void)
7a3408
             QEMU_CAPS_SPLASH_TIMEOUT,
7a3408
             QEMU_CAPS_DEVICE_IVSHMEM,
7a3408
             QEMU_CAPS_DEVICE_RTL8139,
7a3408
-            QEMU_CAPS_DEVICE_E1000);
7a3408
+            QEMU_CAPS_DEVICE_E1000,
7a3408
+            QEMU_CAPS_DEVICE_VIRTIO_NET);
7a3408
     DO_TEST_FULL("qemu-1.2.0", 1002000, 0, 0, VIR_ERR_CONFIG_UNSUPPORTED,
7a3408
             QEMU_CAPS_LAST);
7a3408
     DO_TEST_FULL("qemu-kvm-1.2.0", 1002000, 1, 0, VIR_ERR_CONFIG_UNSUPPORTED,
7a3408
-- 
7a3408
2.5.2
7a3408