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

[libvirt] [PATCH 05/14] Add checks for some NIC hotplug related features added in qemu-0.10.0



Add QEMUD_CMD_FLAG_NET_NAME to indicate that '-net ...,name=foo' is
supported and QEMUD_CMD_FLAG_HOST_NET_ADD to indicate that the
'host_net_add' monitor command is available.

Set both these flags if the qemu version is greater than 0.10.0.
Checking via the '-help' output would not work for the monitor command
and even for the command line arg, it would be quite fragile.

* src/qemu_conf.h: add new flags as aliases of QEMUD_CMD_FLAG_0_10

* src/qemu_conf.c: set QEMUD_CMD_FLAG_0_10 for versions >= 0.10.0

* tests/qemuhelptest.c: set QEMUD_CMD_FLAG_0_10 for the appropriate
  qemu versions
---
 src/qemu_conf.c      |    3 +++
 src/qemu_conf.h      |    5 +++++
 tests/qemuhelptest.c |    9 ++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index ba99652..a9e5e4e 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -527,6 +527,9 @@ static unsigned int qemudComputeCmdFlags(const char *help,
         flags |= QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO;
     }
 
+    if (version >= 10000)
+        flags |= QEMUD_CMD_FLAG_0_10;
+
     return flags;
 }
 
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index fbf2ab9..1b2d061 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -58,6 +58,11 @@ enum qemud_cmd_flags {
     QEMUD_CMD_FLAG_KVM               = (1 << 13), /* Whether KVM is compiled in */
     QEMUD_CMD_FLAG_DRIVE_FORMAT      = (1 << 14), /* Is -drive format= avail */
     QEMUD_CMD_FLAG_VGA               = (1 << 15), /* Is -vga avail */
+
+    /* features added in qemu-0.10.0 */
+    QEMUD_CMD_FLAG_0_10         = (1 << 16),
+    QEMUD_CMD_FLAG_NET_NAME     = QEMUD_CMD_FLAG_0_10, /* -net ...,name=str */
+    QEMUD_CMD_FLAG_HOST_NET_ADD = QEMUD_CMD_FLAG_0_10, /* host_net_add monitor command */
 };
 
 /* Main driver state */
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 73eae54..1948bd1 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -118,7 +118,8 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
             QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
             QEMUD_CMD_FLAG_DRIVE_FORMAT |
-            QEMUD_CMD_FLAG_VGA,
+            QEMUD_CMD_FLAG_VGA |
+            QEMUD_CMD_FLAG_0_10,
             10005, 0,  0);
     DO_TEST("qemu-kvm-0.10.5",
             QEMUD_CMD_FLAG_VNC_COLON |
@@ -133,7 +134,8 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
             QEMUD_CMD_FLAG_KVM |
             QEMUD_CMD_FLAG_DRIVE_FORMAT |
-            QEMUD_CMD_FLAG_VGA,
+            QEMUD_CMD_FLAG_VGA |
+            QEMUD_CMD_FLAG_0_10,
             10005, 1,  0);
     DO_TEST("kvm-86",
             QEMUD_CMD_FLAG_VNC_COLON |
@@ -148,7 +150,8 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
             QEMUD_CMD_FLAG_KVM |
             QEMUD_CMD_FLAG_DRIVE_FORMAT |
-            QEMUD_CMD_FLAG_VGA,
+            QEMUD_CMD_FLAG_VGA |
+            QEMUD_CMD_FLAG_0_10,
             10050, 1,  0);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-- 
1.6.2.5


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