mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Drop qemuMigrationParamsCheckTLSCreds
The function checks whether QEMU supports TLS migration and stores the original value of tls-creds parameter to priv->migTLSAlias. This is no longer needed because we already have the original value stored in priv->migParams. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
02060be08e
commit
2781197c13
@ -1905,8 +1905,6 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
|
||||
virDomainUSBAddressSetFree(priv->usbaddrs);
|
||||
priv->usbaddrs = NULL;
|
||||
|
||||
/* clean up migration data */
|
||||
VIR_FREE(priv->migTLSAlias);
|
||||
virCPUDefFree(priv->origCPU);
|
||||
priv->origCPU = NULL;
|
||||
|
||||
|
@ -330,10 +330,6 @@ struct _qemuDomainObjPrivate {
|
||||
/* private XML). */
|
||||
qemuDomainSecretInfoPtr migSecinfo;
|
||||
|
||||
/* Used when fetching/storing the current 'tls-creds' migration setting */
|
||||
/* (not to be saved in our private XML). */
|
||||
char *migTLSAlias;
|
||||
|
||||
/* CPU def used to start the domain when it differs from the one actually
|
||||
* provided by QEMU. */
|
||||
virCPUDefPtr origCPU;
|
||||
|
@ -2462,9 +2462,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
||||
goto stopjob;
|
||||
|
||||
} else {
|
||||
if (qemuMigrationParamsSetEmptyTLS(driver, vm,
|
||||
QEMU_ASYNC_JOB_MIGRATION_IN,
|
||||
migParams) < 0)
|
||||
if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
|
||||
goto stopjob;
|
||||
}
|
||||
|
||||
@ -3426,9 +3424,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (qemuMigrationParamsSetEmptyTLS(driver, vm,
|
||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
migParams) < 0)
|
||||
if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -133,52 +133,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
/* qemuMigrationParamsCheckTLSCreds
|
||||
* @driver: pointer to qemu driver
|
||||
* @vm: domain object
|
||||
* @asyncJob: migration job to join
|
||||
*
|
||||
* Query the migration parameters looking for the 'tls-creds' parameter.
|
||||
* If found, then we can support setting or clearing the parameters and thus
|
||||
* can support TLS for migration.
|
||||
*
|
||||
* Returns 0 if we were able to successfully fetch the params and
|
||||
* additionally if the tls-creds parameter exists, saves it in the
|
||||
* private domain structure. Returns -1 on failure.
|
||||
*/
|
||||
static int
|
||||
qemuMigrationParamsCheckTLSCreds(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int asyncJob)
|
||||
{
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
if (!(migParams = qemuMigrationParamsNew()))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorGetMigrationParams(priv->mon, &migParams->params) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* NB: Could steal NULL pointer too! Let caller decide what to do. */
|
||||
VIR_STEAL_PTR(priv->migTLSAlias, migParams->params.tlsCreds);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
|
||||
qemuMigrationParamsFree(migParams);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* qemuMigrationParamsAddTLSObjects
|
||||
* @driver: pointer to qemu driver
|
||||
* @vm: domain object
|
||||
@ -213,10 +167,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
|
||||
goto error;
|
||||
|
||||
if (!priv->migTLSAlias) {
|
||||
if ((!priv->job.migParams->params.tlsCreds)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("TLS migration is not supported with this "
|
||||
"QEMU binary"));
|
||||
@ -260,9 +211,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
||||
|
||||
|
||||
/* qemuMigrationParamsSetEmptyTLS
|
||||
* @driver: pointer to qemu driver
|
||||
* @vm: domain object
|
||||
* @asyncJob: migration job to join
|
||||
* @migParams: Pointer to a migration parameters block
|
||||
*
|
||||
* If we support setting the tls-creds, then set both tls-creds and
|
||||
@ -272,17 +221,12 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
||||
* Returns 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int asyncJob,
|
||||
qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
|
||||
qemuMigrationParamsPtr migParams)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
if (!priv->migTLSAlias)
|
||||
if (!priv->job.migParams->params.tlsCreds)
|
||||
return 0;
|
||||
|
||||
if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
|
||||
|
@ -82,9 +82,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
||||
qemuMigrationParamsPtr migParams);
|
||||
|
||||
int
|
||||
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int asyncJob,
|
||||
qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
|
||||
qemuMigrationParamsPtr migParams);
|
||||
|
||||
int
|
||||
|
Loading…
x
Reference in New Issue
Block a user