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

Re: [Xen-devel] [PATCH 1/2] libxl, Introduce the command line handler for the new qemu.



Stefano Stabellini wrote:
On Wed, 4 Aug 2010, anthony.perard@xxxxxxxxxx wrote:
From: Anthony PERARD <anthony.perard@xxxxxxxxxx>

This patch adds a function to check the version of the device model.
Depending on the version of the DM, the command line arguments will be
built differently.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libxl/libxl.c       |  163 ++++++++++++++++++++++++++++++++++++++++++++-
 tools/libxl/libxl_utils.c |   73 ++++++++++++++++++++
 tools/libxl/libxl_utils.h |    5 ++
 3 files changed, 240 insertions(+), 1 deletions(-)
>>
>> [...]
>>
+    // Search for the new version or the old version:
+    // QEMU emulator version 0.12.50, ...
+    // QEMU PC emulator version 0.10.2, ...
+    if (strncmp("QEMU", buf, 4) == 0) {
+        char *v = strstr(buf, "version ");
+        if (v) {
+            int major, minor;
+            char *endptr = NULL;
+
+            v += strlen("version ");
+            major = strtol(v, &endptr, 10);
+            if (major == 0 && endptr && *endptr == '.') {
+                v = endptr + 1;
+                minor = strtol(v, &endptr, 10);
+                if (minor >= 12)
+                    return 1;
+            }
+            return 0;
+        }
+    }
+    return 0;
+}

I think Gianni is right about the string to search: it is probably
better to add a Xen specific string to qemu-dm, like "QEMU-DM", and rely
on that and the version (0.10.2 or older) to distinguish between the
two.

I can do something better by run "qemu -M ?" and check if "xenfv" machine is supported. This work with both versions.

--
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.