mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu: Hide cfg inside qemuMigrationParamsEnableTLS
There's no real reason for qemuMigrationParamsEnableTLS to require the callers to pass a valid virQEMUDriverConfigPtr, it can just call virQEMUDriverGetConfig. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
312fe9ccca
commit
0beaadfa6e
@ -2228,7 +2228,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
||||
{
|
||||
virDomainObjPtr vm = NULL;
|
||||
virObjectEventPtr event = NULL;
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
int ret = -1;
|
||||
int dataFD[2] = { -1, -1 };
|
||||
qemuDomainObjPrivatePtr priv = NULL;
|
||||
@ -2451,8 +2450,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
||||
/* Migrations using TLS need to add the "tls-creds-x509" object and
|
||||
* set the migration TLS parameters */
|
||||
if (flags & VIR_MIGRATE_TLS) {
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, true,
|
||||
if (qemuMigrationParamsEnableTLS(driver, vm, true,
|
||||
QEMU_ASYNC_JOB_MIGRATION_IN,
|
||||
&tlsAlias, &secAlias, NULL,
|
||||
migParams) < 0)
|
||||
@ -2549,7 +2547,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
||||
cleanup:
|
||||
VIR_FREE(tlsAlias);
|
||||
VIR_FREE(secAlias);
|
||||
virObjectUnref(cfg);
|
||||
qemuProcessIncomingDefFree(incoming);
|
||||
VIR_FREE(xmlout);
|
||||
VIR_FORCE_CLOSE(dataFD[0]);
|
||||
@ -3330,7 +3327,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned int migrate_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuMigrationCookiePtr mig = NULL;
|
||||
char *tlsAlias = NULL;
|
||||
@ -3410,8 +3406,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
spec->destType == MIGRATION_DEST_FD)
|
||||
hostname = spec->dest.host.name;
|
||||
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
if (qemuMigrationParamsEnableTLS(driver, vm, cfg, false,
|
||||
if (qemuMigrationParamsEnableTLS(driver, vm, false,
|
||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
&tlsAlias, &secAlias, hostname,
|
||||
migParams) < 0)
|
||||
@ -3649,7 +3644,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
cleanup:
|
||||
VIR_FREE(tlsAlias);
|
||||
VIR_FREE(secAlias);
|
||||
virObjectUnref(cfg);
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
virDomainDefFree(persistDef);
|
||||
qemuMigrationCookieFree(mig);
|
||||
|
@ -136,7 +136,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
|
||||
/* qemuMigrationParamsEnableTLS
|
||||
* @driver: pointer to qemu driver
|
||||
* @vm: domain object
|
||||
* @cfg: configuration pointer
|
||||
* @tlsListen: server or client
|
||||
* @asyncJob: Migration job to join
|
||||
* @tlsAlias: alias to be generated for TLS object
|
||||
@ -153,7 +152,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
|
||||
int
|
||||
qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virQEMUDriverConfigPtr cfg,
|
||||
bool tlsListen,
|
||||
int asyncJob,
|
||||
char **tlsAlias,
|
||||
@ -164,6 +162,8 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virJSONValuePtr tlsProps = NULL;
|
||||
virJSONValuePtr secProps = NULL;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
int ret = -1;
|
||||
|
||||
if (!cfg->migrateTLSx509certdir) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
@ -206,12 +206,16 @@ qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
||||
VIR_STRDUP(migParams->params.tlsHostname, hostname ? hostname : "") < 0)
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
|
||||
error:
|
||||
virJSONValueFree(tlsProps);
|
||||
virJSONValueFree(secProps);
|
||||
return -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
|
||||
int
|
||||
qemuMigrationParamsEnableTLS(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virQEMUDriverConfigPtr cfg,
|
||||
bool tlsListen,
|
||||
int asyncJob,
|
||||
char **tlsAlias,
|
||||
|
Loading…
Reference in New Issue
Block a user