From: Konrad Rzeszutek Wilk Subject: [PATCH] libxl: Make 'xl vcpu-set' work properly on overcommited hosts. Date: Tue, 7 May 2013 16:40:44 -0400 Message-ID: <1367959244-5413-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com, xen-devel@lists.xensource.com Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org The libxl_cpu_bitmap_alloc(..) function, if provided with a zero value for max CPUs will call xc_get_max_cpus() which will retrieve the number of physical CPUs the host has. This is usually OK if the guest's maxvcpus <= host pcpus. But if the value is different, then the bitmap for VCPUs is limited by the number of CPUs the host has. This is incorrect as what we want is to hotplug in the guest the amount of CPUs that the user specified on the command line and not be limited by the amount of physical CPUs. Signed-off-by: Konrad Rzeszutek Wilk --- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index c1a969b..ef7f81b 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4499,7 +4499,7 @@ static void vcpuset(uint32_t domid, const char* nr_vcpus) return; } - if (libxl_cpu_bitmap_alloc(ctx, &cpumap, 0)) { + if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) { fprintf(stderr, "libxl_cpu_bitmap_alloc failed\n"); return; } -- 1.8.1.4