[libvirt] [PATCH] lxc: return correct number of CPUs

Martin Kletzander mkletzan at redhat.com
Tue May 29 07:12:32 UTC 2012


When getting number of CPUs the host has assigned, there was always
number "1" returned. Even though all lxc domains with no pinning
launched by libvirt run on all pCPUs (by default, no matter what's the
number), we should at least return the same number as the user
specified when creating the domain.
---
The bug addressed above will be managed later, because I believe this
needs to be discussed first (we don't say that <vcpu> is not supported
for lxc, but we are able to set only pinning, shares, not number of
CPUs; due to using cgroups). The question will be: "Should we change
the docs and ban it in the code or make some workaround for fixing
it?"

 src/lxc/lxc_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 9aea556..33b2774 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -590,7 +590,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
     }

     info->maxMem = vm->def->mem.max_balloon;
-    info->nrVirtCpu = 1;
+    info->nrVirtCpu = vm->def->vcpus;
     ret = 0;

 cleanup:
--
1.7.8.6




More information about the libvir-list mailing list