[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 15/19] migration: Export tls-[creds|hostname|authz] params to
From: |
Peter Xu |
Subject: |
[PATCH v4 15/19] migration: Export tls-[creds|hostname|authz] params to cmdline too |
Date: |
Thu, 31 Mar 2022 11:08:53 -0400 |
It's useful for specifying tls credentials all in the cmdline (along with
the -object tls-creds-*), especially for debugging purpose.
The trick here is we must remember to not free these fields again in the
finalize() function of migration object, otherwise it'll cause double-free.
The thing is when destroying an object, we'll first destroy the properties
that bound to the object, then the object itself. To be explicit, when
destroy the object in object_finalize() we have such sequence of
operations:
object_property_del_all(obj);
object_deinit(obj, ti);
So after this change the two fields are properly released already even
before reaching the finalize() function but in object_property_del_all(),
hence we don't need to free them anymore in finalize() or it's double-free.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/migration.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 899084f993..1dc80be1f4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -4349,6 +4349,9 @@ static Property migration_properties[] = {
DEFAULT_MIGRATE_ANNOUNCE_STEP),
DEFINE_PROP_BOOL("x-postcopy-preempt-break-huge", MigrationState,
postcopy_preempt_break_huge, true),
+ DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds),
+ DEFINE_PROP_STRING("tls-hostname", MigrationState,
parameters.tls_hostname),
+ DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz),
/* Migration capabilities */
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
@@ -4382,12 +4385,9 @@ static void migration_class_init(ObjectClass *klass,
void *data)
static void migration_instance_finalize(Object *obj)
{
MigrationState *ms = MIGRATION_OBJ(obj);
- MigrationParameters *params = &ms->parameters;
qemu_mutex_destroy(&ms->error_mutex);
qemu_mutex_destroy(&ms->qemu_file_lock);
- g_free(params->tls_hostname);
- g_free(params->tls_creds);
qemu_sem_destroy(&ms->wait_unplug_sem);
qemu_sem_destroy(&ms->rate_limit_sem);
qemu_sem_destroy(&ms->pause_sem);
--
2.32.0
- [PATCH v4 06/19] migration: Move channel setup out of postcopy_try_recover(), (continued)
- [PATCH v4 06/19] migration: Move channel setup out of postcopy_try_recover(), Peter Xu, 2022/03/31
- [PATCH v4 04/19] migration: Move migrate_allow_multifd and helpers into migration.c, Peter Xu, 2022/03/31
- [PATCH v4 05/19] migration: Export ram_load_postcopy(), Peter Xu, 2022/03/31
- [PATCH v4 07/19] migration: Allow migrate-recover to run multiple times, Peter Xu, 2022/03/31
- [PATCH v4 09/19] migration: Postcopy preemption preparation on channel creation, Peter Xu, 2022/03/31
- [PATCH v4 08/19] migration: Add postcopy-preempt capability, Peter Xu, 2022/03/31
- [PATCH v4 12/19] migration: Create the postcopy preempt channel asynchronously, Peter Xu, 2022/03/31
- [PATCH v4 11/19] migration: Postcopy recover with preempt enabled, Peter Xu, 2022/03/31
- [PATCH v4 14/19] migration: Add helpers to detect TLS capability, Peter Xu, 2022/03/31
- [PATCH v4 17/19] tests: Add postcopy tls migration test, Peter Xu, 2022/03/31
- [PATCH v4 15/19] migration: Export tls-[creds|hostname|authz] params to cmdline too,
Peter Xu <=
- [PATCH v4 10/19] migration: Postcopy preemption enablement, Peter Xu, 2022/03/31
- [PATCH v4 18/19] tests: Add postcopy tls recovery migration test, Peter Xu, 2022/03/31
- [PATCH v4 13/19] migration: Parameter x-postcopy-preempt-break-huge, Peter Xu, 2022/03/31
- [PATCH v4 03/19] migration: Add pss.postcopy_requested status, Peter Xu, 2022/03/31
- [PATCH v4 01/19] migration: Postpone releasing MigrationState.hostname, Peter Xu, 2022/03/31
- [PATCH v4 02/19] migration: Drop multifd tls_hostname cache, Peter Xu, 2022/03/31
- [PATCH v4 19/19] tests: Add postcopy preempt tests, Peter Xu, 2022/03/31
- [PATCH v4 16/19] migration: Enable TLS for preempt channel, Peter Xu, 2022/03/31