migration-test: memory_backend
Allow each migration test to define its own memory backend, replacing the standard "-m <size>" specification. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/1736967650-129648-18-git-send-email-steven.sistare@oracle.com Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
624e6e654e
commit
fdbfbfc75e
@ -221,6 +221,7 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
|||||||
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);
|
g_autoptr(QList) capabilities = migrate_start_get_qmp_capabilities(args);
|
||||||
|
g_autofree char *memory_backend = NULL;
|
||||||
|
|
||||||
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)) {
|
||||||
@ -296,6 +297,12 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
|||||||
memory_size, shmem_path);
|
memory_size, shmem_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args->memory_backend) {
|
||||||
|
memory_backend = g_strdup_printf(args->memory_backend, memory_size);
|
||||||
|
} else {
|
||||||
|
memory_backend = g_strdup_printf("-m %s ", memory_size);
|
||||||
|
}
|
||||||
|
|
||||||
if (args->use_dirty_ring) {
|
if (args->use_dirty_ring) {
|
||||||
kvm_opts = ",dirty-ring-size=4096";
|
kvm_opts = ",dirty-ring-size=4096";
|
||||||
}
|
}
|
||||||
@ -314,12 +321,12 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
|||||||
cmd_source = g_strdup_printf("-accel kvm%s -accel tcg "
|
cmd_source = g_strdup_printf("-accel kvm%s -accel tcg "
|
||||||
"-machine %s,%s "
|
"-machine %s,%s "
|
||||||
"-name source,debug-threads=on "
|
"-name source,debug-threads=on "
|
||||||
"-m %s "
|
"%s "
|
||||||
"-serial file:%s/src_serial "
|
"-serial file:%s/src_serial "
|
||||||
"%s %s %s %s",
|
"%s %s %s %s",
|
||||||
kvm_opts ? kvm_opts : "",
|
kvm_opts ? kvm_opts : "",
|
||||||
machine, machine_opts,
|
machine, machine_opts,
|
||||||
memory_size, tmpfs,
|
memory_backend, tmpfs,
|
||||||
arch_opts ? arch_opts : "",
|
arch_opts ? arch_opts : "",
|
||||||
shmem_opts ? shmem_opts : "",
|
shmem_opts ? shmem_opts : "",
|
||||||
args->opts_source ? args->opts_source : "",
|
args->opts_source ? args->opts_source : "",
|
||||||
@ -335,13 +342,13 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
|
|||||||
cmd_target = g_strdup_printf("-accel kvm%s -accel tcg "
|
cmd_target = g_strdup_printf("-accel kvm%s -accel tcg "
|
||||||
"-machine %s,%s "
|
"-machine %s,%s "
|
||||||
"-name target,debug-threads=on "
|
"-name target,debug-threads=on "
|
||||||
"-m %s "
|
"%s "
|
||||||
"-serial file:%s/dest_serial "
|
"-serial file:%s/dest_serial "
|
||||||
"-incoming %s "
|
"-incoming %s "
|
||||||
"%s %s %s %s",
|
"%s %s %s %s",
|
||||||
kvm_opts ? kvm_opts : "",
|
kvm_opts ? kvm_opts : "",
|
||||||
machine, machine_opts,
|
machine, machine_opts,
|
||||||
memory_size, tmpfs, uri,
|
memory_backend, tmpfs, uri,
|
||||||
arch_opts ? arch_opts : "",
|
arch_opts ? arch_opts : "",
|
||||||
shmem_opts ? shmem_opts : "",
|
shmem_opts ? shmem_opts : "",
|
||||||
args->opts_target ? args->opts_target : "",
|
args->opts_target ? args->opts_target : "",
|
||||||
|
@ -111,6 +111,11 @@ typedef struct {
|
|||||||
bool suspend_me;
|
bool suspend_me;
|
||||||
/* enable OOB QMP capability */
|
/* enable OOB QMP capability */
|
||||||
bool oob;
|
bool oob;
|
||||||
|
/*
|
||||||
|
* Format string for the main memory backend, containing one %s where the
|
||||||
|
* size is plugged in. If omitted, "-m %s" is used.
|
||||||
|
*/
|
||||||
|
const char *memory_backend;
|
||||||
} MigrateStart;
|
} MigrateStart;
|
||||||
|
|
||||||
typedef enum PostcopyRecoveryFailStage {
|
typedef enum PostcopyRecoveryFailStage {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user