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

rmarwah at linux.vnet.ibm.com rmarwah at linux.vnet.ibm.com
Fri Jun 29 18:08:13 UTC 2012


From: Richa Marwaha <rmarwah at 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 at linux.vnet.ibm.com>
Signed-off-by: Corey Bryant<coreyb at 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.

 src/qemu/qemu_capabilities.c |   13 +++++++++----
 src/qemu/qemu_capabilities.h |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1e12a39..b2d7be2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -166,6 +166,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "hda-micro", /* 95 */
               "dump-guest-memory",
               "nec-usb-xhci",
+              "bridge",
 
     );
 
@@ -1005,7 +1006,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);
@@ -1118,13 +1119,17 @@ 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);
+            else
+                qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+        }
     }
 
     if (strstr(help, "-sdl"))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 83c135b..458a73e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -133,6 +133,7 @@ enum qemuCapsFlags {
     QEMU_CAPS_HDA_MICRO          = 95, /* -device hda-micro */
     QEMU_CAPS_DUMP_GUEST_MEMORY  = 96, /* dump-guest-memory command */
     QEMU_CAPS_NEC_USB_XHCI       = 97, /* -device nec-usb-xhci */
+    QEMU_CAPS_NETDEV_BRIDGE      = 98, /* bridge helper support */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
-- 
1.7.1




More information about the libvir-list mailing list