unsigned long flags)
{
virQEMUDriverPtr driver = conn->privateData;
- virQEMUDriverConfigPtr cfg = NULL;
char *xml = NULL;
qemuDomainAsyncJob asyncJob;
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
}
cleanup:
- virObjectUnref(cfg);
virDomainObjEndAPI(&vm);
return xml;
* 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)
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)
}
-/* 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 */
!(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,