xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xl: Suppress spurious warning message for cpupool-list
@ 2012-11-20 16:09 George Dunlap
  2012-11-21 10:27 ` George Dunlap
  2012-11-23 11:09 ` Ian Campbell
  0 siblings, 2 replies; 10+ messages in thread
From: George Dunlap @ 2012-11-20 16:09 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1353427397 0
# Node ID ab313e9521f44bdd91a20a1b3eb499b2ee321b5e
# Parent  ae6fb202b233af815466055d9f1a635802a50855
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.

Since at the moment the times we want to print the message correspond
with the use of the existing "exact" parameter, use it to decide
whether to print the message or not.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -593,7 +593,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 (exact || errno != ENOENT)
+            LOGE(ERROR, "failed to get info for cpupool%d\n", poolid);
         return ERROR_FAIL;
     }

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH] xl: Suppress spurious warning message for cpupool-list
@ 2012-08-15  9:28 George Dunlap
  2012-08-17  8:21 ` Ian Campbell
  0 siblings, 1 reply; 10+ messages in thread
From: George Dunlap @ 2012-08-15  9:28 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# 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@eu.citrix.com>

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) {

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-29 14:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-20 16:09 [PATCH] xl: Suppress spurious warning message for cpupool-list George Dunlap
2012-11-21 10:27 ` George Dunlap
2012-11-23 11:09 ` Ian Campbell
2012-11-29 14:59   ` Ian Jackson
  -- strict thread matches above, loose matches on Subject: below --
2012-08-15  9:28 George Dunlap
2012-08-17  8:21 ` Ian Campbell
2012-08-17  8:23   ` Ian Campbell
2012-08-31  8:16   ` Ian Campbell
2012-11-20 16:03   ` George Dunlap
2012-11-20 16:08     ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).