[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [Patch v3 1/3] Add -netdev bridge capabilities



From: Richa Marwaha <rmarwah linux vnet ibm com>

This patch adds the capability in libvirt to check if
-netdev bridge option is supported or not.

Signed-off-by: Richa Marwaha <rmarwah linux vnet ibm com>
Signed-off-by: Corey Bryant<coreyb linux vnet ibm com>
---
v2
-This is a new patch that helps libvirt to check if -netdev bridge
option is supported in the qemu version that is being used to run
the guest. In v1 we didnot have the capability to check if qemu
version we are using supported -netdev bridge or not.

v3
-Fixed the QEMU_CAPS_NETDEV_BRIDGE capabilities, now it supports
QEMU_CAPS_NETDEV which was missing earlier.
-Updated the tests/qemuhelptest.c

 AUTHORS                      |    1 +
 src/qemu/qemu_capabilities.c |   13 +++++++++----
 src/qemu/qemu_capabilities.h |    1 +
 tests/qemuhelptest.c         |    3 ++-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index e3eadbf..1a7a4ac 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -252,6 +252,7 @@ Patches have also been contributed by:
   Sebastian Wiedenroth <wiedi frubar net>
   Ata E Husain Bohra   <ata husain hotmail com>
   Ján Tomko            <jtomko redhat com>
+  Richa Marwaha        <rmarwah linux vnet ibm com>
 
   [....send patches to get your name here....]
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 85c49a2..82a2870 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -169,6 +169,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "virtio-s390",
               "balloon-event",
 
+              "bridge", /* 100 */
+
     );
 
 struct qemu_feature_flags {
@@ -1020,7 +1022,7 @@ qemuCapsComputeCmdFlags(const char *help,
                         bool check_yajl ATTRIBUTE_UNUSED)
 {
     const char *p;
-    const char *fsdev;
+    const char *fsdev, *netdev;
 
     if (strstr(help, "-no-kqemu"))
         qemuCapsSet(flags, QEMU_CAPS_KQEMU);
@@ -1133,13 +1135,16 @@ qemuCapsComputeCmdFlags(const char *help,
     if (strstr(help, "-smbios type"))
         qemuCapsSet(flags, QEMU_CAPS_SMBIOS_TYPE);
 
-    if (strstr(help, "-netdev")) {
+    if ((netdev = strstr(help, "-netdev"))) {
         /* Disable -netdev on 0.12 since although it exists,
          * the corresponding netdev_add/remove monitor commands
          * do not, and we need them to be able to do hotplug.
          * But see below about RHEL build. */
-        if (version >= 13000)
-            qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+        if (version >= 13000) {
+            if (strstr(netdev, "bridge"))
+                qemuCapsSet(flags, QEMU_CAPS_NETDEV_BRIDGE);
+           qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+        }
     }
 
     if (strstr(help, "-sdl"))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e8251dc..c1b67a6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -135,6 +135,7 @@ enum qemuCapsFlags {
     QEMU_CAPS_NEC_USB_XHCI       = 97, /* -device nec-usb-xhci */
     QEMU_CAPS_VIRTIO_S390        = 98, /* -device virtio-*-s390 */
     QEMU_CAPS_BALLOON_EVENT      = 99, /* Async event for balloon changes */
+    QEMU_CAPS_NETDEV_BRIDGE      = 100, /* bridge helper support */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 012ba26..75c818c 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -754,7 +754,8 @@ mymain(void)
             QEMU_CAPS_IDE_CD,
             QEMU_CAPS_NO_USER_CONFIG,
             QEMU_CAPS_HDA_MICRO,
-            QEMU_CAPS_NEC_USB_XHCI);
+            QEMU_CAPS_NEC_USB_XHCI,
+            QEMU_CAPS_NETDEV_BRIDGE);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]