On Mon, Oct 23, 2023 at 05:36:08PM -0300, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <faro...@suse.de>
> ---
>  tests/qtest/migration-test.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index c74c911283..30e70c0e4e 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -2077,6 +2077,16 @@ static void 
> *migrate_multifd_fixed_ram_start(QTestState *from, QTestState *to)
>      return NULL;
>  }
>  
> +static void *migrate_multifd_fixed_ram_dio_start(QTestState *from, 
> QTestState *to)
> +{
> +    migrate_multifd_fixed_ram_start(from, to);
> +
> +    migrate_set_parameter_bool(from, "direct-io", true);
> +    migrate_set_parameter_bool(to, "direct-io", true);
> +
> +    return NULL;
> +}
> +
>  static void test_multifd_file_fixed_ram_live(void)
>  {
>      g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
> @@ -2103,6 +2113,18 @@ static void test_multifd_file_fixed_ram(void)
>      test_file_common(&args, false, true);
>  }
>  
> +static void test_multifd_file_fixed_ram_dio(void)
> +{
> +    g_autofree char *uri = g_strdup_printf("file:%s/%s", tmpfs,
> +                                           FILE_TEST_FILENAME);
> +    MigrateCommon args = {
> +        .connect_uri = uri,
> +        .listen_uri = "defer",
> +        .start_hook = migrate_multifd_fixed_ram_dio_start,
> +    };
> +
> +    test_file_common(&args, false, true);
> +}
>  
>  static void test_precopy_tcp_plain(void)
>  {
> @@ -3182,6 +3204,9 @@ int main(int argc, char **argv)
>      qtest_add_func("/migration/multifd/file/fixed-ram/live",
>                     test_multifd_file_fixed_ram_live);
>  
> +    qtest_add_func("/migration/multifd/file/fixed-ram/dio",
> +                   test_multifd_file_fixed_ram_dio);

All of the above should be put behind a #ifdef O_DIRECT check.

Also even if the platform supports O_DIRECT, we shouldn't assume
the filesystem used for QEMU build supports it. So we need to
open a tmp file at the same place as the save/restore and probe
to see if it succeeds with O_DIRECT, and skip the test if not.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to