提交 819fd469 编写于 作者: P Peter Maydell

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

Migration pull 2018-03-09

# gpg: Signature made Fri 09 Mar 2018 17:52:46 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-20180309a:
  tests: Silence migration-test 'bad' test
  migration: fix applying wrong capabilities
  migration/block: rename MAX_INFLIGHT_IO to MAX_IO_BUFFERS
  migration/block: reset dirty bitmap before read in bulk phase
  migration: do not transfer ram during bulk storage migration
  migration: fix minor finalize leak
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
......@@ -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 */
......
......@@ -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)
......
......@@ -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;
......
......@@ -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' }");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册