mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
tests/qtest/migration: Use out-of-band execution for migrate-recover
In real use cases, the migrate-recover command requires out-of-band execution, because the thread processing normal commands is blocked by a page fault in the guest memory. With this change, the tests will be closer to real use cases and could help detect regressions and other bugs in migration recovery. Signed-off-by: Juraj Marcin <jmarcin@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
99baa5d921
commit
3dec966f27
3 changed files with 24 additions and 3 deletions
|
@ -194,6 +194,16 @@ static void cleanup(const char *filename)
|
||||||
unlink(path);
|
unlink(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList *migrate_start_get_qmp_capabilities(const MigrateStart *args)
|
||||||
|
{
|
||||||
|
QList *capabilities = qlist_new();
|
||||||
|
|
||||||
|
if (args->oob) {
|
||||||
|
qlist_append_str(capabilities, "oob");
|
||||||
|
}
|
||||||
|
return capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
||||||
MigrateStart *args)
|
MigrateStart *args)
|
||||||
{
|
{
|
||||||
|
@ -210,6 +220,7 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
||||||
const char *machine_alias, *machine_opts = "";
|
const char *machine_alias, *machine_opts = "";
|
||||||
g_autofree char *machine = NULL;
|
g_autofree char *machine = NULL;
|
||||||
const char *bootpath;
|
const char *bootpath;
|
||||||
|
g_autoptr(QList) capabilities = migrate_start_get_qmp_capabilities(args);
|
||||||
|
|
||||||
if (args->use_shmem) {
|
if (args->use_shmem) {
|
||||||
if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
|
if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
|
||||||
|
@ -314,7 +325,8 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
||||||
args->opts_source ? args->opts_source : "",
|
args->opts_source ? args->opts_source : "",
|
||||||
ignore_stderr);
|
ignore_stderr);
|
||||||
if (!args->only_target) {
|
if (!args->only_target) {
|
||||||
*from = qtest_init_with_env(QEMU_ENV_SRC, cmd_source);
|
*from = qtest_init_with_env_and_capabilities(QEMU_ENV_SRC, cmd_source,
|
||||||
|
capabilities);
|
||||||
qtest_qmp_set_event_callback(*from,
|
qtest_qmp_set_event_callback(*from,
|
||||||
migrate_watch_for_events,
|
migrate_watch_for_events,
|
||||||
&src_state);
|
&src_state);
|
||||||
|
@ -334,7 +346,8 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
||||||
shmem_opts ? shmem_opts : "",
|
shmem_opts ? shmem_opts : "",
|
||||||
args->opts_target ? args->opts_target : "",
|
args->opts_target ? args->opts_target : "",
|
||||||
ignore_stderr);
|
ignore_stderr);
|
||||||
*to = qtest_init_with_env(QEMU_ENV_DST, cmd_target);
|
*to = qtest_init_with_env_and_capabilities(QEMU_ENV_DST, cmd_target,
|
||||||
|
capabilities);
|
||||||
qtest_qmp_set_event_callback(*to,
|
qtest_qmp_set_event_callback(*to,
|
||||||
migrate_watch_for_events,
|
migrate_watch_for_events,
|
||||||
&dst_state);
|
&dst_state);
|
||||||
|
@ -601,6 +614,12 @@ void test_postcopy_recovery_common(MigrateCommon *args)
|
||||||
QTestState *from, *to;
|
QTestState *from, *to;
|
||||||
g_autofree char *uri = NULL;
|
g_autofree char *uri = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Always enable OOB QMP capability for recovery tests, migrate-recover is
|
||||||
|
* executed out-of-band
|
||||||
|
*/
|
||||||
|
args->start.oob = true;
|
||||||
|
|
||||||
/* Always hide errors for postcopy recover tests since they're expected */
|
/* Always hide errors for postcopy recover tests since they're expected */
|
||||||
args->start.hide_stderr = true;
|
args->start.hide_stderr = true;
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,8 @@ typedef struct {
|
||||||
const char *opts_target;
|
const char *opts_target;
|
||||||
/* suspend the src before migrating to dest. */
|
/* suspend the src before migrating to dest. */
|
||||||
bool suspend_me;
|
bool suspend_me;
|
||||||
|
/* enable OOB QMP capability */
|
||||||
|
bool oob;
|
||||||
} MigrateStart;
|
} MigrateStart;
|
||||||
|
|
||||||
typedef enum PostcopyRecoveryFailStage {
|
typedef enum PostcopyRecoveryFailStage {
|
||||||
|
|
|
@ -464,7 +464,7 @@ void migrate_continue(QTestState *who, const char *state)
|
||||||
void migrate_recover(QTestState *who, const char *uri)
|
void migrate_recover(QTestState *who, const char *uri)
|
||||||
{
|
{
|
||||||
qtest_qmp_assert_success(who,
|
qtest_qmp_assert_success(who,
|
||||||
"{ 'execute': 'migrate-recover', "
|
"{ 'exec-oob': 'migrate-recover', "
|
||||||
" 'id': 'recover-cmd', "
|
" 'id': 'recover-cmd', "
|
||||||
" 'arguments': { 'uri': %s } }",
|
" 'arguments': { 'uri': %s } }",
|
||||||
uri);
|
uri);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue