aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--migration/block.c12
-rw-r--r--migration/migration.c5
-rw-r--r--migration/ram.c8
-rw-r--r--tests/migration-test.c17
4 files changed, 31 insertions, 11 deletions
diff --git a/migration/block.c b/migration/block.c
index 1f03946797..41b95d1dd8 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -36,7 +36,7 @@
#define MAX_IS_ALLOCATED_SEARCH (65536 * BDRV_SECTOR_SIZE)
-#define MAX_INFLIGHT_IO 512
+#define MAX_IO_BUFFERS 512
//#define DEBUG_BLK_MIGRATION
@@ -331,11 +331,10 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
*/
qemu_mutex_lock_iothread();
aio_context_acquire(blk_get_aio_context(bmds->blk));
- blk->aiocb = blk_aio_preadv(bb, cur_sector * BDRV_SECTOR_SIZE, &blk->qiov,
- 0, blk_mig_read_cb, blk);
-
bdrv_reset_dirty_bitmap(bmds->dirty_bitmap, cur_sector * BDRV_SECTOR_SIZE,
nr_sectors * BDRV_SECTOR_SIZE);
+ blk->aiocb = blk_aio_preadv(bb, cur_sector * BDRV_SECTOR_SIZE, &blk->qiov,
+ 0, blk_mig_read_cb, blk);
aio_context_release(blk_get_aio_context(bmds->blk));
qemu_mutex_unlock_iothread();
@@ -776,9 +775,8 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
while ((block_mig_state.submitted +
block_mig_state.read_done) * BLOCK_SIZE <
qemu_file_get_rate_limit(f) &&
- (block_mig_state.submitted +
- block_mig_state.read_done) <
- MAX_INFLIGHT_IO) {
+ (block_mig_state.submitted + block_mig_state.read_done) <
+ MAX_IO_BUFFERS) {
blk_mig_unlock();
if (block_mig_state.bulk_completed == 0) {
/* first finish the bulk phase */
diff --git a/migration/migration.c b/migration/migration.c
index e345d0cc7e..6a4780ef6f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -747,13 +747,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
{
MigrationState *s = migrate_get_current();
MigrationCapabilityStatusList *cap;
+ bool cap_list[MIGRATION_CAPABILITY__MAX];
if (migration_is_setup_or_active(s->state)) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
return;
}
- if (!migrate_caps_check(s->enabled_capabilities, params, errp)) {
+ memcpy(cap_list, s->enabled_capabilities, sizeof(cap_list));
+ if (!migrate_caps_check(cap_list, params, errp)) {
return;
}
@@ -2541,6 +2543,7 @@ static void migration_instance_finalize(Object *obj)
g_free(params->tls_hostname);
g_free(params->tls_creds);
qemu_sem_destroy(&ms->pause_sem);
+ error_free(ms->error);
}
static void migration_instance_init(Object *obj)
diff --git a/migration/ram.c b/migration/ram.c
index 3b6c077964..7266351fd0 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2258,6 +2258,13 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
int64_t t0;
int done = 0;
+ if (blk_mig_bulk_active()) {
+ /* Avoid transferring ram during bulk phase of block migration as
+ * the bulk phase will usually take a long time and transferring
+ * ram updates during that time is pointless. */
+ goto out;
+ }
+
rcu_read_lock();
if (ram_list.version != rs->last_version) {
ram_state_reset(rs);
@@ -2304,6 +2311,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
*/
ram_control_after_iterate(f, RAM_CONTROL_ROUND);
+out:
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
ram_counters.transferred += 8;
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 74f9361bdd..422bf1afdf 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -382,7 +382,7 @@ static void migrate_start_postcopy(QTestState *who)
}
static void test_migrate_start(QTestState **from, QTestState **to,
- const char *uri)
+ const char *uri, bool hide_stderr)
{
gchar *cmd_src, *cmd_dst;
char *bootpath = g_strdup_printf("%s/bootsect", tmpfs);
@@ -427,6 +427,17 @@ static void test_migrate_start(QTestState **from, QTestState **to,
g_free(bootpath);
+ if (hide_stderr) {
+ gchar *tmp;
+ tmp = g_strdup_printf("%s 2>/dev/null", cmd_src);
+ g_free(cmd_src);
+ cmd_src = tmp;
+
+ tmp = g_strdup_printf("%s 2>/dev/null", cmd_dst);
+ g_free(cmd_dst);
+ cmd_dst = tmp;
+ }
+
*from = qtest_start(cmd_src);
g_free(cmd_src);
@@ -518,7 +529,7 @@ static void test_migrate(void)
char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
QTestState *from, *to;
- test_migrate_start(&from, &to, uri);
+ test_migrate_start(&from, &to, uri, false);
migrate_set_capability(from, "postcopy-ram", "true");
migrate_set_capability(to, "postcopy-ram", "true");
@@ -560,7 +571,7 @@ static void test_baddest(void)
const char *status;
bool failed;
- test_migrate_start(&from, &to, "tcp:0:0");
+ test_migrate_start(&from, &to, "tcp:0:0", true);
migrate(from, "tcp:0:0");
do {
rsp = wait_command(from, "{ 'execute': 'query-migrate' }");