]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Fix xpath queries for retrieving vcpu count
authorPeter Krempa <pkrempa@redhat.com>
Tue, 11 Oct 2016 13:40:31 +0000 (15:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 12 Oct 2016 15:29:07 +0000 (17:29 +0200)
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

index 03bf03252686fd43dd3da8ab27797a133a41e684..5fdad1b1b1b8b5db2a9233bb09a082dae2582d54 100644 (file)
@@ -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;
             }