Lines Matching +full:wakeup +full:- +full:source

2  * Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates
3 * based on the vhost-user-test.c that is:
7 * See the COPYING file in the top-level directory.
18 #include "migration/migration-qmp.h"
19 #include "migration/migration-util.h"
20 #include "ppc-util.h"
188 fprintf(stderr, "and in another %d pages", bad - 10); in check_guests_ram()
204 if (args->oob) { in migrate_start_get_qmp_capabilities()
216 * are from qapi-types-migration.h. in migrate_start_set_capabilities()
219 if (!args->caps[i]) { in migrate_start_set_capabilities()
237 if (!args->defer_target_connect) { in migrate_start_set_capabilities()
246 if (args->caps[MIGRATION_CAPABILITY_MULTIFD]) { in migrate_start_set_capabilities()
247 migrate_set_parameter_int(from, "multifd-channels", in migrate_start_set_capabilities()
249 migrate_set_parameter_int(to, "multifd-channels", in migrate_start_set_capabilities()
259 /* options for source and target */ in migrate_start()
276 if (args->use_shmem) { in migrate_start()
279 return -1; in migrate_start()
285 bootpath = bootfile_create(arch, tmpfs, args->suspend_me); in migrate_start()
286 src_state.suspend_me = args->suspend_me; in migrate_start()
297 "-drive if=none,id=d0,file=%s,format=raw " in migrate_start()
298 "-device ide-hd,drive=d0,secs=1,cyls=1,heads=1", bootpath); in migrate_start()
303 machine_alias = "s390-ccw-virtio"; in migrate_start()
304 arch_opts = g_strdup_printf("-bios %s", bootpath); in migrate_start()
314 "-nodefaults -machine " PSERIES_DEFAULT_CAPABILITIES " " in migrate_start()
315 "-bios %s", bootpath); in migrate_start()
319 machine_opts = "gic-version=3"; in migrate_start()
320 arch_opts = g_strdup_printf("-cpu max -kernel %s", bootpath); in migrate_start()
327 if (!getenv("QTEST_LOG") && args->hide_stderr) { in migrate_start()
342 if (args->use_shmem) { in migrate_start()
343 shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid()); in migrate_start()
345 "-object memory-backend-file,id=mem0,size=%s" in migrate_start()
346 ",mem-path=%s,share=on -numa node,memdev=mem0", in migrate_start()
350 if (args->memory_backend) { in migrate_start()
351 memory_backend = g_strdup_printf(args->memory_backend, memory_size); in migrate_start()
353 memory_backend = g_strdup_printf("-m %s ", memory_size); in migrate_start()
356 if (args->use_dirty_ring) { in migrate_start()
357 kvm_opts = ",dirty-ring-size=4096"; in migrate_start()
363 return -1; in migrate_start()
371 cmd_source = g_strdup_printf("-accel kvm%s -accel tcg " in migrate_start()
372 "-machine %s,%s " in migrate_start()
373 "-name source,debug-threads=on " in migrate_start()
375 "-serial file:%s/src_serial " in migrate_start()
382 args->opts_source ? args->opts_source : "", in migrate_start()
384 if (!args->only_target) { in migrate_start()
396 events = args->defer_target_connect ? "-global migration.x-events=on" : ""; in migrate_start()
398 cmd_target = g_strdup_printf("-accel kvm%s -accel tcg " in migrate_start()
399 "-machine %s,%s " in migrate_start()
400 "-name target,debug-threads=on " in migrate_start()
402 "-serial file:%s/dest_serial " in migrate_start()
403 "-incoming %s " in migrate_start()
411 args->opts_target ? args->opts_target : "", in migrate_start()
414 !args->defer_target_connect); in migrate_start()
423 if (args->use_shmem) { in migrate_start()
474 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] = true; in migrate_postcopy_prepare()
475 args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] = true; in migrate_postcopy_prepare()
477 if (migrate_start(&from, &to, "defer", &args->start)) { in migrate_postcopy_prepare()
478 return -1; in migrate_postcopy_prepare()
481 if (args->start_hook) { in migrate_postcopy_prepare()
482 args->postcopy_data = args->start_hook(from, to); in migrate_postcopy_prepare()
487 qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," in migrate_postcopy_prepare()
489 " 'channels': [ { 'channel-type': 'main'," in migrate_postcopy_prepare()
495 /* Wait for the first serial output from the source */ in migrate_postcopy_prepare()
516 if (args->start.suspend_me) { in migrate_postcopy_complete()
517 /* wakeup succeeds only if guest is suspended */ in migrate_postcopy_complete()
524 if (env->uffd_feature_thread_id) { in migrate_postcopy_complete()
528 if (args->end_hook) { in migrate_postcopy_complete()
529 args->end_hook(from, to, args->postcopy_data); in migrate_postcopy_complete()
530 args->postcopy_data = NULL; in migrate_postcopy_complete()
579 " 'arguments': { 'fdname': 'fd-mig' }}"); in postcopy_recover_fail()
582 " 'arguments': { 'fdname': 'fd-mig' }}"); in postcopy_recover_fail()
591 * rely on an pre-existing G_IO_IN event, so it will always trigger the in postcopy_recover_fail()
607 migrate_recover(to, "fd:fd-mig"); in postcopy_recover_fail()
608 migrate_qmp(from, to, "fd:fd-mig", NULL, "{'resume': true}"); in postcopy_recover_fail()
611 * Source QEMU has an extra RECOVER_SETUP phase, dest doesn't have it. in postcopy_recover_fail()
614 migration_event_wait(from, "postcopy-recover-setup"); in postcopy_recover_fail()
623 migration_event_wait(from, "postcopy-paused"); in postcopy_recover_fail()
628 * kicking them out using migrate-pause. in postcopy_recover_fail()
633 migration_event_wait(from, "postcopy-recover"); in postcopy_recover_fail()
634 wait_for_postcopy_status(from, "postcopy-recover"); in postcopy_recover_fail()
644 wait_for_postcopy_status(from, "postcopy-paused"); in postcopy_recover_fail()
645 wait_for_postcopy_status(to, "postcopy-recover"); in postcopy_recover_fail()
654 wait_for_postcopy_status(to, "postcopy-paused"); in postcopy_recover_fail()
672 * Always enable OOB QMP capability for recovery tests, migrate-recover is in test_postcopy_recovery_common()
673 * executed out-of-band in test_postcopy_recovery_common()
675 args->start.oob = true; in test_postcopy_recovery_common()
678 args->start.hide_stderr = true; in test_postcopy_recovery_common()
685 migrate_set_parameter_int(from, "max-postcopy-bandwidth", 4096); in test_postcopy_recovery_common()
692 * migrate-pause command during a postcopy in test_postcopy_recovery_common()
694 wait_for_migration_status(from, "postcopy-active", NULL); in test_postcopy_recovery_common()
703 * Wait for destination side to reach postcopy-paused state. The in test_postcopy_recovery_common()
704 * migrate-recover command can only succeed if destination machine in test_postcopy_recovery_common()
707 wait_for_postcopy_status(to, "postcopy-paused"); in test_postcopy_recovery_common()
708 wait_for_postcopy_status(from, "postcopy-paused"); in test_postcopy_recovery_common()
710 if (args->postcopy_recovery_fail_stage) { in test_postcopy_recovery_common()
715 postcopy_recover_fail(from, to, args->postcopy_recovery_fail_stage); in test_postcopy_recovery_common()
724 uri = g_strdup_printf("unix:%s/migsocket-recover", tmpfs); in test_postcopy_recovery_common()
734 migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); in test_postcopy_recovery_common()
746 g_assert(!args->cpr_channel || args->connect_channels); in test_precopy_common()
748 if (migrate_start(&from, &to, args->listen_uri, &args->start)) { in test_precopy_common()
752 if (args->start_hook) { in test_precopy_common()
753 data_hook = args->start_hook(from, to); in test_precopy_common()
756 /* Wait for the first serial output from the source */ in test_precopy_common()
757 if (args->result == MIG_TEST_SUCCEED) { in test_precopy_common()
762 if (args->live) { in test_precopy_common()
767 * Testing non-live migration, we allow it to run at in test_precopy_common()
772 if (args->result == MIG_TEST_SUCCEED) { in test_precopy_common()
781 * migrate-incoming channels. in test_precopy_common()
783 if (args->connect_channels) { in test_precopy_common()
784 if (args->start.defer_target_connect && in test_precopy_common()
785 !strcmp(args->listen_uri, "defer")) { in test_precopy_common()
786 in_channels = qobject_from_json(args->connect_channels, in test_precopy_common()
789 out_channels = qobject_from_json(args->connect_channels, &error_abort); in test_precopy_common()
791 if (args->cpr_channel) { in test_precopy_common()
793 QObject *obj = migrate_str_to_channel(args->cpr_channel); in test_precopy_common()
799 if (args->result == MIG_TEST_QMP_ERROR) { in test_precopy_common()
800 migrate_qmp_fail(from, args->connect_uri, out_channels, "{}"); in test_precopy_common()
804 migrate_qmp(from, to, args->connect_uri, out_channels, "{}"); in test_precopy_common()
806 if (args->start.defer_target_connect) { in test_precopy_common()
809 if (!strcmp(args->listen_uri, "defer")) { in test_precopy_common()
810 migrate_incoming_qmp(to, args->connect_uri, in_channels, "{}"); in test_precopy_common()
814 if (args->result != MIG_TEST_SUCCEED) { in test_precopy_common()
815 bool allow_active = args->result == MIG_TEST_FAIL; in test_precopy_common()
818 if (args->result == MIG_TEST_FAIL_DEST_QUIT_ERR) { in test_precopy_common()
822 if (args->live) { in test_precopy_common()
828 while (args->iterations > 1) { in test_precopy_common()
830 args->iterations--; in test_precopy_common()
858 if (args->start.suspend_me) { in test_precopy_common()
859 /* wakeup succeeds only if guest is suspended */ in test_precopy_common()
867 if (args->end_hook) { in test_precopy_common()
868 args->end_hook(from, to, data_hook); in test_precopy_common()
871 migrate_end(from, to, args->result == MIG_TEST_SUCCEED); in test_precopy_common()
912 if (migrate_start(&from, &to, args->listen_uri, &args->start)) { in test_file_common()
917 * File migration is never live. We can keep the source VM running in test_file_common()
921 g_assert_false(args->live); in test_file_common()
923 if (g_strrstr(args->connect_uri, "offset=")) { in test_file_common()
933 if (args->start_hook) { in test_file_common()
934 data_hook = args->start_hook(from, to); in test_file_common()
945 if (args->result == MIG_TEST_QMP_ERROR) { in test_file_common()
946 migrate_qmp_fail(from, args->connect_uri, NULL, "{}"); in test_file_common()
950 migrate_qmp(from, to, args->connect_uri, NULL, "{}"); in test_file_common()
954 * We need to wait for the source to finish before starting the in test_file_common()
957 migrate_incoming_qmp(to, args->connect_uri, NULL, "{}"); in test_file_common()
972 if (args->end_hook) { in test_file_common()
973 args->end_hook(from, to, data_hook); in test_file_common()
976 migrate_end(from, to, args->result == MIG_TEST_SUCCEED); in test_file_common()
983 migrate_set_parameter_str(from, "multifd-compression", method); in migrate_hook_start_precopy_tcp_multifd_common()
984 migrate_set_parameter_str(to, "multifd-compression", method); in migrate_hook_start_precopy_tcp_multifd_common()
1007 env->qemu_src = getenv(QEMU_ENV_SRC); in migration_get_env()
1008 env->qemu_dst = getenv(QEMU_ENV_DST); in migration_get_env()
1015 if (env->qemu_src && env->qemu_dst) { in migration_get_env()
1021 env->has_kvm = qtest_has_accel("kvm"); in migration_get_env()
1022 env->has_tcg = qtest_has_accel("tcg"); in migration_get_env()
1024 if (!env->has_tcg && !env->has_kvm) { in migration_get_env()
1029 env->has_dirty_ring = kvm_dirty_ring_supported(); in migration_get_env()
1030 env->has_uffd = ufd_version_check(&env->uffd_feature_thread_id); in migration_get_env()
1031 env->arch = qtest_get_arch(); in migration_get_env()
1032 env->is_x86 = !strcmp(env->arch, "i386") || !strcmp(env->arch, "x86_64"); in migration_get_env()
1034 env->tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); in migration_get_env()
1035 if (!env->tmpfs) { in migration_get_env()
1037 g_get_tmp_dir(), err->message); in migration_get_env()
1039 g_assert(env->tmpfs); in migration_get_env()
1041 tmpfs = env->tmpfs; in migration_get_env()
1057 tmpfs = env->tmpfs; in migration_env_clean()