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);
|
virDomainUSBAddressSetFree(priv->usbaddrs);
|
||||||
priv->usbaddrs = NULL;
|
priv->usbaddrs = NULL;
|
||||||
|
|
||||||
/* clean up migration data */
|
|
||||||
VIR_FREE(priv->migTLSAlias);
|
|
||||||
virCPUDefFree(priv->origCPU);
|
virCPUDefFree(priv->origCPU);
|
||||||
priv->origCPU = NULL;
|
priv->origCPU = NULL;
|
||||||
|
|
||||||
|
@ -330,10 +330,6 @@ struct _qemuDomainObjPrivate {
|
|||||||
/* private XML). */
|
/* private XML). */
|
||||||
qemuDomainSecretInfoPtr migSecinfo;
|
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
|
/* CPU def used to start the domain when it differs from the one actually
|
||||||
* provided by QEMU. */
|
* provided by QEMU. */
|
||||||
virCPUDefPtr origCPU;
|
virCPUDefPtr origCPU;
|
||||||
|
@ -2462,9 +2462,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
|
|||||||
goto stopjob;
|
goto stopjob;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (qemuMigrationParamsSetEmptyTLS(driver, vm,
|
if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
|
||||||
QEMU_ASYNC_JOB_MIGRATION_IN,
|
|
||||||
migParams) < 0)
|
|
||||||
goto stopjob;
|
goto stopjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3426,9 +3424,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (qemuMigrationParamsSetEmptyTLS(driver, vm,
|
if (qemuMigrationParamsSetEmptyTLS(vm, migParams) < 0)
|
||||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
|
||||||
migParams) < 0)
|
|
||||||
goto error;
|
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
|
/* qemuMigrationParamsAddTLSObjects
|
||||||
* @driver: pointer to qemu driver
|
* @driver: pointer to qemu driver
|
||||||
* @vm: domain object
|
* @vm: domain object
|
||||||
@ -213,10 +167,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
|
if ((!priv->job.migParams->params.tlsCreds)) {
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!priv->migTLSAlias) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("TLS migration is not supported with this "
|
_("TLS migration is not supported with this "
|
||||||
"QEMU binary"));
|
"QEMU binary"));
|
||||||
@ -260,9 +211,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
|
|
||||||
/* qemuMigrationParamsSetEmptyTLS
|
/* qemuMigrationParamsSetEmptyTLS
|
||||||
* @driver: pointer to qemu driver
|
|
||||||
* @vm: domain object
|
* @vm: domain object
|
||||||
* @asyncJob: migration job to join
|
|
||||||
* @migParams: Pointer to a migration parameters block
|
* @migParams: Pointer to a migration parameters block
|
||||||
*
|
*
|
||||||
* If we support setting the tls-creds, then set both tls-creds and
|
* 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
|
* Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
|
qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
|
||||||
virDomainObjPtr vm,
|
|
||||||
int asyncJob,
|
|
||||||
qemuMigrationParamsPtr migParams)
|
qemuMigrationParamsPtr migParams)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
|
||||||
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
|
if (!priv->job.migParams->params.tlsCreds)
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!priv->migTLSAlias)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
|
if (VIR_STRDUP(migParams->params.tlsCreds, "") < 0 ||
|
||||||
|
@ -82,9 +82,7 @@ qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
|
|||||||
qemuMigrationParamsPtr migParams);
|
qemuMigrationParamsPtr migParams);
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMigrationParamsSetEmptyTLS(virQEMUDriverPtr driver,
|
qemuMigrationParamsSetEmptyTLS(virDomainObjPtr vm,
|
||||||
virDomainObjPtr vm,
|
|
||||||
int asyncJob,
|
|
||||||
qemuMigrationParamsPtr migParams);
|
qemuMigrationParamsPtr migParams);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user