mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Set tlsHostname inside qemuMigrationParamsEnableTLS
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a2fae62775
commit
312fe9ccca
@ -2454,13 +2454,9 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||||||
cfg = virQEMUDriverGetConfig(driver);
|
cfg = virQEMUDriverGetConfig(driver);
|
||||||
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, true,
|
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, true,
|
||||||
QEMU_ASYNC_JOB_MIGRATION_IN,
|
QEMU_ASYNC_JOB_MIGRATION_IN,
|
||||||
&tlsAlias, &secAlias, migParams) < 0)
|
&tlsAlias, &secAlias, NULL,
|
||||||
|
migParams) < 0)
|
||||||
goto stopjob;
|
goto stopjob;
|
||||||
|
|
||||||
/* Force reset of 'tls-hostname', it's a source only parameter */
|
|
||||||
if (VIR_STRDUP(migParams->params.tlsHostname, "") < 0)
|
|
||||||
goto stopjob;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (qemuMigrationParamsDisableTLS(vm, migParams) < 0)
|
if (qemuMigrationParamsDisableTLS(vm, migParams) < 0)
|
||||||
goto stopjob;
|
goto stopjob;
|
||||||
@ -3406,23 +3402,20 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
|||||||
VIR_WARN("unable to provide data for graphics client relocation");
|
VIR_WARN("unable to provide data for graphics client relocation");
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_TLS) {
|
if (flags & VIR_MIGRATE_TLS) {
|
||||||
cfg = virQEMUDriverGetConfig(driver);
|
const char *hostname = NULL;
|
||||||
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, false,
|
|
||||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
|
||||||
&tlsAlias, &secAlias, migParams) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* We need to add tls-hostname whenever QEMU itself does not
|
/* We need to add tls-hostname whenever QEMU itself does not
|
||||||
* connect directly to the destination. */
|
* connect directly to the destination. */
|
||||||
if (spec->destType == MIGRATION_DEST_CONNECT_HOST ||
|
if (spec->destType == MIGRATION_DEST_CONNECT_HOST ||
|
||||||
spec->destType == MIGRATION_DEST_FD) {
|
spec->destType == MIGRATION_DEST_FD)
|
||||||
if (VIR_STRDUP(migParams->params.tlsHostname, spec->dest.host.name) < 0)
|
hostname = spec->dest.host.name;
|
||||||
goto error;
|
|
||||||
} else {
|
cfg = virQEMUDriverGetConfig(driver);
|
||||||
/* Be sure there's nothing from a previous migration */
|
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, false,
|
||||||
if (VIR_STRDUP(migParams->params.tlsHostname, "") < 0)
|
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||||
goto error;
|
&tlsAlias, &secAlias, hostname,
|
||||||
}
|
migParams) < 0)
|
||||||
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (qemuMigrationParamsDisableTLS(vm, migParams) < 0)
|
if (qemuMigrationParamsDisableTLS(vm, migParams) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -141,9 +141,12 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
|
|||||||
* @asyncJob: Migration job to join
|
* @asyncJob: Migration job to join
|
||||||
* @tlsAlias: alias to be generated for TLS object
|
* @tlsAlias: alias to be generated for TLS object
|
||||||
* @secAlias: alias to be generated for a secinfo object
|
* @secAlias: alias to be generated for a secinfo object
|
||||||
|
* @hostname: hostname of the migration destination
|
||||||
* @migParams: migration parameters to set
|
* @migParams: migration parameters to set
|
||||||
*
|
*
|
||||||
* Create the TLS objects for the migration and set the migParams value
|
* Create the TLS objects for the migration and set the migParams value.
|
||||||
|
* If QEMU itself does not connect to the destination @hostname must be
|
||||||
|
* provided for certificate verification.
|
||||||
*
|
*
|
||||||
* Returns 0 on success, -1 on failure
|
* Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
@ -155,6 +158,7 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
|||||||
int asyncJob,
|
int asyncJob,
|
||||||
char **tlsAlias,
|
char **tlsAlias,
|
||||||
char **secAlias,
|
char **secAlias,
|
||||||
|
const char *hostname,
|
||||||
qemuMigrationParamsPtr migParams)
|
qemuMigrationParamsPtr migParams)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
@ -198,7 +202,8 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
|||||||
*tlsAlias, &tlsProps) < 0)
|
*tlsAlias, &tlsProps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_STRDUP(migParams->params.tlsCreds, *tlsAlias) < 0)
|
if (VIR_STRDUP(migParams->params.tlsCreds, *tlsAlias) < 0 ||
|
||||||
|
VIR_STRDUP(migParams->params.tlsHostname, hostname ? hostname : "") < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -79,6 +79,7 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
|||||||
int asyncJob,
|
int asyncJob,
|
||||||
char **tlsAlias,
|
char **tlsAlias,
|
||||||
char **secAlias,
|
char **secAlias,
|
||||||
|
const char *hostname,
|
||||||
qemuMigrationParamsPtr migParams);
|
qemuMigrationParamsPtr migParams);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user