|
|
6ae9ed |
From a7e224cdad4aae6641fed84cdad621e7fecc8dc7 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <a7e224cdad4aae6641fed84cdad621e7fecc8dc7@dist-git>
|
|
|
6ae9ed |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 24 Aug 2016 16:10:53 -0400
|
|
|
6ae9ed |
Subject: [PATCH] Fix logic in qemuDomainObjPrivateXMLParseVcpu
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
|
|
|
6ae9ed |
|
|
|
6ae9ed |
The code in qemuDomainObjPrivateXMLParseVcpu for parsing
|
|
|
6ae9ed |
the 'idstr' string was comparing the overall boolean
|
|
|
6ae9ed |
result against 0 which was always true
|
|
|
6ae9ed |
|
|
|
6ae9ed |
qemu/qemu_domain.c: In function 'qemuDomainObjPrivateXMLParseVcpu':
|
|
|
6ae9ed |
qemu/qemu_domain.c:1482:59: error: comparison of constant '0' with boolean expression is always false [-Werror=bool-compare]
|
|
|
6ae9ed |
if ((idstr && virStrToLong_uip(idstr, NULL, 10, &idx)) < 0 ||
|
|
|
6ae9ed |
^
|
|
|
6ae9ed |
|
|
|
6ae9ed |
It was further performing two distinct error checks in
|
|
|
6ae9ed |
the same conditional and reporting a single error message,
|
|
|
6ae9ed |
which was misleading in one of the two cases.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
This splits the conditional check into two parts with
|
|
|
6ae9ed |
distinct error messages and fixes the logic error.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Fixes the bug in
|
|
|
6ae9ed |
|
|
|
6ae9ed |
commit 5184f398b40a5e0d7d84b86182edcb2b48ab04ba
|
|
|
6ae9ed |
Author: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Fri Jul 1 14:56:14 2016 +0200
|
|
|
6ae9ed |
|
|
|
6ae9ed |
qemu: Store vCPU thread ids in vcpu private data objects
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit ed1fbd7c5ba90ce10cb9a7e35f32a4b4354988aa)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_domain.c | 11 ++++++++---
|
|
|
6ae9ed |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
index 38225b5..1148b52 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
@@ -1510,10 +1510,15 @@ qemuDomainObjPrivateXMLParseVcpu(xmlNodePtr node,
|
|
|
6ae9ed |
|
|
|
6ae9ed |
idstr = virXMLPropString(node, "id");
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if ((idstr && virStrToLong_uip(idstr, NULL, 10, &idx)) < 0 ||
|
|
|
6ae9ed |
- !(vcpu = virDomainDefGetVcpu(def, idx))) {
|
|
|
6ae9ed |
+ if (idstr &&
|
|
|
6ae9ed |
+ (virStrToLong_uip(idstr, NULL, 10, &idx) < 0)) {
|
|
|
6ae9ed |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
6ae9ed |
- _("invalid vcpu index '%s'"), idstr);
|
|
|
6ae9ed |
+ _("cannot parse vcpu index '%s'"), idstr);
|
|
|
6ae9ed |
+ goto cleanup;
|
|
|
6ae9ed |
+ }
|
|
|
6ae9ed |
+ if (!(vcpu = virDomainDefGetVcpu(def, idx))) {
|
|
|
6ae9ed |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
6ae9ed |
+ _("invalid vcpu index '%u'"), idx);
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|