From dfa73b4a9b6c35ece94143b8b36622ad57acebbf Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 29 Jun 2012 08:58:19 +0100 Subject: [PATCH] libxl: log on failure in cpupool_info and libxl__domain_cpupool Also in cpupool_info propagate the failure value from libxl_cpumap_alloc. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl.c | 13 ++++++++++++- tools/libxl/libxl_dom.c | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9185e3735c..9f301a9098 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -571,16 +571,27 @@ static int cpupool_info(libxl__gc *gc, xcinfo = xc_cpupool_getinfo(CTX->xch, poolid); if (xcinfo == NULL) + { + LOGE(ERROR, "failed to get info for cpupool%d\n", poolid); return ERROR_FAIL; + } if (exact && xcinfo->cpupool_id != poolid) + { + LOG(ERROR, "got info for cpupool%d, wanted cpupool%d\n", + xcinfo->cpupool_id, poolid); goto out; + } info->poolid = xcinfo->cpupool_id; info->sched = xcinfo->sched_id; info->n_dom = xcinfo->n_dom; - if (libxl_cpumap_alloc(CTX, &info->cpumap, 0)) + rc = libxl_cpumap_alloc(CTX, &info->cpumap, 0); + if (rc) + { + LOG(ERROR, "unable to allocate cpumap %d\n", rc); goto out; + } memcpy(info->cpumap.map, xcinfo->cpumap, info->cpumap.size); rc = 0; diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 6120c82c0e..91aa4a279e 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -64,10 +64,15 @@ int libxl__domain_cpupool(libxl__gc *gc, uint32_t domid) ret = xc_domain_getinfolist(CTX->xch, domid, 1, &info); if (ret != 1) + { + LOGE(ERROR, "getinfolist failed %d\n", ret); return ERROR_FAIL; + } if (info.domain != domid) + { + LOGE(ERROR, "got info for dom%d, wanted dom%d\n", info.domain, domid); return ERROR_FAIL; - + } return info.cpupool; } -- 2.30.2