All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG
@ 2011-05-04 15:04 Ian Campbell
  2011-05-20 17:12 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2011-05-04 15:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1304521260 -3600
# Node ID 8598c4316296d0921a6074654a7ad610d0e7a5cb
# Parent  36871b37a9bd286d6ef291b41513c33325db9719
libxl: turn some stray printf's in libxl into LIBXL__LOG.

Appear to have been leftover from when the domain create stuff was pushed down
from xl into the library.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r 36871b37a9bd -r 8598c4316296 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Wed May 04 14:41:55 2011 +0100
+++ b/tools/libxl/libxl_create.c	Wed May 04 16:01:00 2011 +0100
@@ -411,7 +411,7 @@ static int do_domain_create(libxl__gc *g
 
     ret = libxl__domain_make(gc, &d_config->c_info, &domid);
     if (ret) {
-        fprintf(stderr, "cannot make domain: %d\n", ret);
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot make domain: %d", ret);
         ret = ERROR_FAIL;
         goto error_out;
     }
@@ -424,7 +424,8 @@ static int do_domain_create(libxl__gc *g
     if ( restore_fd < 0 ) {
         ret = libxl_run_bootloader(ctx, &d_config->b_info, d_config->num_disks > 0 ? &d_config->disks[0] : NULL, domid);
         if (ret) {
-            fprintf(stderr, "failed to run bootloader: %d\n", ret);
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "failed to run bootloader: %d", ret);
             goto error_out;
         }
     }
@@ -440,7 +441,7 @@ static int do_domain_create(libxl__gc *g
     }
 
     if (ret) {
-        fprintf(stderr, "cannot (re-)build domain: %d\n", ret);
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot (re-)build domain: %d", ret);
         ret = ERROR_FAIL;
         goto error_out;
     }
@@ -448,7 +449,8 @@ static int do_domain_create(libxl__gc *g
     for (i = 0; i < d_config->num_disks; i++) {
         ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]);
         if (ret) {
-            fprintf(stderr, "cannot add disk %d to domain: %d\n", i, ret);
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "cannot add disk %d to domain: %d", i, ret);
             ret = ERROR_FAIL;
             goto error_out;
         }
@@ -456,7 +458,8 @@ static int do_domain_create(libxl__gc *g
     for (i = 0; i < d_config->num_vifs; i++) {
         ret = libxl_device_nic_add(ctx, domid, &d_config->vifs[i]);
         if (ret) {
-            fprintf(stderr, "cannot add nic %d to domain: %d\n", i, ret);
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "cannot add nic %d to domain: %d", i, ret);
             ret = ERROR_FAIL;
             goto error_out;
         }
@@ -476,8 +479,8 @@ static int do_domain_create(libxl__gc *g
                                         d_config->vifs, d_config->num_vifs,
                                         &dm_starting);
         if (ret < 0) {
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: libxl__create_device_model\n",
-                    __FILE__,__LINE__, ret);
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "failed to create device model: %d", ret);
             goto error_out;
         }
     } else {
@@ -510,8 +513,8 @@ static int do_domain_create(libxl__gc *g
     if (dm_starting) {
         ret = libxl__confirm_device_model_startup(gc, dm_starting);
         if (ret < 0) {
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: libxl__confirm_device_model_startup\n",
-                    __FILE__,__LINE__, ret);
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "device model did not start: %d", ret);
             goto error_out;
         }
     }
diff -r 36871b37a9bd -r 8598c4316296 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Wed May 04 14:41:55 2011 +0100
+++ b/tools/libxl/libxl_device.c	Wed May 04 16:01:00 2011 +0100
@@ -447,6 +447,8 @@ int libxl__wait_for_device_model(libxl__
         if ( starting ) {
             rc = libxl__spawn_check(gc, starting->for_spawn);
             if ( rc ) {
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                           "Device Model died during startup");
                 rc = -1;
                 goto err_died;
             }
@@ -489,10 +491,10 @@ again:
             }
         }
     }
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
 err_died:
     xs_unwatch(xsh, path, path);
     xs_daemon_close(xsh);
-    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
 err:
     return -1;
 }

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

* Re: [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG
  2011-05-04 15:04 [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG Ian Campbell
@ 2011-05-20 17:12 ` Ian Jackson
  2011-05-23  9:35   ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2011-05-20 17:12 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[Xen-devel] [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG"):
> libxl: turn some stray printf's in libxl into LIBXL__LOG.
> 
> Appear to have been leftover from when the domain create stuff was
> pushed down from xl into the library.

Oops.

The changes to libxl_device.c didn't apply (and anyway don't seem to
have been covered by your commit message); I have committed those to
libxl_create.c.

Thanks,
Ian.

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

* Re: [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG
  2011-05-20 17:12 ` Ian Jackson
@ 2011-05-23  9:35   ` Ian Campbell
  2011-05-23  9:41     ` [PATCH] libxl: improve logging on failure to start device model Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2011-05-23  9:35 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Fri, 2011-05-20 at 18:12 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[Xen-devel] [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG"):
> > libxl: turn some stray printf's in libxl into LIBXL__LOG.
> > 
> > Appear to have been leftover from when the domain create stuff was
> > pushed down from xl into the library.
> 
> Oops.
> 
> The changes to libxl_device.c didn't apply (and anyway don't seem to
> have been covered by your commit message);

Hmm, those look to have been more associated with the "libxl: improve
error handling when device model fails to start early on" changes I was
working on around the same time, obviously got into the wrong patch
somehow.

> I have committed those to libxl_create.c.

Thanks.

Ian.

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

* [PATCH] libxl: improve logging on failure to start device model
  2011-05-23  9:35   ` Ian Campbell
@ 2011-05-23  9:41     ` Ian Campbell
  2011-05-24 15:16       ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2011-05-23  9:41 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1306143609 -3600
# Node ID 574a94c82cb5ed0f41b68239075b5f97f3fff639
# Parent  25bcb1c381a32b9a489c3879e70227ff9387bc7c
libxl: improve logging on failure to start device model.

Distinguish between device model dying during startup (libxl__spawn_check
returns failure) and timing out while waiting for the xenstore node to show up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
This patch depends on the four patches in "libxl: improve error handling when
device model fails to start early on" and in particular "[PATCH 4 of 4] libxl:
add statup checks to libxl__wait_for_device_model"

diff -r 25bcb1c381a3 -r 574a94c82cb5 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Mon May 23 10:35:56 2011 +0100
+++ b/tools/libxl/libxl_device.c	Mon May 23 10:40:09 2011 +0100
@@ -447,6 +447,8 @@ int libxl__wait_for_device_model(libxl__
         if ( starting ) {
             rc = libxl__spawn_check(gc, starting->for_spawn);
             if ( rc ) {
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                           "Device Model died during startup");
                 rc = -1;
                 goto err_died;
             }
@@ -489,10 +491,10 @@ again:
             }
         }
     }
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
 err_died:
     xs_unwatch(xsh, path, path);
     xs_daemon_close(xsh);
-    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
 err:
     return -1;
 }

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

* Re: [PATCH] libxl: improve logging on failure to start device model
  2011-05-23  9:41     ` [PATCH] libxl: improve logging on failure to start device model Ian Campbell
@ 2011-05-24 15:16       ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2011-05-24 15:16 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[PATCH] libxl: improve logging on failure to start device model"):
> libxl: improve logging on failure to start device model.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.

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

end of thread, other threads:[~2011-05-24 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 15:04 [PATCH] libxl: turn some stray printf's in libxl into LIBXL__LOG Ian Campbell
2011-05-20 17:12 ` Ian Jackson
2011-05-23  9:35   ` Ian Campbell
2011-05-23  9:41     ` [PATCH] libxl: improve logging on failure to start device model Ian Campbell
2011-05-24 15:16       ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.