migration: Clean up around tls_creds, tls_hostname

Optional MigrationParameters members tls_creds and tls_hostname can't
actually be absent outside qmp_migrate_set_parameters() since commit
4af245d (v2.9.0).

Note that commit 4af245d reverted the part of commit de63ab6 (v2.8.0)
that made tls_creds and tls_hostname absent instead of "" in the value
of query-migrate-parameters, even though commit de63ab6 called that a
mistake.  What a mess.

Drop the redundant tests for presence, and update documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Markus Armbruster 2017-07-18 12:04:54 +02:00
parent 7e91e82044
commit 8cc99dcdc2
3 changed files with 11 additions and 10 deletions

6
hmp.c
View file

@ -313,12 +313,14 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%s: %" PRId64 "\n", monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT], MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
params->cpu_throttle_increment); params->cpu_throttle_increment);
assert(params->has_tls_creds);
monitor_printf(mon, "%s: '%s'\n", monitor_printf(mon, "%s: '%s'\n",
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS], MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
params->has_tls_creds ? params->tls_creds : ""); params->tls_creds);
assert(params->has_tls_hostname);
monitor_printf(mon, "%s: '%s'\n", monitor_printf(mon, "%s: '%s'\n",
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME], MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
params->has_tls_hostname ? params->tls_hostname : ""); params->tls_hostname);
assert(params->has_max_bandwidth); assert(params->has_max_bandwidth);
monitor_printf(mon, "%s: %" PRId64 " bytes/second\n", monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH], MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],

View file

@ -444,9 +444,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
params->cpu_throttle_initial = s->parameters.cpu_throttle_initial; params->cpu_throttle_initial = s->parameters.cpu_throttle_initial;
params->has_cpu_throttle_increment = true; params->has_cpu_throttle_increment = true;
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment; params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
params->has_tls_creds = !!s->parameters.tls_creds; params->has_tls_creds = true;
params->tls_creds = g_strdup(s->parameters.tls_creds); params->tls_creds = g_strdup(s->parameters.tls_creds);
params->has_tls_hostname = !!s->parameters.tls_hostname; params->has_tls_hostname = true;
params->tls_hostname = g_strdup(s->parameters.tls_hostname); params->tls_hostname = g_strdup(s->parameters.tls_hostname);
params->has_max_bandwidth = true; params->has_max_bandwidth = true;
params->max_bandwidth = s->parameters.max_bandwidth; params->max_bandwidth = s->parameters.max_bandwidth;

View file

@ -1054,9 +1054,7 @@
# @MigrationParameters: # @MigrationParameters:
# #
# Optional members can be omitted on input ('migrate-set-parameters') # Optional members can be omitted on input ('migrate-set-parameters')
# but most members will always be present on output # but members will always be present on output.
# ('query-migrate-parameters'), with the exception of tls-creds and
# tls-hostname.
# #
# @compress-level: compression level # @compress-level: compression level
# #
@ -1077,10 +1075,10 @@
# channel. On the outgoing side of the migration, the credentials # channel. On the outgoing side of the migration, the credentials
# must be for a 'client' endpoint, while for the incoming side the # must be for a 'client' endpoint, while for the incoming side the
# credentials must be for a 'server' endpoint. Setting this # credentials must be for a 'server' endpoint. Setting this
# will enable TLS for all migrations. The default is unset, # to a non-empty string enables TLS for all migrations.
# resulting in unsecured migration at the QEMU level. (Since 2.7)
# An empty string means that QEMU will use plain text mode for # An empty string means that QEMU will use plain text mode for
# migration, rather than TLS (Since 2.9) # migration, rather than TLS (Since 2.7)
# Note: 2.8 reports this by omitting tls-creds instead.
# #
# @tls-hostname: hostname of the target host for the migration. This # @tls-hostname: hostname of the target host for the migration. This
# is required when using x509 based TLS credentials and the # is required when using x509 based TLS credentials and the
@ -1090,6 +1088,7 @@
# certificate identity can be validated. (Since 2.7) # certificate identity can be validated. (Since 2.7)
# An empty string means that QEMU will use the hostname # An empty string means that QEMU will use the hostname
# associated with the migration URI, if any. (Since 2.9) # associated with the migration URI, if any. (Since 2.9)
# Note: 2.8 reports this by omitting tls-hostname instead.
# #
# @max-bandwidth: to set maximum speed for migration. maximum speed in # @max-bandwidth: to set maximum speed for migration. maximum speed in
# bytes per second. (Since 2.8) # bytes per second. (Since 2.8)