Fabiano Rosas <faro...@suse.de> writes:

> Add basic tests for file-based migration.
>
> Signed-off-by: Fabiano Rosas <faro...@suse.de>
> Reviewed-by: Peter Xu <pet...@redhat.com>
> ---
>  tests/qtest/migration-test.c | 99 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 99 insertions(+)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 2fdf6a115e..c052dbe1f1 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -52,6 +52,10 @@ static bool got_dst_resume;
>   */
>  #define DIRTYLIMIT_TOLERANCE_RANGE  25  /* MB/s */
>  
> +#define QEMU_VM_FILE_MAGIC 0x5145564d
> +#define FILE_TEST_FILENAME "migfile"
> +#define FILE_TEST_OFFSET 0x1000
> +
>  #if defined(__linux__)
>  #include <sys/syscall.h>
>  #include <sys/vfs.h>
> @@ -762,6 +766,7 @@ static void test_migrate_end(QTestState *from, QTestState 
> *to, bool test_dest)
>      cleanup("migsocket");
>      cleanup("src_serial");
>      cleanup("dest_serial");
> +    cleanup(FILE_TEST_FILENAME);
>  }
>  
>  #ifdef CONFIG_GNUTLS
> @@ -1459,11 +1464,28 @@ static void test_precopy_common(MigrateCommon *args)
>               */
>              wait_for_migration_complete(from);
>  
> +            /*
> +             * For file based migration the target must begin its
> +             * migration after the source has finished.
> +             */
> +            if (strstr(connect_uri, "file:")) {
> +                migrate_incoming_qmp(to, connect_uri, "{}");
> +            }
> +

This is now broken since we merged commit e02f56e3de ("tests/qtest:
massively speed up migration-test").

We cannot monitor the destination while the source is still running
because we need the source to have finished writing to the file before
we can start the destination. I'll have to think of another way of
testing a migration that is done with a live source but asynchronous
incoming migration.

Any suggestions are welcome.

Reply via email to