99cbc7
From 3e0b4c3b680df486b750174203da60e01198bddf Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <3e0b4c3b680df486b750174203da60e01198bddf@dist-git>
99cbc7
From: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Date: Thu, 6 Jun 2019 09:29:38 +0200
99cbc7
Subject: [PATCH] cpu_conf: Fix XPath for parsing TSC frequency
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Due to this bug the following command would fail on any host where TSC
99cbc7
frequency can be probed:
99cbc7
99cbc7
    $ virsh capabilities | virsh cpu-baseline /dev/stdin
99cbc7
    error: unsupported configuration: Invalid TSC frequency
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1641702
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
(cherry picked from commit 4d21d4acf2eac961b8c25f1ec49a9c25f3951fdb)
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/conf/cpu_conf.c | 4 ++--
99cbc7
 1 file changed, 2 insertions(+), 2 deletions(-)
99cbc7
99cbc7
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
99cbc7
index d0ad265fbe..7a5e642541 100644
99cbc7
--- a/src/conf/cpu_conf.c
99cbc7
+++ b/src/conf/cpu_conf.c
99cbc7
@@ -407,8 +407,8 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
99cbc7
             if (VIR_ALLOC(tsc) < 0)
99cbc7
                 goto cleanup;
99cbc7
 
99cbc7
-            if (virXPathULongLong("./counter[@name='tsc']/@frequency", ctxt,
99cbc7
-                                  &tsc->frequency) < 0) {
99cbc7
+            if (virXPathULongLong("string(./counter[@name='tsc']/@frequency)",
99cbc7
+                                  ctxt, &tsc->frequency) < 0) {
99cbc7
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
99cbc7
                                _("Invalid TSC frequency"));
99cbc7
                 goto cleanup;
99cbc7
-- 
99cbc7
2.21.0
99cbc7