On Mon, Apr 29, 2024 at 08:55:27AM -0700, Steve Sistare wrote: > Create the cpr-exec-args migration parameter, defined as a list of > strings. It will be used for cpr-exec migration mode in a subsequent > patch. > > No functional change, except that cpr-exec-args is shown by the > 'info migrate' command. > > Signed-off-by: Steve Sistare <steven.sist...@oracle.com> > --- > hmp-commands.hx | 2 +- > migration/migration-hmp-cmds.c | 24 ++++++++++++++++++++++++ > migration/options.c | 13 +++++++++++++ > qapi/migration.json | 18 +++++++++++++++--- > 4 files changed, 53 insertions(+), 4 deletions(-) > > diff --git a/hmp-commands.hx b/hmp-commands.hx > index 2e2a3bc..39954ae 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -1012,7 +1012,7 @@ ERST > > { > .name = "migrate_set_parameter", > - .args_type = "parameter:s,value:s", > + .args_type = "parameter:s,value:S", > .params = "parameter value", > .help = "Set the parameter for migration", > .cmd = hmp_migrate_set_parameter, > diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c > index 7e96ae6..414c7e8 100644 > --- a/migration/migration-hmp-cmds.c > +++ b/migration/migration-hmp-cmds.c > @@ -255,6 +255,18 @@ void hmp_info_migrate_capabilities(Monitor *mon, const > QDict *qdict) > qapi_free_MigrationCapabilityStatusList(caps); > } > > +static void monitor_print_cpr_exec_args(Monitor *mon, strList *args) > +{ > + monitor_printf(mon, "%s:", > + MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_ARGS)); > + > + 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; > @@ -397,6 +409,8 @@ void hmp_info_migrate_parameters(Monitor *mon, const > QDict *qdict) > monitor_printf(mon, "%s: %s\n", > MigrationParameter_str(MIGRATION_PARAMETER_MODE), > qapi_enum_lookup(&MigMode_lookup, params->mode)); > + assert(params->has_cpr_exec_args); > + monitor_print_cpr_exec_args(mon, params->cpr_exec_args); > } > > qapi_free_MigrationParameters(params); > @@ -690,6 +704,16 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict > *qdict) > p->has_mode = true; > visit_type_MigMode(v, param, &p->mode, &err); > break; > + case MIGRATION_PARAMETER_CPR_EXEC_ARGS: { > + g_autofree char **strv = g_strsplit(valuestr ?: "", " ", -1);
Splitting on whitespace means it'll break with any arguments containing quoted whitespace. If we use g_shell_parse_argv then it should support quoting in the normal shell mannre. > + strList **tail = &p->cpr_exec_args; > + > + for (int i = 0; strv[i]; i++) { > + QAPI_LIST_APPEND(tail, strv[i]); > + } > + p->has_cpr_exec_args = true; > + break; > + } > default: > assert(0); > } 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 :|