[PATCH 00/42] Migration test refactoring

Juan Quintela posted 42 patches 10 months, 2 weeks ago
MAINTAINERS                         |    3 +-
tests/qtest/migration-helpers.h     |   39 +
tests/qtest/migration-helpers.c     |  242 +++++
tests/qtest/migration-test.c        | 1525 +++++++++------------------
tests/qtest/vcpu-dirty-limit-test.c |  310 ++++++
tests/qtest/meson.build             |    5 +-
6 files changed, 1113 insertions(+), 1011 deletions(-)
create mode 100644 tests/qtest/vcpu-dirty-limit-test.c
[PATCH 00/42] Migration test refactoring
Posted by Juan Quintela 10 months, 2 weeks ago
Hi

This series do a lot of much neededs cleanups and fixes to migration-test:

- We make source and target machines coherent/constent
- We make all command line options consistent
- We split test_migrate_start() and test_migrate_end() into:

  * guest_start() from from and to.  It is the same function, just
    defines the basic options.  I am open to renaming it to
    guest_define() or anything else that people can came with.

  * guest_destroy(), you have guessed it, right?

  * guest_realize() after guest_start() and adding any options we
    need, we just create the guest.  We use the same function from
    source and target, making inconsistencies disapear.

- uri: right now it is a mess, we can have:
  * uri created with migration_start()
  * or listen_uri
  * or connect_uri
  * or by hand
  now we just setup to->uri, and we get the migrate uri automatically from there.

- we were creating bootfile for each migration test.  Change the code
  so we only create it once for the whole migration test.

- Introduce GuestState.  Using QTestState directly means that we can
  add state by guest, making it abuse local variables.  Now we move
  all guest state into GuestState.

- Apart from test found by Fabiano, we had another problems with
  multifd + cancel:

  * We didn't wait for "to" guest to finish before we launch second
    target guest "to2".  We fixed it by destroying "to" before
    launching "to2".

  * We reused "dest_serial" filename from "to" and "to2", so in a very
    loaded host, it could be that we contact with the wrong vm, and we
    never end.

  * I change the code so the serial filename is dependent on guest
    name, that made changing the interface:
    wait_for_serial("dest_serial") to
    wait_for_relial(to) (or to2 or ...) so we can't fail.

- we move the global event variables to GuestState, so no more
  got_src_stop or got_dst_resume, we just check
    who->got_event

- create a function from migrate-incoming, so now we do:
  migrate_incoming(uri) and it does what we want/expect.

- vcpu_dirty_limit is not related to migration at all, just is easier
  to write with migration infrastructure.  Move all useful functions
  to migration-helpers.[ch] and split the test into
  vcpu-dirty-limit-test.c.  I think that we can declare that test slow.

- Now that guest_create/destry exist, we can "reuse" them in
  vcpu_dirty_limit test.

- The removal of files, like "migsocket" was flaky at least, i.e. not
  always removed.  "migsocket-recover" was not even tried to remove.
  New code just remove them by default.

- MigrationStart is gone, instead of creating that flags, I just call
  functions that do that function.

- if no uri is given for a target guest, it launches with -incoming
  defer, that should be the default.

ToDo:

- Tests shouldn't really use QMP, if we need QMP, we should hide it
  behind a c function.  Almost everything is there now, except things
  like "reuse".

- I think we should split auto-converge test:
  * we are not testing migration there, we are testing vcpu slowdown
  * the test is really slow, see documentation why we can't make it much faster.

- I still need to make test faster with stoping switchover.

Please, review.

Juan Quintela (42):
  migration-test: Be consistent for ppc
  migration-test: Make ignore_stderr regular with other options
  migration-test: simplify shmem_opts handling
  migration-test: Make machine_opts regular with other options
  migration-test: Create arch_opts
  migration-test: machine_opts is really arch specific
  migration-test: Create kvm_opts
  migration-test: bootpath is the same for all tests and for all archs
  migration-test: Add bootfile_create/delete() functions
  migration-test: dirtylimit checks for x86_64 arch before
  migration-test: Update test_ignore_shared to use args
  migration-test: Enable back ignore-shared test
  migration-test: Check for shared memory like for everything else
  migration-test: test_migrate_start() always return 0
  migration-test: migrate_postcopy_prepare() always return 0
  migration-test: Create do_migrate()
  migration-test: Introduce GuestState
  migration-test: Create guest before calling do_test_validate_uuid()
  migration-test: Create guest before calling test_precopy_common()
  migration-test: Create guest before calling test_postcopy_common()
  migration-test: Move common guest code to guest_create()
  migration-test: Create guest_use_dirty_log()
  migration-test: Move serial to GuestState
  migration-test: Re-enable multifd_cancel test
  migration-test: We were not waiting for "target" to finish
  migration-test: create guest_use_shmem()
  migration-test: Create guest_extra_opts()
  migration-test: Create guest_hide_stderr()
  migration-test: Create the migration unix socket by guest
  migration-test: Hooks also need GuestState
  migration-test: Preffer to->uri to uri parameter for migration
  migration-test: Create guest_set_uri()
  migration-test: Remove connect_uri
  migration-test: Use new schema for all tests that use unix sockets
  migration-test: Set uri for tcp tests with guest_set_uri()
  migration-test: Remove unused listen_uri
  migration-test: Create get_event GuestState variable
  migration-test: Create guest_realize()
  migration-test: Unfold test_migrate_end() into three functions
  migration-test: Create migrate_incoming() function
  migration-test: Move functions to migration-helpers.c
  migration-test: Split vcpu-dirty-limit-test

 MAINTAINERS                         |    3 +-
 tests/qtest/migration-helpers.h     |   39 +
 tests/qtest/migration-helpers.c     |  242 +++++
 tests/qtest/migration-test.c        | 1525 +++++++++------------------
 tests/qtest/vcpu-dirty-limit-test.c |  310 ++++++
 tests/qtest/meson.build             |    5 +-
 6 files changed, 1113 insertions(+), 1011 deletions(-)
 create mode 100644 tests/qtest/vcpu-dirty-limit-test.c


base-commit: 45ae97993a75f975f1a01d25564724c7e10a543f
prerequisite-patch-id: f95418b6f47019ec82d47aac8ba5247775f503a3
-- 
2.40.1