提交 77fea92d 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180323a' into staging

Migration fixes for 2.12

All small fixes.  Dan's is a missing piece
of a cleanup that finally completes something,
and between Paolo, Dan and myself we recon it's
still on the edge of being a bug fix.

# gpg: Signature made Fri 23 Mar 2018 20:17:40 GMT
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20180323a:
  migration: Fix block migration flag case
  migration/block: compare only read blocks against the rate limiter
  migration/block: limit the number of parallel I/O requests
  migration: Fix rate limiting issue on RDMA migration
  migration: convert socket server to QIONetListener
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define MAX_IS_ALLOCATED_SEARCH (65536 * BDRV_SECTOR_SIZE) #define MAX_IS_ALLOCATED_SEARCH (65536 * BDRV_SECTOR_SIZE)
#define MAX_IO_BUFFERS 512 #define MAX_IO_BUFFERS 512
#define MAX_PARALLEL_IO 16
//#define DEBUG_BLK_MIGRATION //#define DEBUG_BLK_MIGRATION
...@@ -772,9 +773,9 @@ static int block_save_iterate(QEMUFile *f, void *opaque) ...@@ -772,9 +773,9 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
/* control the rate of transfer */ /* control the rate of transfer */
blk_mig_lock(); blk_mig_lock();
while ((block_mig_state.submitted + while (block_mig_state.read_done * BLOCK_SIZE <
block_mig_state.read_done) * BLOCK_SIZE <
qemu_file_get_rate_limit(f) && qemu_file_get_rate_limit(f) &&
block_mig_state.submitted < MAX_PARALLEL_IO &&
(block_mig_state.submitted + block_mig_state.read_done) < (block_mig_state.submitted + block_mig_state.read_done) <
MAX_IO_BUFFERS) { MAX_IO_BUFFERS) {
blk_mig_unlock(); blk_mig_unlock();
......
...@@ -1428,6 +1428,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, ...@@ -1428,6 +1428,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
"a valid migration protocol"); "a valid migration protocol");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
MIGRATION_STATUS_FAILED); MIGRATION_STATUS_FAILED);
block_cleanup_parameters(s);
return; return;
} }
......
...@@ -253,7 +253,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ...@@ -253,7 +253,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
if (f->hooks && f->hooks->save_page) { if (f->hooks && f->hooks->save_page) {
int ret = f->hooks->save_page(f, f->opaque, block_offset, int ret = f->hooks->save_page(f, f->opaque, block_offset,
offset, size, bytes_sent); offset, size, bytes_sent);
f->bytes_xfer += size;
if (ret != RAM_SAVE_CONTROL_DELAYED) { if (ret != RAM_SAVE_CONTROL_DELAYED) {
if (bytes_sent && *bytes_sent > 0) { if (bytes_sent && *bytes_sent > 0) {
qemu_update_position(f, *bytes_sent); qemu_update_position(f, *bytes_sent);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "migration.h" #include "migration.h"
#include "qemu-file.h" #include "qemu-file.h"
#include "io/channel-socket.h" #include "io/channel-socket.h"
#include "io/net-listener.h"
#include "trace.h" #include "trace.h"
...@@ -129,34 +130,20 @@ void unix_start_outgoing_migration(MigrationState *s, ...@@ -129,34 +130,20 @@ void unix_start_outgoing_migration(MigrationState *s,
} }
static gboolean socket_accept_incoming_migration(QIOChannel *ioc, static void socket_accept_incoming_migration(QIONetListener *listener,
GIOCondition condition, QIOChannelSocket *cioc,
gpointer opaque) gpointer opaque)
{ {
QIOChannelSocket *sioc;
Error *err = NULL;
sioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc),
&err);
if (!sioc) {
error_report("could not accept migration connection (%s)",
error_get_pretty(err));
goto out;
}
trace_migration_socket_incoming_accepted(); trace_migration_socket_incoming_accepted();
qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming"); qio_channel_set_name(QIO_CHANNEL(cioc), "migration-socket-incoming");
migration_channel_process_incoming(QIO_CHANNEL(sioc)); migration_channel_process_incoming(QIO_CHANNEL(cioc));
object_unref(OBJECT(sioc));
out:
if (migration_has_all_channels()) { if (migration_has_all_channels()) {
/* Close listening socket as its no longer needed */ /* Close listening socket as its no longer needed */
qio_channel_close(ioc, NULL); qio_net_listener_disconnect(listener);
return G_SOURCE_REMOVE;
} else { object_unref(OBJECT(listener));
return G_SOURCE_CONTINUE;
} }
} }
...@@ -164,21 +151,18 @@ out: ...@@ -164,21 +151,18 @@ out:
static void socket_start_incoming_migration(SocketAddress *saddr, static void socket_start_incoming_migration(SocketAddress *saddr,
Error **errp) Error **errp)
{ {
QIOChannelSocket *listen_ioc = qio_channel_socket_new(); QIONetListener *listener = qio_net_listener_new();
qio_channel_set_name(QIO_CHANNEL(listen_ioc), qio_net_listener_set_name(listener, "migration-socket-listener");
"migration-socket-listener");
if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { if (qio_net_listener_open_sync(listener, saddr, errp) < 0) {
object_unref(OBJECT(listen_ioc)); object_unref(OBJECT(listener));
return; return;
} }
qio_channel_add_watch(QIO_CHANNEL(listen_ioc), qio_net_listener_set_client_func(listener,
G_IO_IN,
socket_accept_incoming_migration, socket_accept_incoming_migration,
listen_ioc, NULL, NULL);
(GDestroyNotify)object_unref);
} }
void tcp_start_incoming_migration(const char *host_port, Error **errp) void tcp_start_incoming_migration(const char *host_port, Error **errp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册