* [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting
@ 2014-10-08 12:11 minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() minyard
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: minyard @ 2014-10-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
This version makes the error message reporting more sane and
adds a error_vreport() to make that easier.
It also cleans up the bool handling.
This depends on the previos non-blocking socket changes, which
should hopefully be in qemu soon.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport()
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
@ 2014-10-08 12:11 ` minyard
2014-10-08 14:38 ` Eric Blake
2014-10-08 12:11 ` [Qemu-devel] [PATCH 2/3] qemu-char: Fix reconnect socket error reporting minyard
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: minyard @ 2014-10-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Corey Minyard
From: Corey Minyard <cminyard@mvista.com>
Needed to nicely print socket error reports.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
include/qemu/error-report.h | 1 +
util/qemu-error.c | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 000eae3..7ab2355 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -38,6 +38,7 @@ void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_set_progname(const char *argv0);
+void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
const char *error_get_progname(void);
extern bool enable_timestamp_msg;
diff --git a/util/qemu-error.c b/util/qemu-error.c
index 7b167fd..9bba5f5 100644
--- a/util/qemu-error.c
+++ b/util/qemu-error.c
@@ -199,14 +199,13 @@ static void error_print_loc(void)
bool enable_timestamp_msg;
/*
* Print an error message to current monitor if we have one, else to stderr.
- * Format arguments like sprintf(). The result should not contain
+ * Format arguments like vsprintf(). The result should not contain
* newlines.
* Prepend the current location and append a newline.
* It's wrong to call this in a QMP monitor. Use qerror_report() there.
*/
-void error_report(const char *fmt, ...)
+void error_vreport(const char *fmt, va_list ap)
{
- va_list ap;
GTimeVal tv;
gchar *timestr;
@@ -218,8 +217,22 @@ void error_report(const char *fmt, ...)
}
error_print_loc();
- va_start(ap, fmt);
error_vprintf(fmt, ap);
- va_end(ap);
error_printf("\n");
}
+
+/*
+ * Print an error message to current monitor if we have one, else to stderr.
+ * Format arguments like sprintf(). The result should not contain
+ * newlines.
+ * Prepend the current location and append a newline.
+ * It's wrong to call this in a QMP monitor. Use qerror_report() there.
+ */
+void error_report(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ error_vreport(fmt, ap);
+ va_end(ap);
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/3] qemu-char: Fix reconnect socket error reporting
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() minyard
@ 2014-10-08 12:11 ` minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler minyard
2014-10-08 12:56 ` [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting Paolo Bonzini
3 siblings, 0 replies; 8+ messages in thread
From: minyard @ 2014-10-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Corey Minyard
From: Corey Minyard <cminyard@mvista.com>
If reconnect was set, errors wouldn't always be reported.
Fix that and also only report a connect error once until a
connection has been made.
The primary purpose of this is to tell the user that a
connection failed so they can know they need to figure out
what went wrong. So we don't want to spew too much
out here, just enough so they know.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
qemu-char.c | 57 ++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 62af0ef..83ff458 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2509,6 +2509,7 @@ typedef struct {
guint reconnect_timer;
int64_t reconnect_time;
+ bool connect_err_reported;
} TCPCharDriver;
static gboolean socket_reconnect_timeout(gpointer opaque);
@@ -2521,6 +2522,24 @@ static void qemu_chr_socket_restart_timer(CharDriverState *chr)
socket_reconnect_timeout, chr);
}
+static void check_report_connect_error(CharDriverState *chr,
+ const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+
+static void check_report_connect_error(CharDriverState *chr,
+ const char *fmt, ...)
+{
+ TCPCharDriver *s = chr->opaque;
+
+ if (!s->connect_err_reported) {
+ va_list ap;
+ va_start(ap, fmt);
+ error_vreport(fmt, ap);
+ va_end(ap);
+ s->connect_err_reported = true;
+ }
+ qemu_chr_socket_restart_timer(chr);
+}
+
static gboolean tcp_chr_accept(GIOChannel *chan, GIOCondition cond, void *opaque);
#ifndef _WIN32
@@ -3045,12 +3064,15 @@ static void qemu_chr_finish_socket_connection(CharDriverState *chr, int fd)
static void qemu_chr_socket_connected(int fd, void *opaque)
{
CharDriverState *chr = opaque;
+ TCPCharDriver *s = chr->opaque;
if (fd < 0) {
- qemu_chr_socket_restart_timer(chr);
+ check_report_connect_error(chr, "Unable to connect to socket %s",
+ chr->label);
return;
}
+ s->connect_err_reported = false;
qemu_chr_finish_socket_connection(chr, fd);
}
@@ -4066,11 +4088,21 @@ static CharDriverState *qmp_chardev_open_parallel(ChardevHostdev *parallel,
#endif /* WIN32 */
+static void socket_try_connect(CharDriverState *chr)
+{
+ Error *err = NULL;
+
+ if (!qemu_chr_open_socket_fd(chr, &err)) {
+ check_report_connect_error(chr,
+ "Unable to start connect to socket %s: %s",
+ chr->label, error_get_pretty(err));
+ }
+}
+
static gboolean socket_reconnect_timeout(gpointer opaque)
{
CharDriverState *chr = opaque;
TCPCharDriver *s = chr->opaque;
- Error *err;
s->reconnect_timer = 0;
@@ -4078,10 +4110,7 @@ static gboolean socket_reconnect_timeout(gpointer opaque)
return false;
}
- if (!qemu_chr_open_socket_fd(chr, &err)) {
- error_report("Unable to connect to char device %s\n", chr->label);
- qemu_chr_socket_restart_timer(chr);
- }
+ socket_try_connect(chr);
return false;
}
@@ -4133,15 +4162,13 @@ static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock,
s->reconnect_time = reconnect;
}
- if (!qemu_chr_open_socket_fd(chr, errp)) {
- if (s->reconnect_time) {
- qemu_chr_socket_restart_timer(chr);
- } else {
- g_free(s);
- g_free(chr->filename);
- g_free(chr);
- return NULL;
- }
+ if (s->reconnect_time) {
+ socket_try_connect(chr);
+ } else if (!qemu_chr_open_socket_fd(chr, errp)) {
+ g_free(s);
+ g_free(chr->filename);
+ g_free(chr);
+ return NULL;
}
if (is_listen && is_waitconnect) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 2/3] qemu-char: Fix reconnect socket error reporting minyard
@ 2014-10-08 12:11 ` minyard
2014-10-09 10:07 ` Paolo Bonzini
2014-10-08 12:56 ` [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting Paolo Bonzini
3 siblings, 1 reply; 8+ messages in thread
From: minyard @ 2014-10-08 12:11 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Corey Minyard
From: Corey Minyard <cminyard@mvista.com>
An error value here would be quite handy and more consistent
with the rest of the code.
Corey Minyard <cminyard@mvista.com>
---
include/qemu/sockets.h | 2 +-
migration-tcp.c | 4 ++--
migration-unix.c | 4 ++--
qemu-char.c | 6 +++---
util/qemu-sockets.c | 19 ++++++++++++++-----
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index fdbb196..f47dae6 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -47,7 +47,7 @@ int recv_all(int fd, void *buf, int len1, bool single_read);
/* callback function for nonblocking connect
* valid fd on success, negative error code on failure
*/
-typedef void NonBlockingConnectHandler(int fd, void *opaque);
+typedef void NonBlockingConnectHandler(int fd, Error *errp, void *opaque);
InetSocketAddress *inet_parse(const char *str, Error **errp);
int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp);
diff --git a/migration-tcp.c b/migration-tcp.c
index 2e34517..91c9cf3 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -33,12 +33,12 @@
do { } while (0)
#endif
-static void tcp_wait_for_connect(int fd, void *opaque)
+static void tcp_wait_for_connect(int fd, Error *err, void *opaque)
{
MigrationState *s = opaque;
if (fd < 0) {
- DPRINTF("migrate connect error\n");
+ DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
s->file = NULL;
migrate_fd_error(s);
} else {
diff --git a/migration-unix.c b/migration-unix.c
index 0a5f8a1..1cdadfb 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -33,12 +33,12 @@
do { } while (0)
#endif
-static void unix_wait_for_connect(int fd, void *opaque)
+static void unix_wait_for_connect(int fd, Error *err, void *opaque)
{
MigrationState *s = opaque;
if (fd < 0) {
- DPRINTF("migrate connect error\n");
+ DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
s->file = NULL;
migrate_fd_error(s);
} else {
diff --git a/qemu-char.c b/qemu-char.c
index 83ff458..8f3af06 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3061,14 +3061,14 @@ static void qemu_chr_finish_socket_connection(CharDriverState *chr, int fd)
}
}
-static void qemu_chr_socket_connected(int fd, void *opaque)
+static void qemu_chr_socket_connected(int fd, Error *err, void *opaque)
{
CharDriverState *chr = opaque;
TCPCharDriver *s = chr->opaque;
if (fd < 0) {
- check_report_connect_error(chr, "Unable to connect to socket %s",
- chr->label);
+ check_report_connect_error(chr, "Unable to connect to socket %s: %s",
+ chr->label, error_get_pretty(err));
return;
}
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 1eef590..e6a9644 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -234,6 +234,7 @@ static void wait_for_connect(void *opaque)
int val = 0, rc = 0;
socklen_t valsize = sizeof(val);
bool in_progress;
+ Error *err = NULL;
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
@@ -248,6 +249,7 @@ static void wait_for_connect(void *opaque)
/* connect error */
if (rc < 0) {
+ error_setg_errno(&err, errno, "Error connecting to socket");
closesocket(s->fd);
s->fd = rc;
}
@@ -257,9 +259,14 @@ static void wait_for_connect(void *opaque)
while (s->current_addr->ai_next != NULL && s->fd < 0) {
s->current_addr = s->current_addr->ai_next;
s->fd = inet_connect_addr(s->current_addr, &in_progress, s, NULL);
+ if (s->fd < 0) {
+ error_free(err);
+ err = NULL;
+ error_setg_errno(&err, errno, "Unable to start socket connect");
+ }
/* connect in progress */
if (in_progress) {
- return;
+ goto out;
}
}
@@ -267,9 +274,11 @@ static void wait_for_connect(void *opaque)
}
if (s->callback) {
- s->callback(s->fd, s->opaque);
+ s->callback(s->fd, err, s->opaque);
}
g_free(s);
+out:
+ error_free(err);
}
static int inet_connect_addr(struct addrinfo *addr, bool *in_progress,
@@ -401,7 +410,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp,
return sock;
} else {
if (callback) {
- callback(sock, opaque);
+ callback(sock, NULL, opaque);
}
}
g_free(connect_state);
@@ -769,7 +778,7 @@ int unix_connect_opts(QemuOpts *opts, Error **errp,
} else if (rc >= 0) {
/* non blocking socket immediate success, call callback */
if (callback != NULL) {
- callback(sock, opaque);
+ callback(sock, NULL, opaque);
}
}
@@ -919,7 +928,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
fd = monitor_get_fd(cur_mon, addr->fd->str, errp);
if (fd >= 0 && callback) {
qemu_set_nonblock(fd);
- callback(fd, opaque);
+ callback(fd, NULL, opaque);
}
break;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
` (2 preceding siblings ...)
2014-10-08 12:11 ` [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler minyard
@ 2014-10-08 12:56 ` Paolo Bonzini
3 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2014-10-08 12:56 UTC (permalink / raw)
To: minyard, qemu-devel
Il 08/10/2014 14:11, minyard@acm.org ha scritto:
> This version makes the error message reporting more sane and
> adds a error_vreport() to make that easier.
>
> It also cleans up the bool handling.
>
> This depends on the previos non-blocking socket changes, which
> should hopefully be in qemu soon.
Looks good, but let's unify the error message like this:
+static void check_report_connect_error(CharDriverState *chr,
+ Error *err)
+{
+ TCPCharDriver *s = chr->opaque;
+
+ if (!s->connect_err_reported) {
+ error_report("Unable to connect character device %s: %s",
+ chr->label, error_get_pretty(err));
+ s->connect_err_reported = true;
+ }
+ qemu_chr_socket_restart_timer(chr);
+}
+
This is an error on connecting the character device to the backend. The
error on the socket is already detailed after the colon, thanks to your
patch 2.
I'll send a pull request today or tomorrow.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport()
2014-10-08 12:11 ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() minyard
@ 2014-10-08 14:38 ` Eric Blake
0 siblings, 0 replies; 8+ messages in thread
From: Eric Blake @ 2014-10-08 14:38 UTC (permalink / raw)
To: minyard, qemu-devel; +Cc: pbonzini, Corey Minyard
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
On 10/08/2014 06:11 AM, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> Needed to nicely print socket error reports.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> ---
> include/qemu/error-report.h | 1 +
> util/qemu-error.c | 23 ++++++++++++++++++-----
> 2 files changed, 19 insertions(+), 5 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler
2014-10-08 12:11 ` [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler minyard
@ 2014-10-09 10:07 ` Paolo Bonzini
2014-10-09 17:48 ` Corey Minyard
0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2014-10-09 10:07 UTC (permalink / raw)
To: minyard, qemu-devel; +Cc: Corey Minyard
Il 08/10/2014 14:11, minyard@acm.org ha scritto:
> From: Corey Minyard <cminyard@mvista.com>
>
> An error value here would be quite handy and more consistent
> with the rest of the code.
>
> Corey Minyard <cminyard@mvista.com>
> ---
> include/qemu/sockets.h | 2 +-
> migration-tcp.c | 4 ++--
> migration-unix.c | 4 ++--
> qemu-char.c | 6 +++---
> util/qemu-sockets.c | 19 ++++++++++++++-----
> 5 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
> index fdbb196..f47dae6 100644
> --- a/include/qemu/sockets.h
> +++ b/include/qemu/sockets.h
> @@ -47,7 +47,7 @@ int recv_all(int fd, void *buf, int len1, bool single_read);
> /* callback function for nonblocking connect
> * valid fd on success, negative error code on failure
> */
> -typedef void NonBlockingConnectHandler(int fd, void *opaque);
> +typedef void NonBlockingConnectHandler(int fd, Error *errp, void *opaque);
>
> InetSocketAddress *inet_parse(const char *str, Error **errp);
> int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp);
> diff --git a/migration-tcp.c b/migration-tcp.c
> index 2e34517..91c9cf3 100644
> --- a/migration-tcp.c
> +++ b/migration-tcp.c
> @@ -33,12 +33,12 @@
> do { } while (0)
> #endif
>
> -static void tcp_wait_for_connect(int fd, void *opaque)
> +static void tcp_wait_for_connect(int fd, Error *err, void *opaque)
> {
> MigrationState *s = opaque;
>
> if (fd < 0) {
> - DPRINTF("migrate connect error\n");
> + DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
> s->file = NULL;
> migrate_fd_error(s);
> } else {
> diff --git a/migration-unix.c b/migration-unix.c
> index 0a5f8a1..1cdadfb 100644
> --- a/migration-unix.c
> +++ b/migration-unix.c
> @@ -33,12 +33,12 @@
> do { } while (0)
> #endif
>
> -static void unix_wait_for_connect(int fd, void *opaque)
> +static void unix_wait_for_connect(int fd, Error *err, void *opaque)
> {
> MigrationState *s = opaque;
>
> if (fd < 0) {
> - DPRINTF("migrate connect error\n");
> + DPRINTF("migrate connect error: %s\n", error_get_pretty(err));
> s->file = NULL;
> migrate_fd_error(s);
> } else {
> diff --git a/qemu-char.c b/qemu-char.c
> index 83ff458..8f3af06 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -3061,14 +3061,14 @@ static void qemu_chr_finish_socket_connection(CharDriverState *chr, int fd)
> }
> }
>
> -static void qemu_chr_socket_connected(int fd, void *opaque)
> +static void qemu_chr_socket_connected(int fd, Error *err, void *opaque)
> {
> CharDriverState *chr = opaque;
> TCPCharDriver *s = chr->opaque;
>
> if (fd < 0) {
> - check_report_connect_error(chr, "Unable to connect to socket %s",
> - chr->label);
> + check_report_connect_error(chr, "Unable to connect to socket %s: %s",
> + chr->label, error_get_pretty(err));
> return;
> }
>
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index 1eef590..e6a9644 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -234,6 +234,7 @@ static void wait_for_connect(void *opaque)
> int val = 0, rc = 0;
> socklen_t valsize = sizeof(val);
> bool in_progress;
> + Error *err = NULL;
>
> qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
>
> @@ -248,6 +249,7 @@ static void wait_for_connect(void *opaque)
>
> /* connect error */
> if (rc < 0) {
> + error_setg_errno(&err, errno, "Error connecting to socket");
> closesocket(s->fd);
> s->fd = rc;
> }
This is missing above this hunk:
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index e6a9644..a76bb3c 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -245,6 +245,7 @@ static void wait_for_connect(void *opaque)
/* update rc to contain error */
if (!rc && val) {
rc = -1;
+ errno = val;
}
/* connect error */
> @@ -257,9 +259,14 @@ static void wait_for_connect(void *opaque)
> while (s->current_addr->ai_next != NULL && s->fd < 0) {
> s->current_addr = s->current_addr->ai_next;
> s->fd = inet_connect_addr(s->current_addr, &in_progress, s, NULL);
> + if (s->fd < 0) {
> + error_free(err);
> + err = NULL;
> + error_setg_errno(&err, errno, "Unable to start socket connect");
> + }
> /* connect in progress */
> if (in_progress) {
> - return;
> + goto out;
> }
> }
>
> @@ -267,9 +274,11 @@ static void wait_for_connect(void *opaque)
> }
>
> if (s->callback) {
> - s->callback(s->fd, s->opaque);
> + s->callback(s->fd, err, s->opaque);
> }
> g_free(s);
> +out:
> + error_free(err);
> }
>
> static int inet_connect_addr(struct addrinfo *addr, bool *in_progress,
> @@ -401,7 +410,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp,
> return sock;
> } else {
> if (callback) {
> - callback(sock, opaque);
> + callback(sock, NULL, opaque);
> }
> }
> g_free(connect_state);
> @@ -769,7 +778,7 @@ int unix_connect_opts(QemuOpts *opts, Error **errp,
> } else if (rc >= 0) {
> /* non blocking socket immediate success, call callback */
> if (callback != NULL) {
> - callback(sock, opaque);
> + callback(sock, NULL, opaque);
> }
> }
>
> @@ -919,7 +928,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
> fd = monitor_get_fd(cur_mon, addr->fd->str, errp);
> if (fd >= 0 && callback) {
> qemu_set_nonblock(fd);
> - callback(fd, opaque);
> + callback(fd, NULL, opaque);
> }
> break;
>
>
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler
2014-10-09 10:07 ` Paolo Bonzini
@ 2014-10-09 17:48 ` Corey Minyard
0 siblings, 0 replies; 8+ messages in thread
From: Corey Minyard @ 2014-10-09 17:48 UTC (permalink / raw)
To: Paolo Bonzini, minyard, qemu-devel
On 10/09/2014 05:07 AM, Paolo Bonzini wrote:
>> + error_setg_errno(&err, errno, "Error connecting to socket");
>> > closesocket(s->fd);
>> > s->fd = rc;
>> > }
> This is missing above this hunk:
>
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index e6a9644..a76bb3c 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -245,6 +245,7 @@ static void wait_for_connect(void *opaque)
> /* update rc to contain error */
> if (!rc && val) {
> rc = -1;
> + errno = val;
> }
>
> /* connect error */
>
Yes, it is. I see that everything went in, thanks for your work on this.
Now on to IPMI...
-corey
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-10-09 17:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() minyard
2014-10-08 14:38 ` Eric Blake
2014-10-08 12:11 ` [Qemu-devel] [PATCH 2/3] qemu-char: Fix reconnect socket error reporting minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler minyard
2014-10-09 10:07 ` Paolo Bonzini
2014-10-09 17:48 ` Corey Minyard
2014-10-08 12:56 ` [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting Paolo Bonzini
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).