Message ID | 20231018192741.25885-8-farosas@suse.de |
---|---|
State | New |
Headers | show |
Series | tests/migration-test: Allow testing older machine types | expand |
On 18/10/2023 21.27, Fabiano Rosas wrote: > Stop relying on defaults and select a machine explicitly for every > architecture. > > This is a prerequisite for being able to select machine types for > migration using different QEMU binaries for source and destination. > > Signed-off-by: Fabiano Rosas <farosas@suse.de> > --- > tests/qtest/migration-test.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > index e1c110537b..43d0b83771 100644 > --- a/tests/qtest/migration-test.c > +++ b/tests/qtest/migration-test.c > @@ -743,6 +743,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, > const char *kvm_opts = NULL; > const char *arch = qtest_get_arch(); > const char *memory_size; > + const char *machine_alias, *machine_opts = ""; > > if (args->use_shmem) { > if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { > @@ -755,11 +756,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, > got_dst_resume = false; > if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { > memory_size = "150M"; > + machine_alias = "pc"; > arch_opts = g_strdup_printf("-drive file=%s,format=raw", bootpath); > start_address = X86_TEST_MEM_START; > end_address = X86_TEST_MEM_END; > } else if (g_str_equal(arch, "s390x")) { > memory_size = "128M"; > + machine_alias = "s390-ccw-virtio"; > arch_opts = g_strdup_printf("-bios %s", bootpath); > start_address = S390_TEST_MEM_START; > end_address = S390_TEST_MEM_END; > @@ -771,11 +774,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, > "'nvramrc=hex .\" _\" begin %x %x " > "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " > "until'", end_address, start_address); > - arch_opts = g_strdup("-nodefaults -machine vsmt=8"); > + machine_alias = "pseries"; > + machine_opts = "vsmt=8"; > + arch_opts = g_strdup("-nodefaults"); > } else if (strcmp(arch, "aarch64") == 0) { > memory_size = "150M"; > - arch_opts = g_strdup_printf("-machine virt,gic-version=max -cpu max " > - "-kernel %s", bootpath); > + machine_alias = "virt"; > + machine_opts = "gic-version=max"; > + arch_opts = g_strdup_printf("-cpu max -kernel %s", bootpath); > start_address = ARM_TEST_MEM_START; > end_address = ARM_TEST_MEM_END; > } else { > @@ -810,11 +816,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, > } > > cmd_source = g_strdup_printf("-accel kvm%s -accel tcg " > + "-machine %s,%s " > "-name source,debug-threads=on " > "-m %s " > "-serial file:%s/src_serial " > "%s %s %s %s %s", > kvm_opts ? kvm_opts : "", > + machine_alias, machine_opts, > memory_size, tmpfs, > arch_opts ? arch_opts : "", > arch_source ? arch_source : "", > @@ -829,12 +837,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, > } > > cmd_target = g_strdup_printf("-accel kvm%s -accel tcg " > + "-machine %s,%s " If machine_opts is empty, there will be a lonely "," at the end of the parameter ... seems to work, but it's a little bit ugly. Anyway: Reviewed-by: Thomas Huth <thuth@redhat.com> > "-name target,debug-threads=on " > "-m %s " > "-serial file:%s/dest_serial " > "-incoming %s " > "%s %s %s %s %s", > kvm_opts ? kvm_opts : "", > + machine_alias, machine_opts, > memory_size, tmpfs, uri, > arch_opts ? arch_opts : "", > arch_target ? arch_target : "",
Thomas Huth <thuth@redhat.com> writes: > On 18/10/2023 21.27, Fabiano Rosas wrote: >> Stop relying on defaults and select a machine explicitly for every >> architecture. >> This is a prerequisite for being able to select machine types for >> migration using different QEMU binaries for source and destination. >> Signed-off-by: Fabiano Rosas <farosas@suse.de> >> --- >> tests/qtest/migration-test.c | 16 +++++++++++++--- >> 1 file changed, 13 insertions(+), 3 deletions(-) >> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c >> index e1c110537b..43d0b83771 100644 >> --- a/tests/qtest/migration-test.c >> +++ b/tests/qtest/migration-test.c [...] >> @@ -829,12 +837,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, >> } >> cmd_target = g_strdup_printf("-accel kvm%s -accel tcg " >> + "-machine %s,%s " > > If machine_opts is empty, there will be a lonely "," at the end of the parameter ... seems to work, but it's a little bit ugly. keyval_parse() & friends accept trailing ',' to help with keeping things simple. > Anyway: > Reviewed-by: Thomas Huth <thuth@redhat.com> > > >> "-name target,debug-threads=on " >> "-m %s " >> "-serial file:%s/dest_serial " >> "-incoming %s " >> "%s %s %s %s %s", >> kvm_opts ? kvm_opts : "", >> + machine_alias, machine_opts, >> memory_size, tmpfs, uri, >> arch_opts ? arch_opts : "", >> arch_target ? arch_target : "",
Fabiano Rosas <farosas@suse.de> wrote: > Stop relying on defaults and select a machine explicitly for every > architecture. > > This is a prerequisite for being able to select machine types for > migration using different QEMU binaries for source and destination. > > Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Juan Quintela <quintela@redhat.com> I have patches to simplify this, but will rebase on top of yours.
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e1c110537b..43d0b83771 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -743,6 +743,7 @@ static int test_migrate_start(QTestState **from, QTestState **to, const char *kvm_opts = NULL; const char *arch = qtest_get_arch(); const char *memory_size; + const char *machine_alias, *machine_opts = ""; if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { @@ -755,11 +756,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, got_dst_resume = false; if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { memory_size = "150M"; + machine_alias = "pc"; arch_opts = g_strdup_printf("-drive file=%s,format=raw", bootpath); start_address = X86_TEST_MEM_START; end_address = X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { memory_size = "128M"; + machine_alias = "s390-ccw-virtio"; arch_opts = g_strdup_printf("-bios %s", bootpath); start_address = S390_TEST_MEM_START; end_address = S390_TEST_MEM_END; @@ -771,11 +774,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, "'nvramrc=hex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until'", end_address, start_address); - arch_opts = g_strdup("-nodefaults -machine vsmt=8"); + machine_alias = "pseries"; + machine_opts = "vsmt=8"; + arch_opts = g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") == 0) { memory_size = "150M"; - arch_opts = g_strdup_printf("-machine virt,gic-version=max -cpu max " - "-kernel %s", bootpath); + machine_alias = "virt"; + machine_opts = "gic-version=max"; + arch_opts = g_strdup_printf("-cpu max -kernel %s", bootpath); start_address = ARM_TEST_MEM_START; end_address = ARM_TEST_MEM_END; } else { @@ -810,11 +816,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, } cmd_source = g_strdup_printf("-accel kvm%s -accel tcg " + "-machine %s,%s " "-name source,debug-threads=on " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + machine_alias, machine_opts, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -829,12 +837,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, } cmd_target = g_strdup_printf("-accel kvm%s -accel tcg " + "-machine %s,%s " "-name target,debug-threads=on " "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + machine_alias, machine_opts, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "",
Stop relying on defaults and select a machine explicitly for every architecture. This is a prerequisite for being able to select machine types for migration using different QEMU binaries for source and destination. Signed-off-by: Fabiano Rosas <farosas@suse.de> --- tests/qtest/migration-test.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)