migration: define 'tls-creds' and 'tls-hostname' migration parameters

Define two new migration parameters to be used with TLS encryption.
The 'tls-creds' parameter provides the ID of an instance of the
'tls-creds' object type, or rather a subclass such as 'tls-creds-x509'.
Providing these credentials will enable use of TLS on the migration
data stream.

If using x509 certificates, together with a migration URI that does
not include a hostname, the 'tls-hostname' parameter provides the
hostname to use when verifying the server's x509 certificate. This
allows TLS to be used in combination with fd: and exec: protocols
where a TCP connection is established by a 3rd party outside of
QEMU.

NB, this requires changing the migrate_set_parameter method in the
HMP to accept a 's' (string) value instead of 'i' (integer). This
is backwards compatible, because the parsing of strings allows the
quotes to be optional, thus any integer is also a valid string.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1461751518-12128-26-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
Daniel P. Berrange 2016-04-27 11:05:15 +01:00 committed by Amit Shah
parent 2594f56d4c
commit 69ef1f36b0
4 changed files with 108 additions and 10 deletions

View file

@ -536,6 +536,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
params->decompress_threads = s->parameters.decompress_threads;
params->cpu_throttle_initial = s->parameters.cpu_throttle_initial;
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
params->tls_creds = g_strdup(s->parameters.tls_creds);
params->tls_hostname = g_strdup(s->parameters.tls_hostname);
return params;
}
@ -737,6 +739,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
int64_t cpu_throttle_initial,
bool has_cpu_throttle_increment,
int64_t cpu_throttle_increment,
bool has_tls_creds,
const char *tls_creds,
bool has_tls_hostname,
const char *tls_hostname,
Error **errp)
{
MigrationState *s = migrate_get_current();
@ -788,6 +794,14 @@ void qmp_migrate_set_parameters(bool has_compress_level,
if (has_cpu_throttle_increment) {
s->parameters.cpu_throttle_increment = cpu_throttle_increment;
}
if (has_tls_creds) {
g_free(s->parameters.tls_creds);
s->parameters.tls_creds = g_strdup(tls_creds);
}
if (has_tls_hostname) {
g_free(s->parameters.tls_hostname);
s->parameters.tls_hostname = g_strdup(tls_hostname);
}
}