From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Juan Quintela <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Peter Xu <peterx@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Yury Kotov <yury-kotov@yandex-team.ru>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 3/5] migration: Fix fd protocol for incoming defer
Date: Wed, 5 Jun 2019 13:53:16 +0200 [thread overview]
Message-ID: <20190605115318.9972-4-quintela@redhat.com> (raw)
In-Reply-To: <20190605115318.9972-1-quintela@redhat.com>
From: Yury Kotov <yury-kotov@yandex-team.ru>
Currently, incoming migration through fd supports only command-line case:
E.g.
fork();
fd = open();
exec("qemu ... -incoming fd:%d", fd);
It's possible to use add-fd commands to pass fd for migration, but it's
invalid case. add-fd works with fdset but not with particular fds.
To work with getfd in incoming defer it's enough to use monitor_fd_param
instead of strtol. monitor_fd_param supports both cases:
* fd:123
* fd:fd_name (added by getfd).
And also the use of monitor_fd_param improves error messages.
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/fd.c | 8 +++++---
migration/fd.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/migration/fd.c b/migration/fd.c
index a7c13df4ad..0a29ecdebf 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -52,12 +52,14 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
return G_SOURCE_REMOVE;
}
-void fd_start_incoming_migration(const char *infd, Error **errp)
+void fd_start_incoming_migration(const char *fdname, Error **errp)
{
QIOChannel *ioc;
- int fd;
+ int fd = monitor_fd_param(cur_mon, fdname, errp);
+ if (fd == -1) {
+ return;
+ }
- fd = strtol(infd, NULL, 0);
trace_migration_fd_incoming(fd);
ioc = qio_channel_new_fd(fd, errp);
diff --git a/migration/fd.h b/migration/fd.h
index a14a63ce2e..b901bc014e 100644
--- a/migration/fd.h
+++ b/migration/fd.h
@@ -16,7 +16,7 @@
#ifndef QEMU_MIGRATION_FD_H
#define QEMU_MIGRATION_FD_H
-void fd_start_incoming_migration(const char *path, Error **errp);
+void fd_start_incoming_migration(const char *fdname, Error **errp);
void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
Error **errp);
--
2.21.0
next prev parent reply other threads:[~2019-06-05 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 11:53 [Qemu-devel] [PULL 0/5] Migration patches Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 1/5] migration/ram.c: MultiFDSendParams.sem_sync is not really used Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 2/5] migration/ram.c: multifd_send_state->count " Juan Quintela
2019-06-05 11:53 ` Juan Quintela [this message]
2019-06-05 11:53 ` [Qemu-devel] [PULL 4/5] migration-test: Add a test for fd protocol Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 5/5] migratioin/ram: leave RAMBlock->bmap blank on allocating Juan Quintela
2019-06-05 12:26 ` Philippe Mathieu-Daudé
2019-06-05 13:36 ` Wei Yang
2019-06-05 13:37 ` Wei Yang
2019-06-06 10:32 ` [Qemu-devel] [PULL 0/5] Migration patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190605115318.9972-4-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=yury-kotov@yandex-team.ru \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).