[PATCH v3 09/11] migration/tests: remove capability conflict test postcopy-ram+mapped-ram

Aadeshveer Singh posted 11 patches 2 months ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[PATCH v3 09/11] migration/tests: remove capability conflict test postcopy-ram+mapped-ram
Posted by Aadeshveer Singh 2 months ago
Remove the test test_validate_caps_pair, which asserted postcopy-ram
and mapped-ram capabilities cannot be active together. The new fast
snapshot load feature is exactly this pair of capabilities active
together, with the following patches in this series, this combination
will now supported and be functional.

Remove the capability check that rejected mapped-ram and postcopy-ram
being set simultaneously, as this combination now corresponds to fast
snapshot load.

Add a capability check against setting multifd when configured for fast
snapshot load as it is not supported yet. Also add capability check
against setting postcopy-preempt as it is incompatible.

A smoke test exercising this feature has been added further in this
series.

Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com>
---
 migration/options.c                | 14 ++++++--
 tests/qtest/migration/misc-tests.c | 52 ------------------------------
 2 files changed, 12 insertions(+), 54 deletions(-)

diff --git a/migration/options.c b/migration/options.c
index 5cbfd29099..d61a10f1c4 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -727,10 +727,20 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
                        "Mapped-ram migration is incompatible with xbzrle");
             return false;
         }
+    }
 
-        if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
+    if (new_caps[MIGRATION_CAPABILITY_MAPPED_RAM] &&
+        new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
+        if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) {
             error_setg(errp,
-                       "Mapped-ram migration is incompatible with postcopy");
+                       "Multifd is not supported with fast snapshot load");
+            return false;
+        }
+
+        if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) {
+            error_setg(
+                errp,
+                "Postcopy Preempt is incompatible with fast snapshot load");
             return false;
         }
     }
diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c
index ec6d438cdc..4e0deb7f18 100644
--- a/tests/qtest/migration/misc-tests.c
+++ b/tests/qtest/migration/misc-tests.c
@@ -201,55 +201,6 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
     migrate_end(from, to, false);
 }
 
-static void validate_caps_pair(QTestState *from,
-                               const char *first_capability,
-                               const char *second_capability,
-                               const char *expected_error)
-{
-    QDict *rsp;
-    const char *error_desc;
-
-    migrate_set_capability(from, first_capability, true);
-
-    rsp = qtest_qmp_assert_failure_ref(
-        from,
-        "{ 'execute': 'migrate-set-capabilities',"
-        "  'arguments': { 'capabilities': [ { "
-        "      'capability': %s, 'state': true } ] } }",
-        second_capability);
-
-    error_desc = qdict_get_str(rsp, "desc");
-    g_assert_cmpstr(error_desc, ==, expected_error);
-    qobject_unref(rsp);
-
-    migrate_set_capability(from, first_capability, false);
-}
-
-static void test_validate_caps_pair(char *test_path, MigrateCommon *args)
-{
-    g_autofree char *serial_path = g_strconcat(tmpfs, "/src_serial", NULL);
-    g_autofree char *cap_pair = g_path_get_basename(test_path);
-    QTestState *from, *to;
-
-    args->start.hide_stderr = true;
-    args->start.only_source = true;
-
-    if (migrate_start(&from, &to, &args->start)) {
-        return;
-    }
-
-    if (g_str_equal(cap_pair, "mapped_ram_postcopy")) {
-        const char *error =
-            "Mapped-ram migration is incompatible with postcopy";
-
-        validate_caps_pair(from, "mapped-ram", "postcopy-ram", error);
-        validate_caps_pair(from, "postcopy-ram", "mapped-ram", error);
-    }
-
-    qtest_quit(from);
-    unlink(serial_path);
-}
-
 static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
 {
     args->uri = "tcp:127.0.0.1:0",
@@ -309,7 +260,4 @@ void migration_test_add_misc(MigrationTestEnv *env)
                        test_validate_uri_channels_both_set);
     migration_test_add("/migration/validate_uri/channels/none_set",
                        test_validate_uri_channels_none_set);
-    migration_test_add_suffix("/migration/validate_caps/",
-                              "mapped_ram_postcopy",
-                              test_validate_caps_pair);
 }
-- 
2.55.0
Re: [PATCH v3 09/11] migration/tests: remove capability conflict test postcopy-ram+mapped-ram
Posted by Peter Xu 1 month, 3 weeks ago
On Tue, Jul 14, 2026 at 07:45:45PM +0530, Aadeshveer Singh wrote:
> Remove the test test_validate_caps_pair, which asserted postcopy-ram
> and mapped-ram capabilities cannot be active together. The new fast
> snapshot load feature is exactly this pair of capabilities active
> together, with the following patches in this series, this combination
> will now supported and be functional.
> 
> Remove the capability check that rejected mapped-ram and postcopy-ram
> being set simultaneously, as this combination now corresponds to fast
> snapshot load.
> 
> Add a capability check against setting multifd when configured for fast
> snapshot load as it is not supported yet. Also add capability check
> against setting postcopy-preempt as it is incompatible.
> 
> A smoke test exercising this feature has been added further in this
> series.
> 
> Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com>

The subject with "migration/tests:" may imply this is a pure test change.
Let's rename it to something like "migration: Enable mapped-ram with
postcopy" to say this is a functional change.  It's normally fine to have
test changes with such functional change, not vice versa (or people may
ignore this patch when backporting the feature only).

After rename, feel free to take:

Reviewed-by: Peter Xu <peterx@redhat.com>

> ---
>  migration/options.c                | 14 ++++++--
>  tests/qtest/migration/misc-tests.c | 52 ------------------------------
>  2 files changed, 12 insertions(+), 54 deletions(-)
> 
> diff --git a/migration/options.c b/migration/options.c
> index 5cbfd29099..d61a10f1c4 100644
> --- a/migration/options.c
> +++ b/migration/options.c
> @@ -727,10 +727,20 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
>                         "Mapped-ram migration is incompatible with xbzrle");
>              return false;
>          }
> +    }
>  
> -        if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
> +    if (new_caps[MIGRATION_CAPABILITY_MAPPED_RAM] &&
> +        new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
> +        if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) {
>              error_setg(errp,
> -                       "Mapped-ram migration is incompatible with postcopy");
> +                       "Multifd is not supported with fast snapshot load");
> +            return false;
> +        }
> +
> +        if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) {
> +            error_setg(
> +                errp,
> +                "Postcopy Preempt is incompatible with fast snapshot load");
>              return false;
>          }
>      }
> diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c
> index ec6d438cdc..4e0deb7f18 100644
> --- a/tests/qtest/migration/misc-tests.c
> +++ b/tests/qtest/migration/misc-tests.c
> @@ -201,55 +201,6 @@ static void do_test_validate_uri_channel(MigrateCommon *args)
>      migrate_end(from, to, false);
>  }
>  
> -static void validate_caps_pair(QTestState *from,
> -                               const char *first_capability,
> -                               const char *second_capability,
> -                               const char *expected_error)
> -{
> -    QDict *rsp;
> -    const char *error_desc;
> -
> -    migrate_set_capability(from, first_capability, true);
> -
> -    rsp = qtest_qmp_assert_failure_ref(
> -        from,
> -        "{ 'execute': 'migrate-set-capabilities',"
> -        "  'arguments': { 'capabilities': [ { "
> -        "      'capability': %s, 'state': true } ] } }",
> -        second_capability);
> -
> -    error_desc = qdict_get_str(rsp, "desc");
> -    g_assert_cmpstr(error_desc, ==, expected_error);
> -    qobject_unref(rsp);
> -
> -    migrate_set_capability(from, first_capability, false);
> -}
> -
> -static void test_validate_caps_pair(char *test_path, MigrateCommon *args)
> -{
> -    g_autofree char *serial_path = g_strconcat(tmpfs, "/src_serial", NULL);
> -    g_autofree char *cap_pair = g_path_get_basename(test_path);
> -    QTestState *from, *to;
> -
> -    args->start.hide_stderr = true;
> -    args->start.only_source = true;
> -
> -    if (migrate_start(&from, &to, &args->start)) {
> -        return;
> -    }
> -
> -    if (g_str_equal(cap_pair, "mapped_ram_postcopy")) {
> -        const char *error =
> -            "Mapped-ram migration is incompatible with postcopy";
> -
> -        validate_caps_pair(from, "mapped-ram", "postcopy-ram", error);
> -        validate_caps_pair(from, "postcopy-ram", "mapped-ram", error);
> -    }
> -
> -    qtest_quit(from);
> -    unlink(serial_path);
> -}
> -
>  static void test_validate_uri_channels_both_set(char *name, MigrateCommon *args)
>  {
>      args->uri = "tcp:127.0.0.1:0",
> @@ -309,7 +260,4 @@ void migration_test_add_misc(MigrationTestEnv *env)
>                         test_validate_uri_channels_both_set);
>      migration_test_add("/migration/validate_uri/channels/none_set",
>                         test_validate_uri_channels_none_set);
> -    migration_test_add_suffix("/migration/validate_caps/",
> -                              "mapped_ram_postcopy",
> -                              test_validate_caps_pair);
>  }
> -- 
> 2.55.0
> 

-- 
Peter Xu