提交 02060be0 编写于 作者: J Jiri Denemark

qemu: Drop qemuMigrationParamsCheckSetupTLS

The code can be merged directly in qemuMigrationParamsAddTLSObjects.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 eb54cb47
......@@ -2042,7 +2042,6 @@ qemuMigrationSrcBegin(virConnectPtr conn,
unsigned long flags)
{
virQEMUDriverPtr driver = conn->privateData;
virQEMUDriverConfigPtr cfg = NULL;
char *xml = NULL;
qemuDomainAsyncJob asyncJob;
......@@ -2076,12 +2075,6 @@ qemuMigrationSrcBegin(virConnectPtr conn,
nmigrate_disks, migrate_disks, flags)))
goto endjob;
if (flags & VIR_MIGRATE_TLS) {
cfg = virQEMUDriverGetConfig(driver);
if (qemuMigrationParamsCheckSetupTLS(driver, cfg, vm, asyncJob) < 0)
goto endjob;
}
if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
/* We keep the job active across API calls until the confirm() call.
* This prevents any other APIs being invoked while migration is taking
......@@ -2098,7 +2091,6 @@ qemuMigrationSrcBegin(virConnectPtr conn,
}
cleanup:
virObjectUnref(cfg);
virDomainObjEndAPI(&vm);
return xml;
......@@ -2460,10 +2452,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
* set the migration TLS parameters */
if (flags & VIR_MIGRATE_TLS) {
cfg = virQEMUDriverGetConfig(driver);
if (qemuMigrationParamsCheckSetupTLS(driver, cfg, vm,
QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
goto stopjob;
if (qemuMigrationParamsAddTLSObjects(driver, vm, cfg, true,
QEMU_ASYNC_JOB_MIGRATION_IN,
&tlsAlias, &secAlias, migParams) < 0)
......@@ -3421,9 +3409,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
if (flags & VIR_MIGRATE_TLS) {
cfg = virQEMUDriverGetConfig(driver);
/* Begin/CheckSetupTLS already set up migTLSAlias, the following
* assumes that and adds the TLS objects to the domain. */
if (qemuMigrationParamsAddTLSObjects(driver, vm, cfg, false,
QEMU_ASYNC_JOB_MIGRATION_OUT,
&tlsAlias, &secAlias, migParams) < 0)
......
......@@ -179,43 +179,48 @@ qemuMigrationParamsCheckTLSCreds(virQEMUDriverPtr driver,
}
/* qemuMigrationParamsCheckSetupTLS
/* qemuMigrationParamsAddTLSObjects
* @driver: pointer to qemu driver
* @vm: domain object
* @cfg: configuration pointer
* @asyncJob: migration job to join
*
* Check if TLS is possible and set up the environment. Assumes the caller
* desires to use TLS (e.g. caller found VIR_MIGRATE_TLS flag).
* @tlsListen: server or client
* @asyncJob: Migration job to join
* @tlsAlias: alias to be generated for TLS object
* @secAlias: alias to be generated for a secinfo object
* @migParams: migration parameters to set
*
* Ensure the qemu.conf has been properly configured to add an entry for
* "migrate_tls_x509_cert_dir". Also check if the "tls-creds" parameter
* was present from a query of migration parameters
* Create the TLS objects for the migration and set the migParams value
*
* Returns 0 on success, -1 on error/failure
* Returns 0 on success, -1 on failure
*/
int
qemuMigrationParamsCheckSetupTLS(virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg,
qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int asyncJob)
virQEMUDriverConfigPtr cfg,
bool tlsListen,
int asyncJob,
char **tlsAlias,
char **secAlias,
qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virJSONValuePtr tlsProps = NULL;
virJSONValuePtr secProps = NULL;
if (!cfg->migrateTLSx509certdir) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("host migration TLS directory not configured"));
return -1;
goto error;
}
if (qemuMigrationParamsCheckTLSCreds(driver, vm, asyncJob) < 0)
return -1;
goto error;
if (!priv->migTLSAlias) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("TLS migration is not supported with this "
"QEMU binary"));
return -1;
goto error;
}
/* If there's a secret, then grab/store it now using the connection */
......@@ -223,39 +228,7 @@ qemuMigrationParamsCheckSetupTLS(virQEMUDriverPtr driver,
!(priv->migSecinfo =
qemuDomainSecretInfoTLSNew(priv, QEMU_MIGRATION_TLS_ALIAS_BASE,
cfg->migrateTLSx509secretUUID)))
return -1;
return 0;
}
/* qemuMigrationParamsAddTLSObjects
* @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
* @secAlias: alias to be generated for a secinfo object
* @migParams: migration parameters to set
*
* Create the TLS objects for the migration and set the migParams value
*
* Returns 0 on success, -1 on failure
*/
int
qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virQEMUDriverConfigPtr cfg,
bool tlsListen,
int asyncJob,
char **tlsAlias,
char **secAlias,
qemuMigrationParamsPtr migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virJSONValuePtr tlsProps = NULL;
virJSONValuePtr secProps = NULL;
goto error;
if (qemuDomainGetTLSObjects(priv->qemuCaps, priv->migSecinfo,
cfg->migrateTLSx509certdir, tlsListen,
......
......@@ -71,12 +71,6 @@ qemuMigrationParamsSet(virQEMUDriverPtr driver,
int asyncJob,
qemuMigrationParamsPtr migParams);
int
qemuMigrationParamsCheckSetupTLS(virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg,
virDomainObjPtr vm,
int asyncJob);
int
qemuMigrationParamsAddTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册