mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migrate: Share common MigrationParameters struct
It is rather verbose, and slightly error-prone, to repeat the same set of parameters for input (migrate-set-parameters) as for output (query-migrate-parameters), where the only difference is whether the members are optional. We can just document that the optional members will always be present on output, and then share a common struct between both commands. The next patch can then reduce the amount of code needed on input. Also, we made a mistake in qemu 2.7 of returning an empty string during 'query-migrate-parameters' when there is no TLS, rather than omitting TLS details entirely. Technically, this change risks breaking any 2.7 client that is hard-coded to expect the parameter's existence; on the other hand, clients that are portable to 2.6 already must be prepared for those members to not be present. And this gets rid of yet one more place where the QMP output visitor is silently converting a NULL string into "" (which is a hack I ultimately want to kill off). Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
bb2b777cf9
commit
de63ab6124
3 changed files with 41 additions and 60 deletions
|
@ -559,12 +559,19 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
|||
MigrationState *s = migrate_get_current();
|
||||
|
||||
params = g_malloc0(sizeof(*params));
|
||||
params->has_compress_level = true;
|
||||
params->compress_level = s->parameters.compress_level;
|
||||
params->has_compress_threads = true;
|
||||
params->compress_threads = s->parameters.compress_threads;
|
||||
params->has_decompress_threads = true;
|
||||
params->decompress_threads = s->parameters.decompress_threads;
|
||||
params->has_cpu_throttle_initial = true;
|
||||
params->cpu_throttle_initial = s->parameters.cpu_throttle_initial;
|
||||
params->has_cpu_throttle_increment = true;
|
||||
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
|
||||
params->has_tls_creds = !!s->parameters.tls_creds;
|
||||
params->tls_creds = g_strdup(s->parameters.tls_creds);
|
||||
params->has_tls_hostname = !!s->parameters.tls_hostname;
|
||||
params->tls_hostname = g_strdup(s->parameters.tls_hostname);
|
||||
|
||||
return params;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue