[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/2] libxl: Use QMP cpu-add to hotplug CPU with qemu-xen.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- tools/libxl/libxl.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index ee1fa9c..e31b866 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4237,7 +4237,8 @@ int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid, return 0; } -int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) +static int libxl__set_vcpuonline_xenstore(libxl_ctx *ctx, uint32_t domid, + libxl_bitmap *cpumap) { GC_INIT(ctx); libxl_dominfo info; @@ -4268,6 +4269,44 @@ out: return rc; } +static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, + libxl_bitmap *cpumap) +{ + libxl_dominfo info; + int i, rc = 0; + + if (libxl_domain_info(CTX, &info, domid) < 0) { + LIBXL__LOG_ERRNO(CTX, LIBXL__LOG_ERROR, "getting domain info list"); + rc = ERROR_FAIL; + goto out; + } + for (i = 0; i <= info.vcpu_max_id; i++) { + if (libxl_bitmap_test(cpumap, i)) { + rc = libxl__qmp_cpu_add(gc, domid, i); + } + } +out: + return rc; +} + +int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) +{ + GC_INIT(ctx); + int rc; + switch (libxl__device_model_version_running(gc, domid)) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + rc = libxl__set_vcpuonline_xenstore(ctx, domid, cpumap); + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap); + break; + default: + rc = ERROR_INVAL; + } + GC_FREE; + return rc; +} + libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx) { libxl_scheduler sched, ret; -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |