[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xl: Suppress spurious warning message for cpupool-list
# HG changeset patch # User George Dunlap <george.dunlap@xxxxxxxxxxxxx> # Date 1345022863 -3600 # Node ID 0982bad392e4f96fb39a025d6528c33be32c6c04 # Parent dc56a9defa30312a46cfb6ddb578e64cfbc6bc8b xl: Suppress spurious warning message for cpupool-list libxl_cpupool_list() enumerates the cpupools by "probing": calling cpupool_info, starting at 0 and stopping when it gets an error. However, cpupool_info will print an error when the call to xc_cpupool_getinfo() fails, resulting in every xl command that uses libxl_list_cpupool (such as cpupool-list) printing that error message spuriously. This patch adds a "probe" argument to cpupool_info(). If set, it won't print a warning if the xc_cpupool_getinfo() fails with ENOENT. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -583,7 +583,8 @@ int libxl_domain_info(libxl_ctx *ctx, li static int cpupool_info(libxl__gc *gc, libxl_cpupoolinfo *info, uint32_t poolid, - bool exact /* exactly poolid or >= poolid */) + bool exact /* exactly poolid or >= poolid */, + bool probe /* Don't complain for non-existent pools */) { xc_cpupoolinfo_t *xcinfo; int rc = ERROR_FAIL; @@ -591,7 +592,8 @@ 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); + if (!probe || errno != ENOENT) + LOGE(ERROR, "failed to get info for cpupool%d\n", poolid); return ERROR_FAIL; } @@ -623,7 +625,7 @@ int libxl_cpupool_info(libxl_ctx *ctx, libxl_cpupoolinfo *info, uint32_t poolid) { GC_INIT(ctx); - int rc = cpupool_info(gc, info, poolid, true); + int rc = cpupool_info(gc, info, poolid, true, false); GC_FREE; return rc; } @@ -639,7 +641,7 @@ libxl_cpupoolinfo * libxl_list_cpupool(l poolid = 0; for (i = 0;; i++) { - if (cpupool_info(gc, &info, poolid, false)) + if (cpupool_info(gc, &info, poolid, false, true)) break; tmp = realloc(ptr, (i + 1) * sizeof(libxl_cpupoolinfo)); if (!tmp) { _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |