Patchwork Adapt libvirt's Qemu version parser for Qemu 1.0

login
register
mail settings
Submitter Stefan Berger
Date Dec. 2, 2011, 8:08 p.m.
Message ID <4ED93037.7070902@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/128952/
State New
Headers show

Comments

Stefan Berger - Dec. 2, 2011, 8:08 p.m.
Qemu 1.0 does not show a micro version like 0.15.50 did. Adapt the
Qemu version parser to handle this.

---
  src/qemu/qemu_capabilities.c |   11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
Eric Blake - Dec. 2, 2011, 8:32 p.m.
On 12/02/2011 01:08 PM, Stefan Berger wrote:
> Qemu 1.0 does not show a micro version like 0.15.50 did. Adapt the
> Qemu version parser to handle this.
> 
> ---
>  src/qemu/qemu_capabilities.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

While this solves the problem, I prefer Jirka's version as being more
complete.  NACK.
Stefan Berger - Dec. 2, 2011, 8:52 p.m.
On 12/02/2011 03:32 PM, Eric Blake wrote:
> On 12/02/2011 01:08 PM, Stefan Berger wrote:
>> Qemu 1.0 does not show a micro version like 0.15.50 did. Adapt the
>> Qemu version parser to handle this.
>>
>> ---
>>   src/qemu/qemu_capabilities.c |   11 ++++++++++-
>>   1 file changed, 10 insertions(+), 1 deletion(-)
> While this solves the problem, I prefer Jirka's version as being more
> complete.  NACK.
>
No problem.
What's unfortunate about it is that the parser was not flexible to 
handle it, thus 0.9.8 will presumably be the first version to accept 
Qemu 1.0.

     Stefan

Patch

Index: libvirt-tpm/src/qemu/qemu_capabilities.c
===================================================================
--- libvirt-tpm.orig/src/qemu/qemu_capabilities.c
+++ libvirt-tpm/src/qemu/qemu_capabilities.c
@@ -1147,15 +1147,24 @@  int qemuCapsParseHelpStr(const char *qem
      ++p;

      minor = virParseNumber(&p);
-    if (minor == -1 || *p != '.')
+    if (minor == -1)
          goto fail;

+    if (major == 0 && *p != '.')
+        goto fail;
+
+    if (major > 0 && *p != '.') {
+        micro = 0;
+        goto skip_micro;
+    }
+
      ++p;

      micro = virParseNumber(&p);
      if (micro == -1)
          goto fail;

+skip_micro:
      SKIP_BLANKS(p);

      if (STRPREFIX(p, QEMU_KVM_VER_PREFIX)) {