On Thu, Aug 14, 2025 at 10:17:19AM -0700, Steve Sistare wrote:
> Create the cpr-exec-command migration parameter, defined as a list of
> strings. It will be used for cpr-exec migration mode in a subsequent
> patch, and contains forward references to cpr-exec mode in the qapi
> doc.
>
> No functional change, except that cpr-exec-command is shown by the
> 'info migrate' command.
>
> Signed-off-by: Steve Sistare <[email protected]>
> ---
> qapi/migration.json | 21 ++++++++++++++++++---
> migration/migration-hmp-cmds.c | 25 +++++++++++++++++++++++++
> migration/options.c | 14 ++++++++++++++
> hmp-commands.hx | 2 +-
> 4 files changed, 58 insertions(+), 4 deletions(-)
> diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
> index 0fc21f0..79aa528 100644
> --- a/migration/migration-hmp-cmds.c
> +++ b/migration/migration-hmp-cmds.c
> @@ -306,6 +306,18 @@ void hmp_info_migrate_capabilities(Monitor *mon, const
> QDict *qdict)
> qapi_free_MigrationCapabilityStatusList(caps);
> }
>
> +static void monitor_print_cpr_exec_command(Monitor *mon, strList *args)
> +{
> + monitor_printf(mon, "%s:",
> + MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND));
> +
> + while (args) {
> + monitor_printf(mon, " %s", args->value);
> + args = args->next;
> + }
> + monitor_printf(mon, "\n");
> +}
> +
> void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
> {
> MigrationParameters *params;
> @@ -435,6 +447,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const
> QDict *qdict)
> MIGRATION_PARAMETER_DIRECT_IO),
> params->direct_io ? "on" : "off");
> }
> +
> + assert(params->has_cpr_exec_command);
> + monitor_print_cpr_exec_command(mon, params->cpr_exec_command);
> }
>
> qapi_free_MigrationParameters(params);
> @@ -716,6 +731,16 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict
> *qdict)
> p->has_direct_io = true;
> visit_type_bool(v, param, &p->direct_io, &err);
> break;
> + case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: {
> + g_autofree char **strv = g_strsplit(valuestr ?: "", " ", -1);
Perhaps we should use g_shell_parse_argv() in the HMP case ? IIUC
it should handle quoting for args containing whitespace (as long as
HMP itself has not already mangled that ?).
> + strList **tail = &p->cpr_exec_command;
> +
> + for (int i = 0; strv[i]; i++) {
> + QAPI_LIST_APPEND(tail, strv[i]);
> + }
> + p->has_cpr_exec_command = true;
> + break;
> + }
> default:
> g_assert_not_reached();
> }
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 :|