From: Gianni Tedesco Subject: Re: [PATCH 1/2] libxl, Introduce the command line handler for the new qemu. Date: Thu, 5 Aug 2010 15:40:22 +0100 Message-ID: <1281019222.18490.222.camel@qabil.uk.xensource.com> References: <1280938265-12107-1-git-send-email-anthony.perard@citrix.com> <1280938265-12107-2-git-send-email-anthony.perard@citrix.com> <4C5ABBB6.6070608@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C5ABBB6.6070608@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Anthony Perard Cc: "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2010-08-05 at 14:25 +0100, Anthony Perard wrote: > Stefano Stabellini wrote: > > On Wed, 4 Aug 2010, anthony.perard@citrix.com wrote: > >> From: Anthony PERARD > >> > >> 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 > >> --- > >> 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. Yes but this is the problem exactly. The output of this does not correlate to which set of command-line options are supported. We cannot predict the future as to precisely what form any merge to qemu upstream will take. Our only reliable choice is to add something new and deliberately non-standardized to existing qemu-xen fork and detect that. Gianni