[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/48] migration: don't rely on any QERR_SOCKET_*
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 15/48] migration: don't rely on any QERR_SOCKET_* |
Date: |
Mon, 13 Aug 2012 16:48:36 -0300 |
Use the in_progress argument for QERR_SOCKET_CONNECT_IN_PROGRESS. The
other errors are handled the same by checking if the error is set and
then calling migrate_fd_error() if it's.
It's also necessary to change inet_connect_opts() not to set
QERR_SOCKET_CONNECT_IN_PROGRESS. This error is only used by
tcp_start_outgoing_migration() and not changing it along with the
usage of in_progress would break migration.
Furthermore this commit fixes a bug. Today, there's a spurious error
report when migration succeeds:
(qemu) migrate tcp:0:4444
migrate: Connection can not be completed immediately
(qemu)
After this commit no spurious error is reported anymore.
Signed-off-by: Luiz Capitulino <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
migration-tcp.c | 22 +++++++++-------------
qemu-sockets.c | 2 --
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/migration-tcp.c b/migration-tcp.c
index 18944a4..ac891c3 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -82,27 +82,23 @@ static void tcp_wait_for_connect(void *opaque)
int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
Error **errp)
{
+ bool in_progress;
+
s->get_error = socket_errno;
s->write = socket_write;
s->close = tcp_close;
- s->fd = inet_connect(host_port, false, NULL, errp);
+ s->fd = inet_connect(host_port, false, &in_progress, errp);
+ if (error_is_set(errp)) {
+ migrate_fd_error(s);
+ return -1;
+ }
- if (!error_is_set(errp)) {
- migrate_fd_connect(s);
- } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {
+ if (in_progress) {
DPRINTF("connect in progress\n");
qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);
- } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {
- DPRINTF("connect failed\n");
- return -1;
- } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {
- DPRINTF("connect failed\n");
- migrate_fd_error(s);
- return -1;
} else {
- DPRINTF("unknown error\n");
- return -1;
+ migrate_fd_connect(s);
}
return 0;
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 9cb47d4..361d890 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -284,8 +284,6 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress,
Error **errp)
if (in_progress) {
*in_progress = true;
}
-
- error_set(errp, QERR_SOCKET_CONNECT_IN_PROGRESS);
} else if (rc < 0) {
if (NULL == e->ai_next)
fprintf(stderr, "%s: connect(%s,%s,%s,%s): %s\n", __FUNCTION__,
--
1.7.11.2.249.g31c7954.dirty
- [Qemu-devel] [PATCH 06/48] qerror: avoid passing qerr pointer, (continued)
- [Qemu-devel] [PATCH 06/48] qerror: avoid passing qerr pointer, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 08/48] qerror: qerror_format(): return an allocated string, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 07/48] qerror: QError: drop file, linenr, func, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 10/48] error: don't delay error message construction, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 11/48] qmp: query-block: add 'encryption_key_missing' field, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 09/48] qerror: don't delay error message construction, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 12/48] hmp: hmp_cont(): don't rely on QERR_DEVICE_ENCRYPTED, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 14/48] net: inet_connect(), inet_connect_opts(): add in_progress argument, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 13/48] hmp_change(): don't access DeviceEncrypted's data, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 16/48] qerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 15/48] migration: don't rely on any QERR_SOCKET_*,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 17/48] block: block_int: include qerror.h, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 20/48] qapi: generate correct enum names for camel case enums, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 19/48] qapi: qapi-types.h: don't include qapi/qapi-types-core.h, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 18/48] hmp: hmp.h: include qdict.h, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 22/48] qapi-schema: add ErrorClass enum, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 28/48] error: drop unused functions, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 33/48] qerror: drop qerror_table and qerror_format(), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 34/48] error, qerror: drop QDict member, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 35/48] docs: writing-qmp-commands.txt: update error section, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 36/48] scripts: qapi-commands.py: qmp-commands.h: include qdict.h, Luiz Capitulino, 2012/08/13