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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJatWDkAAoJEAUWMx68W/3nKScP/0L4GZGbY3uYKpZNDcai1oXk
 +AyNF9bBJ2JJH0f3h5DGxi96YoACJPCVKSytRluNcJ0aM3P8d6OYlo32lhT/LwAA
 U4ZSusJRc2klKB+8cppIAzU9wkZpEZBxbCLfB4H8Bl4f8uzwwj5fQ4oSHKKoKst7
 m4z84+jlbcA2Y6j1MN0SkbwY39ToPfPl+JG57N7fPcjpXjorzv9aUFo6I+shy+lA
 S+37SyLvWBR/9SLqs2BGF+mw1EFYlNsgBZTfXZkBxc56zT/goJ4gJjkqlMCGaPvy
 ztzE9opDXqFz/ohNDlRpP705b9NAp/gcDeQQhwpZ02jMWFlQpF2zyjBNNqs15o9Q
 C4hMBsypttfuPC3gCx2UiWDK8jzZzNdGryrY2Vtk+jZM84gsNfdXgolXS5u7/3rA
 CIwdqb9hBrinGwn3BIkhcqm7FqydGWjOJSV15l6QlyuXoOoQ1KDUaDl3vxxDSquW
 /NXLL95LadbQXBR9xnH8Y+Q2vxESUeqlYbmc65grdT2mOsomGKXTnia3gXFZXNt/
 Jm2OQNxxxmt2XY8gl3rZMqGCqZIJ2LlUz9K/18pUhVN2MyX0Pu/iAVbmpLgENmbE
 lIPh+VfExARBJ1eqhY3x9wRaYrm3sg1pkUik97jrSkiji0RPSCZB76T9sKpROEZ6
 hBeh5O5r+M6yHPKriCY5
 =esvT
 -----END PGP SIGNATURE-----

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: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-03-24 19:26:11 +00:00
commit 77fea92dbb
4 changed files with 21 additions and 35 deletions

View File

@ -37,6 +37,7 @@
#define MAX_IS_ALLOCATED_SEARCH (65536 * BDRV_SECTOR_SIZE)
#define MAX_IO_BUFFERS 512
#define MAX_PARALLEL_IO 16
//#define DEBUG_BLK_MIGRATION
@ -772,9 +773,9 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
/* control the rate of transfer */
blk_mig_lock();
while ((block_mig_state.submitted +
block_mig_state.read_done) * BLOCK_SIZE <
while (block_mig_state.read_done * BLOCK_SIZE <
qemu_file_get_rate_limit(f) &&
block_mig_state.submitted < MAX_PARALLEL_IO &&
(block_mig_state.submitted + block_mig_state.read_done) <
MAX_IO_BUFFERS) {
blk_mig_unlock();

View File

@ -1428,6 +1428,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
"a valid migration protocol");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
MIGRATION_STATUS_FAILED);
block_cleanup_parameters(s);
return;
}

View File

@ -253,7 +253,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
if (f->hooks && f->hooks->save_page) {
int ret = f->hooks->save_page(f, f->opaque, block_offset,
offset, size, bytes_sent);
f->bytes_xfer += size;
if (ret != RAM_SAVE_CONTROL_DELAYED) {
if (bytes_sent && *bytes_sent > 0) {
qemu_update_position(f, *bytes_sent);

View File

@ -24,6 +24,7 @@
#include "migration.h"
#include "qemu-file.h"
#include "io/channel-socket.h"
#include "io/net-listener.h"
#include "trace.h"
@ -129,34 +130,20 @@ void unix_start_outgoing_migration(MigrationState *s,
}
static gboolean socket_accept_incoming_migration(QIOChannel *ioc,
GIOCondition condition,
gpointer opaque)
static void socket_accept_incoming_migration(QIONetListener *listener,
QIOChannelSocket *cioc,
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();
qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming");
migration_channel_process_incoming(QIO_CHANNEL(sioc));
object_unref(OBJECT(sioc));
qio_channel_set_name(QIO_CHANNEL(cioc), "migration-socket-incoming");
migration_channel_process_incoming(QIO_CHANNEL(cioc));
out:
if (migration_has_all_channels()) {
/* Close listening socket as its no longer needed */
qio_channel_close(ioc, NULL);
return G_SOURCE_REMOVE;
} else {
return G_SOURCE_CONTINUE;
qio_net_listener_disconnect(listener);
object_unref(OBJECT(listener));
}
}
@ -164,21 +151,18 @@ out:
static void socket_start_incoming_migration(SocketAddress *saddr,
Error **errp)
{
QIOChannelSocket *listen_ioc = qio_channel_socket_new();
QIONetListener *listener = qio_net_listener_new();
qio_channel_set_name(QIO_CHANNEL(listen_ioc),
"migration-socket-listener");
qio_net_listener_set_name(listener, "migration-socket-listener");
if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
object_unref(OBJECT(listen_ioc));
if (qio_net_listener_open_sync(listener, saddr, errp) < 0) {
object_unref(OBJECT(listener));
return;
}
qio_channel_add_watch(QIO_CHANNEL(listen_ioc),
G_IO_IN,
socket_accept_incoming_migration,
listen_ioc,
(GDestroyNotify)object_unref);
qio_net_listener_set_client_func(listener,
socket_accept_incoming_migration,
NULL, NULL);
}
void tcp_start_incoming_migration(const char *host_port, Error **errp)