[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: only issue cpu-add call to QEMU for not present CPU
commit 56bac262e097684b20f7753ceb6debe594e9725c Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Wed Jun 8 15:01:02 2016 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Jul 12 12:49:41 2016 +0100 libxl: only issue cpu-add call to QEMU for not present CPU Calculate the final bitmap for CPUs to add to avoid having annoying error messages complaining those CPUs are already present. Example message is like (wrapped): libxl: error: libxl_qmp.c:287:qmp_handle_error_response: received an error message from QMP server: Unable to add CPU: 0, it already exists We can also properly handle error from QMP now. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index d059251..e49741d 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -5756,19 +5756,38 @@ static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, libxl_bitmap *cpumap, const libxl_dominfo *info) { - int i; + int i, rc; + libxl_bitmap current_map, final_map; + + libxl_bitmap_init(¤t_map); + libxl_bitmap_init(&final_map); + + libxl_bitmap_alloc(CTX, ¤t_map, info->vcpu_max_id + 1); + libxl_bitmap_set_none(¤t_map); + rc = libxl__qmp_query_cpus(gc, domid, ¤t_map); + if (rc) { + LOG(ERROR, "failed to query cpus for domain %d", domid); + goto out; + } + + libxl_bitmap_copy_alloc(CTX, &final_map, cpumap); - for (i = 0; i <= info->vcpu_max_id; i++) { - if (libxl_bitmap_test(cpumap, i)) { - /* Return value is ignore because it does not tell anything useful - * on the completion of the command. - * (For instance, "CPU already plugged-in" give the same return - * value as "command not supported".) - */ - libxl__qmp_cpu_add(gc, domid, i); + libxl_for_each_set_bit(i, current_map) + libxl_bitmap_reset(&final_map, i); + + libxl_for_each_set_bit(i, final_map) { + rc = libxl__qmp_cpu_add(gc, domid, i); + if (rc) { + LOG(ERROR, "failed to add cpu %d to domain %d", i, domid); + goto out; } } - return 0; + + rc = 0; +out: + libxl_bitmap_dispose(¤t_map); + libxl_bitmap_dispose(&final_map); + return rc; } int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |