aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_create.c
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@Intel.com>2012-06-28 17:51:56 +0100
committerYang Zhang <yang.z.zhang@Intel.com>2012-06-28 17:51:56 +0100
commite1e1e98cacd82fa054ac3c6b381d9833236110e0 (patch)
tree77708e08b3f5c559b3c74d0323d7d33155e00aaa /tools/libxl/libxl_create.c
parent928c75ce59fc11c707b8bfd0b99ce0c07ab89926 (diff)
downloadxen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.tar.gz
xen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.tar.bz2
xen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.zip
libxl: allow setting more than 31 vcpus
In current implementation, it uses integer to record current avail cpus and this only allows user to specify 31 vcpus. In following patch, it uses cpumap instead integer which make more sense than before. Also there is no limit to the max vcpus. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_create.c')
-rw-r--r--tools/libxl/libxl_create.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 08e5536c0c..4599e733b1 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -22,6 +22,7 @@
#include <xc_dom.h>
#include <xenguest.h>
+#include <xen/hvm/hvm_info_table.h>
void libxl_domain_config_init(libxl_domain_config *d_config)
{
@@ -201,8 +202,12 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
if (!b_info->max_vcpus)
b_info->max_vcpus = 1;
- if (!b_info->cur_vcpus)
- b_info->cur_vcpus = 1;
+ if (!b_info->avail_vcpus.size) {
+ if (libxl_cpumap_alloc(CTX, &b_info->avail_vcpus, 1))
+ return ERROR_FAIL;
+ libxl_cpumap_set(&b_info->avail_vcpus, 0);
+ } else if (b_info->avail_vcpus.size > HVM_MAX_VCPUS)
+ return ERROR_FAIL;
if (!b_info->cpumap.size) {
if (libxl_cpumap_alloc(CTX, &b_info->cpumap, 0))