mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
migration: Export tls-[creds|hostname|authz] params to cmdline too
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.
This also fixes a trivial memory leak for tls-authz as we forgot to free it
before this patch.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220707185515.27475-1-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
committed by
Dr. David Alan Gilbert
parent
85a8578ea5
commit
9a26662752
@@ -4366,6 +4366,9 @@ static Property migration_properties[] = {
|
|||||||
DEFAULT_MIGRATE_ANNOUNCE_STEP),
|
DEFAULT_MIGRATE_ANNOUNCE_STEP),
|
||||||
DEFINE_PROP_BOOL("x-postcopy-preempt-break-huge", MigrationState,
|
DEFINE_PROP_BOOL("x-postcopy-preempt-break-huge", MigrationState,
|
||||||
postcopy_preempt_break_huge, true),
|
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 */
|
/* Migration capabilities */
|
||||||
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
|
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
|
||||||
@@ -4403,12 +4406,9 @@ static void migration_class_init(ObjectClass *klass, void *data)
|
|||||||
static void migration_instance_finalize(Object *obj)
|
static void migration_instance_finalize(Object *obj)
|
||||||
{
|
{
|
||||||
MigrationState *ms = MIGRATION_OBJ(obj);
|
MigrationState *ms = MIGRATION_OBJ(obj);
|
||||||
MigrationParameters *params = &ms->parameters;
|
|
||||||
|
|
||||||
qemu_mutex_destroy(&ms->error_mutex);
|
qemu_mutex_destroy(&ms->error_mutex);
|
||||||
qemu_mutex_destroy(&ms->qemu_file_lock);
|
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->wait_unplug_sem);
|
||||||
qemu_sem_destroy(&ms->rate_limit_sem);
|
qemu_sem_destroy(&ms->rate_limit_sem);
|
||||||
qemu_sem_destroy(&ms->pause_sem);
|
qemu_sem_destroy(&ms->pause_sem);
|
||||||
|
|||||||
Reference in New Issue
Block a user