X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fproto.c;h=d8b10486c79ecab594df202f68bdd0e4931c72ec;hb=76bd81820f50a390b7e853d65f41b29a37e63f43;hp=7cd1d3133a2fefed194fc736cef4196dead7bba4;hpb=02971adc3b0f07f3820d0c5e973fabf16d16deb3;p=libguestfs.git diff --git a/src/proto.c b/src/proto.c index 7cd1d31..d8b1048 100644 --- a/src/proto.c +++ b/src/proto.c @@ -285,6 +285,24 @@ read_log_message_or_eof (guestfs_h *g, int fd, int error_if_eof) /* It's an actual log message, send it upwards if anyone is listening. */ guestfs___call_callbacks_message (g, GUESTFS_EVENT_APPLIANCE, buf, n); + /* This is a gross hack. See the comment above + * guestfs___launch_send_progress. + */ + if (g->state == LAUNCHING) { + const char *sentinel; + size_t len; + + sentinel = "Linux version"; /* kernel up */ + len = strlen (sentinel); + if (memmem (buf, n, sentinel, len) != NULL) + guestfs___launch_send_progress (g, 6); + + sentinel = "Starting /init script"; /* /init running */ + len = strlen (sentinel); + if (memmem (buf, n, sentinel, len) != NULL) + guestfs___launch_send_progress (g, 9); + } + return 0; } @@ -513,6 +531,25 @@ guestfs___send_to_daemon (guestfs_h *g, const void *v_buf, size_t n) * will not see GUESTFS_PROGRESS_FLAG. */ +static inline void +unexpected_end_of_file_from_daemon_error (guestfs_h *g) +{ +#define UNEXPEOF_ERROR "unexpected end of file when reading from daemon.\n" +#define UNEXPEOF_TEST_TOOL \ + "Or you can run 'libguestfs-test-tool' and post the complete output into\n" \ + "a bug report or message to the libguestfs mailing list." + if (!g->verbose) + error (g, _(UNEXPEOF_ERROR +"This usually means the libguestfs appliance failed to start up. Please\n" +"enable debugging (LIBGUESTFS_DEBUG=1) and rerun the command, then look at\n" +"the debug messages output prior to this error.\n" +UNEXPEOF_TEST_TOOL)); + else + error (g, _(UNEXPEOF_ERROR +"See earlier debug messages.\n" +UNEXPEOF_TEST_TOOL)); +} + int guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) { @@ -578,7 +615,7 @@ guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) return -1; } if (r == 0) { - error (g, _("unexpected end of file when reading from daemon")); + unexpected_end_of_file_from_daemon_error (g); child_cleanup (g); return -1; } @@ -641,7 +678,7 @@ guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) return -1; } if (r == 0) { - error (g, _("unexpected end of file when reading from daemon")); + unexpected_end_of_file_from_daemon_error (g); child_cleanup (g); free (*buf_rtn); *buf_rtn = NULL;