libxl: log on failure in cpupool_info and libxl__domain_cpupool
authorIan Campbell <ian.campbell@citrix.com>
Fri, 29 Jun 2012 07:58:19 +0000 (08:58 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 29 Jun 2012 07:58:19 +0000 (08:58 +0100)
Also in cpupool_info propagate the failure value from
libxl_cpumap_alloc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_dom.c

index 9185e3735c5903ee918d2bdc24a14d860d9210d3..9f301a90980bc7bf716caa32a465204b72918ef4 100644 (file)
@@ -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;
index 6120c82c0eb6d454e1101641245a6f570e506623..91aa4a279ede67d5333ba8bda91eb3ec9977e9c5 100644 (file)
@@ -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;
 }