Re: [libvirt] [PATCH v2 72/73] qemu: Don't delete TLS objects unless TLS migration was requested

2018-04-16 Thread Ján Tomko

On Wed, Apr 11, 2018 at 04:42:02PM +0200, Jiri Denemark wrote:

Trying to delete the non-existent TLS objects results in ugly error
messages in the log, which could easily confuse users. Let's avoid this
confusion by not trying to delete the objects if we were not asked to
enable TLS migration and thus we didn't created the objects anyway.

This patch restores the behavior to the state before "qemu: Reset all
migration parameters".


Finally. The suspense was killing me.



Signed-off-by: Jiri Denemark 
---
src/qemu/qemu_migration.c| 12 ++--
src/qemu/qemu_migration_params.c | 18 --
src/qemu/qemu_migration_params.h |  3 ++-
src/qemu/qemu_process.c  |  6 --
4 files changed, 24 insertions(+), 15 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 72/73] qemu: Don't delete TLS objects unless TLS migration was requested

2018-04-15 Thread Jiri Denemark
Trying to delete the non-existent TLS objects results in ugly error
messages in the log, which could easily confuse users. Let's avoid this
confusion by not trying to delete the objects if we were not asked to
enable TLS migration and thus we didn't created the objects anyway.

This patch restores the behavior to the state before "qemu: Reset all
migration parameters".

Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_migration.c| 12 ++--
 src/qemu/qemu_migration_params.c | 18 --
 src/qemu/qemu_migration_params.h |  3 ++-
 src/qemu/qemu_process.c  |  6 --
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ad87aebd3b..bee5fe983e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1771,7 +1771,7 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
  " domain was successfully started on destination or not",
  vm->def->name);
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 /* clear the job and let higher levels decide what to do */
 qemuDomainObjDiscardAsyncJob(driver, vm);
 break;
@@ -2500,7 +2500,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
 
  stopjob:
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 
 if (stopProcess) {
 unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED;
@@ -2870,7 +2870,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
 }
 
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 
 if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, 
driver->caps) < 0)
 VIR_WARN("Failed to save status on vm %s", vm->def->name);
@@ -4497,7 +4497,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
  */
 if (!v3proto && ret < 0)
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 
 if (qemuMigrationSrcRestoreDomainState(driver, vm)) {
 event = virDomainEventLifecycleNewFromObj(vm,
@@ -4586,7 +4586,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
  endjob:
 if (ret < 0) {
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 qemuMigrationJobFinish(driver, vm);
 } else {
 qemuMigrationJobContinue(vm);
@@ -5044,7 +5044,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
 }
 
 qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
- priv->job.migParams);
+ priv->job.migParams, priv->job.apiFlags);
 
 qemuMigrationJobFinish(driver, vm);
 if (!virDomainObjIsActive(vm))
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 8af6d8ad0e..4f3b239637 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -899,6 +899,7 @@ qemuMigrationParamsDisableTLS(virDomainObjPtr vm,
  * @driver: pointer to qemu driver
  * @vm: domain object
  * @asyncJob: migration job to join
+ * @apiFlags: API flags used to start the migration
  *
  * Deconstruct all the setup possibly done for TLS - delete the TLS and
  * security objects, free the secinfo, and reset the migration params to "".
@@ -907,13 +908,16 @@ static void
 qemuMigrationParamsResetTLS(virQEMUDriverPtr driver,
 virDomainObjPtr vm,
 int asyncJob,
-qemuMigrationParamsPtr origParams)
+qemuMigrationParamsPtr origParams,
+unsigned long apiFlags)
 {
 char *tlsAlias = NULL;
 char *secAlias = NULL;
 
-/* If QEMU does not support TLS migration we didn't set the aliases. */
-if (!origParams->params[QEMU_MIGRATION_PARAM_TLS_CREDS].set)
+/* There's nothing to do if QEMU does not support TLS migration or we were
+ * not asked to enable it. */
+if (!origParams->params[QEMU_MIGRATION_PARAM_TLS_CREDS].set ||
+!(apiFlags & VIR_MIGRATE_TLS))
 return;
 
 /* NB: If either or both fail to allocate memory we can still proceed
@@ -1081,11 +1085,13 @@ void
 qemuMigrationParamsReset(virQEMUDriverPtr driver,
  virDomainObjPtr vm,