diff options
author | Eric Blake <eblake@redhat.com> | 2016-09-08 22:14:15 -0500 |
---|---|---|
committer | Juan Quintela <quintela@trasno.org> | 2016-10-13 17:23:53 +0200 |
commit | de63ab61241b44598cdfd30060ef23d46d368f9d (patch) | |
tree | bad73f323cbab948879b2c5534384790b5032d2e /migration/migration.c | |
parent | bb2b777cf9a2862fe31a40256659ff49ae3d2006 (diff) | |
download | qemu-de63ab61241b44598cdfd30060ef23d46d368f9d.zip |
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>
Diffstat (limited to 'migration/migration.c')
-rw-r--r-- | migration/migration.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c index 955d5ee38c..1a8f26b3e9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -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; |