QEMU changed the output of -cpu ? and CPU models can now be followed by
its description. Our parser just used both model name and its
description as a model name, which made any model with a description
unusable with libvirt.
---
src/qemu/qemu_capabilities.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a5eb995..d16a7bc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -379,7 +379,7 @@ typedef int
qemuCapsPtr caps);
/* Format:
- * <arch> <model>
+ * <arch> <model> <description>
* qemu-0.13 encloses some model names in []:
* <arch> [<model>]
*/
@@ -389,6 +389,7 @@ qemuCapsParseX86Models(const char *output,
{
const char *p = output;
const char *next;
+ const char *end;
int ret = -1;
do {
@@ -416,8 +417,12 @@ qemuCapsParseX86Models(const char *output,
goto cleanup;
}
- if (next)
- len = next - p - 1;
+ end = next ? next - 1 : NULL;
+ if ((t = strchr(p, ' ')) && (!next || t < next))
+ end = t;
+
+ if (end)
+ len = end - p;
else
len = strlen(p);
--
1.7.12