All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, berrange@redhat.com, armbru@redhat.com,
	Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3 32/51] tests/qtest/migration: Adapt convergence routines to config
Date: Fri, 19 Dec 2025 10:39:51 -0500	[thread overview]
Message-ID: <aUVxx8tfPMe-liDT@x1.local> (raw)
In-Reply-To: <87wm2jz7xf.fsf@suse.de>

On Thu, Dec 18, 2025 at 08:28:28PM -0300, Fabiano Rosas wrote:
> Peter Xu <peterx@redhat.com> writes:
> 
> > On Thu, Dec 18, 2025 at 04:47:47PM -0300, Fabiano Rosas wrote:
> >> Peter Xu <peterx@redhat.com> writes:
> >> 
> >> > On Mon, Dec 15, 2025 at 07:00:18PM -0300, Fabiano Rosas wrote:
> >> >> Adapt the convergence routines migrate_ensure_[non_]converge to set
> >> >> the convergence parameters in the config dict it instead of using
> >> >> migrate-set-parameters.
> >> >> 
> >> >> Some tests need to change the convergence parameters during the
> >> >> migration. The config object method is specific to configuration prior
> >> >> to starting a migration, so by design it's not suitable to effect
> >> >> migration-runtime changes. The existing routines will be kept for this
> >> >> purpose (renamed with 'ongoing' for clarity).
> >> >> 
> >> >> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> >> >> ---
> >> >>  tests/qtest/migration/framework.c     | 10 ++++-----
> >> >>  tests/qtest/migration/migration-qmp.c | 32 +++++++++++++++++++++++++--
> >> >>  tests/qtest/migration/migration-qmp.h |  6 +++--
> >> >>  tests/qtest/migration/misc-tests.c    |  4 ++--
> >> >>  tests/qtest/migration/precopy-tests.c | 26 +++++++++-------------
> >> >>  5 files changed, 52 insertions(+), 26 deletions(-)
> >> >> 
> >> >> diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
> >> >> index fd15bd832e..df42a8a2c6 100644
> >> >> --- a/tests/qtest/migration/framework.c
> >> >> +++ b/tests/qtest/migration/framework.c
> >> >> @@ -583,7 +583,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
> >> >>          args->postcopy_data = args->start_hook(from, to);
> >> >>      }
> >> >>  
> >> >> -    migrate_ensure_non_converge(from);
> >> >> +    migrate_ensure_non_converge(from, args->start.config);
> >> >>      migrate_prepare_for_dirty_mem(from);
> >> >>      qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming',"
> >> >>                               "  'arguments': { "
> >> >> @@ -872,7 +872,7 @@ int test_precopy_common(MigrateCommon *args)
> >> >>      }
> >> >>  
> >> >>      if (args->live) {
> >> >> -        migrate_ensure_non_converge(from);
> >> >> +        migrate_ensure_non_converge(from, args->start.config);
> >> >>          migrate_prepare_for_dirty_mem(from);
> >> >>      } else {
> >> >>          /*
> >> >> @@ -884,7 +884,7 @@ int test_precopy_common(MigrateCommon *args)
> >> >>          if (args->result == MIG_TEST_SUCCEED) {
> >> >>              qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}");
> >> >>              wait_for_stop(from, &src_state);
> >> >> -            migrate_ensure_converge(from);
> >> >> +            migrate_ongoing_ensure_converge(from);
> >> >>          }
> >> >>      }
> >> >>  
> >> >> @@ -942,7 +942,7 @@ int test_precopy_common(MigrateCommon *args)
> >> >>              }
> >> >>              migrate_wait_for_dirty_mem(from, to);
> >> >>  
> >> >> -            migrate_ensure_converge(from);
> >> >> +            migrate_ongoing_ensure_converge(from);
> >> >>  
> >> >>              /*
> >> >>               * We do this first, as it has a timeout to stop us
> >> >> @@ -1047,7 +1047,7 @@ void test_file_common(MigrateCommon *args, bool stop_src)
> >> >>          data_hook = args->start_hook(from, to);
> >> >>      }
> >> >>  
> >> >> -    migrate_ensure_converge(from);
> >> >> +    migrate_ensure_converge(from, args->start.config);
> >> >>      wait_for_serial("src_serial");
> >> >>  
> >> >>      if (stop_src) {
> >> >> diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/migration-qmp.c
> >> >> index 5c46ceb3e6..7fe47a5793 100644
> >> >> --- a/tests/qtest/migration/migration-qmp.c
> >> >> +++ b/tests/qtest/migration/migration-qmp.c
> >> >> @@ -499,20 +499,48 @@ void migrate_set_parameter_bool(QTestState *who, const char *parameter,
> >> >>      migrate_check_parameter_bool(who, parameter, value);
> >> >>  }
> >> >>  
> >> >> -void migrate_ensure_non_converge(QTestState *who)
> >> >> +void migrate_ongoing_ensure_non_converge(QTestState *who)
> >> >>  {
> >> >>      /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */
> >> >>      migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000);
> >> >>      migrate_set_parameter_int(who, "downtime-limit", 1);
> >> >>  }
> >> >>  
> >> >> -void migrate_ensure_converge(QTestState *who)
> >> >> +void migrate_ongoing_ensure_converge(QTestState *who)
> >> >>  {
> >> >>      /* Should converge with 30s downtime + 1 gbs bandwidth limit */
> >> >>      migrate_set_parameter_int(who, "max-bandwidth", 1 * 1000 * 1000 * 1000);
> >> >>      migrate_set_parameter_int(who, "downtime-limit", 30 * 1000);
> >> >>  }
> >> >>  
> >> >> +void migrate_ensure_non_converge(QTestState *who, QDict *config)
> >> >> +{
> >> >> +    config = config_load(config);
> >> >> +    if (config) {
> >> >> +        /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */
> >> >> +        qdict_put_int(config, "max-bandwidth", 3 * 1000 * 1000);
> >> >> +        qdict_put_int(config, "downtime-limit", 1);
> >> >> +    } else {
> >> >> +        assert(who);
> >> >> +        migrate_ongoing_ensure_non_converge(who);
> >> >> +    }
> >> >> +    config_put(config);
> >> >> +}
> >> >> +
> >> >> +void migrate_ensure_converge(QTestState *who, QDict *config)
> >> >> +{
> >> >> +    config = config_load(config);
> >> >> +    /* Should converge with 30s downtime + 1 gbs bandwidth limit */
> >> >> +    if (config) {
> >> >> +        qdict_put_int(config, "max-bandwidth", 1 * 1000 * 1000 * 1000);
> >> >> +        qdict_put_int(config, "downtime-limit", 30 * 1000);
> >> >> +    } else {
> >> >> +        assert(who);
> >> >> +        migrate_ongoing_ensure_converge(who);
> >> >> +    }
> >> >> +    config_put(config);
> >> >> +}
> >> >
> >> > It's slightly an overkill to me to have these converge helpers to provide
> >> > two versions.  Also a bit confusing on when should we use which.
> >> >
> >> > After all, parameters touched on convergence must be able to be dynamically
> >> > set..
> >> >
> >> > Can we always stick with the QMP set-parameters for all these?
> >> >
> >> 
> >> Well, QEMU ignores anything set with migrate-set-parameters once it sees
> >> the config, so we'd need to change that in the code.
> >> 
> >> Thinking about the design of "config", I think the point was to never
> >> configure a migration via migrate-set-parameters. Always pass the config
> >> to the migration commands.
> >> 
> >> These options are special in that they make sense both before and after
> >> starting the migration, so it's indeed confusing. I don't know what the
> >> best approach is.
> >
> > Hmm, now I start to question whether this is a good idea.  That's about
> > this patch of the series:
> >
> >     migration: Allow migrate commands to provide the migration config
> >     
> >     Allow the migrate and migrate_incoming commands to pass the migration
> >     configuration options all at once, dispensing the use of
> >     migrate-set-parameters and migrate-set-capabilities.
> >     
> >     The motivation of this is to simplify the interface with the
> >     management layer and avoid the usage of several command invocations to
> >     configure a migration. It also avoids stale parameters from a previous
> >     migration to influence the current migration.
> >
> > Logically speaking, if mgmt worries about a stale parameter leftover, the
> > mgmt should always overwrite it in the config of this QMP migrate command..
> > Now I don't see a real benefit that we need to ignore global setups.
> >
> > A mgmt should simply query all parameters when QEMU just started up, then
> > keep it, then whatever user changes should be applied on top,  Then when
> > any QMP migrate happens, it should always set all parameters.. no matter
> > what is the global.
> >
> 
> We can decide that QEMU will not force the mgmt app to do that work and
> will provide an API that doesn't require setting all parameters. I don't
> see an argument here.
> 
> > The problem is exactly here, that when some parameters can be dynamically
> > changed like max-bw, if it was set and throttled 10Gbps dynamically,
> > migration failed, someone re-started the migration expecting the 10Gbps was
> > still applied when QMP migrate didn't set max-bw this time, but it didn't
> > work like that.
> >
> 
> We need to think about what the QMP API exposes.
> 
> If we expose an API that says: QMP_MIGRATE might use a value that was
> set using MIGRATE-SET-PARAMETERS 6 months ago because QEMU uses global
> state, that's an API usability issue.
> 
> If we expose an API that says: QMP_MIGRATE runs the migration with
> whatever arguments were passed to it via CONFIG, that sounds like
> something sensible.
> 
> I don't think the API consumers would be surprised if we allow
> MIGRATE-SET-PARAMETERS to change runtime values for a migration and on
> the next migration that value is no longer the same.
> 
> > Do you think we should make "config" of migrate / migrate_incoming taking
> > global setting as base, rather than initial_params?  I hope we don't
> > introduce something for nobody at last, but only to make our lives slightly
> > harder. :(
> 
> One calls a function and it uses the arguments passed to it, that's
> it. New migration, new arguments. As you said, mgmt could just hold the
> dynamic parameter that their user changed and pass that along with the
> config for the new migration.

It's never about when mgmt is an app like libvirt, IMHO either way we
define it, libvirt will be fine.  It's only about human beings when using
this API e.g. via HMPs, or who start to write scripts manipulating QEMU
directly assuming the max-bw will persist.

That's almost why I thought remembering the globals should be the best
because it will work well for both a computer and a human being.  But I
might be the only one thinking so if you don't agree on this; it's fine.

> 
> But I don't think we fleshed out the usage regarding the dynamic
> parameters yet. There might be other issues that I'm overlooking. Maybe
> we'd need a whole new command with slightly different semantics from
> migrate-set-parameters that adjusts the dynamic options while migration
> is running, I'm not sure.
> 
> ---
> side note:
> 
> If you think the whole endevour of passing a config to qmp_migrate
> is a bad idea, please speak up. If mgmt code will require the amount of
> churn I had to do for our test suite, maybe it's not worth the effort
> after all.

Frankly, I never thought there was an real problem to solve..  the only
thing I can remember is that "libvirt used to control this qemu, but link
down, some admin set something, libvirt reconnected and migration caused
weird issues".

IMHO when reconnect libvirt can always apply all the parameters once
more.. then if link kept, globals are also kept for this session anyway.
IMHO it's fair here because migration is special and unique for a QEMU
instance.  I don't further worry on other weird setups, like QEMU exposing
two QMP monitors - libvirt started the QEMU instance after all.

I almost always thought having "config" in migrate QMP command is a bonus
and optional, since it's still easy to get.  Hence, there's no harm anyway
we support it.  Your other changes (dedup >1 migration parameters structs,
merging caps into parameters, etc.) are more solid changers to me.

I'd confess initially I didn't expect so - logically we can introduce one
or a few new cases to test "config" setups, because most of the code paths
should really be shared (unless we decide to obsolete set-parameters; I
guess we won't.. forever).  But since we moved this far, The test cases are
now also moving all towards configs after this series. I think it's fine,
and you can decide that.

> 
> My opinion is that, in general, the "config" changes are going in a good
> direction. I worry slightly about what the cost would be for the users
> to adhere to it. Migration has been quirky for a looong time, you make
> it less quirky people will find it strange =)

Yes, actually I won't be surprised that after your series lands maybe the
"config" in QMP_MIGRATE won't be used for a while.  And if it keeps going
like that, nobody will consume it.. but I don't really know.  We'll see!

What I know is, after your series lands, I'll start to play with changing
default values for capabilities. :)

-- 
Peter Xu



  reply	other threads:[~2025-12-19 15:40 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 21:59 [PATCH v3 00/51] migration: Unify capabilities and parameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 01/51] migration: Fix leak of block_bitmap_mapping Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 02/51] migration: Fix leak of cpr_exec_command Fabiano Rosas
2025-12-16 16:48   ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 03/51] migration: Add a qdev property for StrOrNull Fabiano Rosas
2025-12-16 16:57   ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 04/51] tests/qtest/migration: Add a NULL parameters test for TLS Fabiano Rosas
2025-12-16 17:03   ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 05/51] migration: Normalize tls arguments Fabiano Rosas
2025-12-16 17:24   ` Peter Xu
2025-12-17 16:40     ` Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 06/51] migration: Remove MigrateSetParameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 07/51] qapi/migration: Don't document MigrationParameter Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 08/51] migration: Run a post update routine after setting parameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 09/51] migration: Add a flag to track block-bitmap-mapping input Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 10/51] migration: Remove checks for s->parameters has_* fields Fabiano Rosas
2025-12-16 18:50   ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 11/51] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 12/51] migration: Extract code to mark all parameters as present Fabiano Rosas
2025-12-16 18:56   ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 13/51] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 14/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Fabiano Rosas
2025-12-16 19:31   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 15/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Fabiano Rosas
2025-12-16 20:26   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 16/51] qapi: Add QAPI_MERGE Fabiano Rosas
2025-12-16 20:30   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 17/51] migration: Use QAPI_MERGE in migrate_params_test_apply Fabiano Rosas
2025-12-16 20:47   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 18/51] migration: Cleanup hmp_info_migrate_parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 19/51] migration: Add capabilities into MigrationParameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 20/51] migration: Remove s->capabilities Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 21/51] qapi/migration: Deprecate capabilities commands Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 22/51] migration: Store the initial values used for s->parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 23/51] migration: Allow migrate commands to provide the migration config Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 24/51] migration: Allow incoming cmdline to take config Fabiano Rosas
2025-12-17 15:34   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 25/51] tests/qtest/migration: Pass MigrateCommon into test functions Fabiano Rosas
2025-12-16 21:57   ` Peter Xu
2025-12-17 18:35   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 26/51] tests/qtest/migration: Pass MigrateStart into cancel tests Fabiano Rosas
2025-12-16 21:57   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 27/51] tests/qtest/migration: Fix misuse of listen_uri Fabiano Rosas
2025-12-17 15:30   ` Peter Xu
2025-12-17 16:59     ` Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 28/51] tests/qtest/migration: Stop invoking migrate_incoming from hooks Fabiano Rosas
2025-12-17 20:26   ` Peter Xu
2025-12-17 21:05     ` Fabiano Rosas
2025-12-17 21:24       ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 29/51] tests/qtest/migration: Add config QDict Fabiano Rosas
2025-12-17 20:27   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 30/51] tests/qtest/migration: Add temporary code to toggle usage of config Fabiano Rosas
2025-12-18 17:34   ` Peter Xu
2025-12-18 19:41     ` Fabiano Rosas
2025-12-18 20:58       ` Peter Xu
2025-12-18 23:41         ` Fabiano Rosas
2025-12-19 15:09           ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 31/51] tests/qtest/migration: Add a function for default capabilities Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 32/51] tests/qtest/migration: Adapt convergence routines to config Fabiano Rosas
2025-12-18 17:25   ` Peter Xu
2025-12-18 19:47     ` Fabiano Rosas
2025-12-18 21:08       ` Peter Xu
2025-12-18 23:28         ` Fabiano Rosas
2025-12-19 15:39           ` Peter Xu [this message]
2025-12-15 22:00 ` [PATCH v3 33/51] tests/qtest/migration: Adapt the incoming cmdline for config passing Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 34/51] tests/qtest/migration: Use migrate_incoming_qmp where possible Fabiano Rosas
2025-12-18 18:47   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 35/51] tests/qtest/migration: Add a config parameter to migrate_qmp functions Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 36/51] tests/qtest/migration: Move tls hook data out of specific hooks Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 37/51] tests/qtest/migration: Add new hook with data Fabiano Rosas
2025-12-18 19:05   ` Peter Xu
2025-12-18 21:43     ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 38/51] tests/qtest/migration: TLS x509: Refactor to use full hook Fabiano Rosas
2025-12-18 19:15   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 39/51] tests/qtest/migration: TLS x509: Add init/cleanup routines Fabiano Rosas
2025-12-18 21:31   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 40/51] tests/qtest/migration: TLS PSK: Refactor to use full hook Fabiano Rosas
2025-12-18 21:33   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 41/51] tests/qtest/migration: TLS PSK: Add init/cleanup routines Fabiano Rosas
2025-12-18 21:48   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 42/51] tests/qtest/migration: Remove multifd compression hook Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 43/51] tests/qtest/migration: Convert postcopy tests to use config Fabiano Rosas
2025-12-18 22:03   ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 44/51] tests/qtest/migration: Convert TLS PSK " Fabiano Rosas
2025-12-18 22:14   ` Peter Xu
2025-12-18 22:42     ` Fabiano Rosas
2025-12-19 15:59       ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 45/51] tests/qtest/migration: Convert TLS x509 " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 46/51] tests/qtest/migration: Convert compression " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 47/51] tests/qtest/migration: Convert file " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 48/51] tests/qtest/migration: Convert misc-tests " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 49/51] tests/qtest/migration: Convert precopy tests " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 50/51] tests/qtest/migration: Remove migrate_set_capabilities and code around it Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 51/51] tests/qtest/migration: Further simplify TLS tests Fabiano Rosas
2025-12-17 16:58 ` [PATCH v3 00/51] migration: Unify capabilities and parameters Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aUVxx8tfPMe-liDT@x1.local \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.