|
|
3e5111 |
From baf6fbbba2c6cfbf4abe6e038900e9b5b3f8d7e1 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <baf6fbbba2c6cfbf4abe6e038900e9b5b3f8d7e1@dist-git>
|
|
|
3e5111 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
Date: Wed, 5 Apr 2017 13:04:04 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: Simplify qemuMigrationResetTLS
|
|
|
3e5111 |
|
|
|
3e5111 |
It's only called from qemuMigrationReset now so it doesn't need to be
|
|
|
3e5111 |
exported and {tls,sec}Alias are always NULL.
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 4097de405e5ea5fae3867028ee901c03f80eb15b)
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1425003
|
|
|
3e5111 |
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_migration.c | 37 +++++++++++++------------------------
|
|
|
3e5111 |
src/qemu/qemu_migration.h | 7 -------
|
|
|
3e5111 |
2 files changed, 13 insertions(+), 31 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
3e5111 |
index 27156cc78..3e9c35e4c 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_migration.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_migration.c
|
|
|
3e5111 |
@@ -2406,45 +2406,36 @@ qemuMigrationSetParams(virQEMUDriverPtr driver,
|
|
|
3e5111 |
* @driver: pointer to qemu driver
|
|
|
3e5111 |
* @vm: domain object
|
|
|
3e5111 |
* @asyncJob: migration job to join
|
|
|
3e5111 |
- * @tlsAlias: alias generated for TLS object (may be NULL)
|
|
|
3e5111 |
- * @secAlias: alias generated for a secinfo object (may be NULL)
|
|
|
3e5111 |
*
|
|
|
3e5111 |
* Deconstruct all the setup possibly done for TLS - delete the TLS and
|
|
|
3e5111 |
- * security objects, fre the secinfo, and reset the migration params to "".
|
|
|
3e5111 |
+ * security objects, free the secinfo, and reset the migration params to "".
|
|
|
3e5111 |
*
|
|
|
3e5111 |
* Returns 0 on success, -1 on failure
|
|
|
3e5111 |
*/
|
|
|
3e5111 |
-int
|
|
|
3e5111 |
+static int
|
|
|
3e5111 |
qemuMigrationResetTLS(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
- qemuDomainAsyncJob asyncJob,
|
|
|
3e5111 |
- char *in_tlsAlias,
|
|
|
3e5111 |
- char *in_secAlias)
|
|
|
3e5111 |
+ qemuDomainAsyncJob asyncJob)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
3e5111 |
- char *tlsAlias = in_tlsAlias;
|
|
|
3e5111 |
- char *secAlias = in_secAlias;
|
|
|
3e5111 |
+ char *tlsAlias = NULL;
|
|
|
3e5111 |
+ char *secAlias = NULL;
|
|
|
3e5111 |
qemuMonitorMigrationParams migParams = { 0 };
|
|
|
3e5111 |
int ret = -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
- /* If coming from a path that doesn't know whether it's been used or not,
|
|
|
3e5111 |
- * let's first check we need to do this. If the tls-creds doesn't exist
|
|
|
3e5111 |
- * or if they're set to "" then there's nothing to do since we never set
|
|
|
3e5111 |
- * anything up */
|
|
|
3e5111 |
- if (!in_tlsAlias && qemuMigrationCheckTLSCreds(driver, vm, asyncJob) < 0)
|
|
|
3e5111 |
+ if (qemuMigrationCheckTLSCreds(driver, vm, asyncJob) < 0)
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
+ /* If the tls-creds doesn't exist or if they're set to "" then there's
|
|
|
3e5111 |
+ * nothing to do since we never set anything up */
|
|
|
3e5111 |
if (!priv->migTLSAlias || !*priv->migTLSAlias)
|
|
|
3e5111 |
return 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
/* NB: If either or both fail to allocate memory we can still proceed
|
|
|
3e5111 |
* since the next time we migrate another deletion attempt will be
|
|
|
3e5111 |
* made after successfully generating the aliases. */
|
|
|
3e5111 |
- if (!tlsAlias)
|
|
|
3e5111 |
- tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
|
|
|
3e5111 |
- if (!secAlias)
|
|
|
3e5111 |
- secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE,
|
|
|
3e5111 |
- false);
|
|
|
3e5111 |
+ tlsAlias = qemuAliasTLSObjFromSrcAlias(QEMU_MIGRATION_TLS_ALIAS_BASE);
|
|
|
3e5111 |
+ secAlias = qemuDomainGetSecretAESAlias(QEMU_MIGRATION_TLS_ALIAS_BASE, false);
|
|
|
3e5111 |
|
|
|
3e5111 |
qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
|
|
|
3e5111 |
qemuDomainSecretInfoFree(&priv->migSecinfo);
|
|
|
3e5111 |
@@ -2457,10 +2448,8 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
|
|
|
3e5111 |
ret = 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
cleanup:
|
|
|
3e5111 |
- if (!in_tlsAlias)
|
|
|
3e5111 |
- VIR_FREE(tlsAlias);
|
|
|
3e5111 |
- if (!in_secAlias)
|
|
|
3e5111 |
- VIR_FREE(secAlias);
|
|
|
3e5111 |
+ VIR_FREE(tlsAlias);
|
|
|
3e5111 |
+ VIR_FREE(secAlias);
|
|
|
3e5111 |
qemuMigrationParamsClear(&migParams);
|
|
|
3e5111 |
|
|
|
3e5111 |
return ret;
|
|
|
3e5111 |
@@ -5887,6 +5876,6 @@ qemuMigrationReset(virQEMUDriverPtr driver,
|
|
|
3e5111 |
if (!virDomainObjIsActive(vm))
|
|
|
3e5111 |
return;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (qemuMigrationResetTLS(driver, vm, job, NULL, NULL) < 0)
|
|
|
3e5111 |
+ if (qemuMigrationResetTLS(driver, vm, job) < 0)
|
|
|
3e5111 |
return;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
|
|
|
3e5111 |
index 28eb55056..b392b8fff 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_migration.h
|
|
|
3e5111 |
+++ b/src/qemu/qemu_migration.h
|
|
|
3e5111 |
@@ -278,13 +278,6 @@ int qemuMigrationRunIncoming(virQEMUDriverPtr driver,
|
|
|
3e5111 |
void qemuMigrationPostcopyFailed(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm);
|
|
|
3e5111 |
|
|
|
3e5111 |
-int
|
|
|
3e5111 |
-qemuMigrationResetTLS(virQEMUDriverPtr driver,
|
|
|
3e5111 |
- virDomainObjPtr vm,
|
|
|
3e5111 |
- qemuDomainAsyncJob asyncJob,
|
|
|
3e5111 |
- char *in_tlsAlias,
|
|
|
3e5111 |
- char *in_secAlias);
|
|
|
3e5111 |
-
|
|
|
3e5111 |
void
|
|
|
3e5111 |
qemuMigrationReset(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|