[libvirt] [PATCH 3/6] virsh: Fix xpath queries for retrieving vcpu count

Peter Krempa pkrempa at redhat.com
Tue Oct 11 16:08:03 UTC 2016


The fallback code used if virDomainGetVcpusFlags is not supported used
wrong XPath queries and basically did not work at all. Fix them to point
to the <domain> <vcpu> element instead of <vcpus> which was not present
until lately.
---
 tools/virsh-domain.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 03bf032..5fdad1b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6157,13 +6157,12 @@ virshCPUCountCollect(vshControl *ctl,
             goto cleanup;

         if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
-            if (virXPathInt("string(/domain/vcpus)", ctxt, &count) < 0) {
+            if (virXPathInt("string(/domain/vcpu)", ctxt, &count) < 0) {
                 vshError(ctl, "%s", _("Failed to retrieve maximum vcpu count"));
                 goto cleanup;
             }
         } else {
-            if (virXPathInt("string(/domain/vcpus/@current)",
-                            ctxt, &count) < 0) {
+            if (virXPathInt("string(/domain/vcpu/@current)", ctxt, &count) < 0) {
                 vshError(ctl, "%s", _("Failed to retrieve current vcpu count"));
                 goto cleanup;
             }
-- 
2.10.0




More information about the libvir-list mailing list