]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: fix bug the number of running vcpu inconsistent with config file
authorZhang, Yang Z <yang.z.zhang@intel.com>
Tue, 24 Jul 2012 09:29:18 +0000 (10:29 +0100)
committerZhang, Yang Z <yang.z.zhang@intel.com>
Tue, 24 Jul 2012 09:29:18 +0000 (10:29 +0100)
The following patch will fix the bug 1825. http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1825

When using memcpy to update vcpu_online, the high bits of vcpu_online
may unmodified if the size of avail_vcpus less than vcpu_online. So we
need to clear it before the memory copying.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: Ian Campbell <ian.campbelL@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_dom.c

index b6111ad434dd56fa80a0e003000cd1c3549d80d8..cecda9ba84b717b66274481fc7870cfbc8f89b73 100644 (file)
@@ -357,6 +357,7 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
     va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
     va_hvm->apic_mode = libxl_defbool_val(info->u.hvm.apic);
     va_hvm->nr_vcpus = info->max_vcpus;
+    memset(va_hvm->vcpu_online, 0, sizeof(va_hvm->vcpu_online));
     memcpy(va_hvm->vcpu_online, info->avail_vcpus.map, info->avail_vcpus.size);
     for (i = 0, sum = 0; i < va_hvm->length; i++)
         sum += ((uint8_t *) va_hvm)[i];