From nobody Thu Nov 6 17:05:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488371767898354.00904157374566; Wed, 1 Mar 2017 04:36:07 -0800 (PST) Received: from localhost ([::1]:46020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj3UD-00083J-6g for importer@patchew.org; Wed, 01 Mar 2017 07:36:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj3Qo-0004aV-KG for qemu-devel@nongnu.org; Wed, 01 Mar 2017 07:32:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cj3Qk-0002oR-PG for qemu-devel@nongnu.org; Wed, 01 Mar 2017 07:32:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cj3Qk-0002nO-Iy for qemu-devel@nongnu.org; Wed, 01 Mar 2017 07:32:30 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F2DB8047F for ; Wed, 1 Mar 2017 12:32:30 +0000 (UTC) Received: from t460.redhat.com (ovpn-117-132.ams2.redhat.com [10.36.117.132]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v21CWSov003660; Wed, 1 Mar 2017 07:32:28 -0500 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Wed, 1 Mar 2017 12:32:23 +0000 Message-Id: <20170301123223.12489-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 01 Mar 2017 12:32:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] migration: allow clearing migration string parameters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some of the migration parameters are strings, which default to NULL, eg tls_hostname and tls_creds. The mgmt app will set the tls_creds parameter on both source and target QEMU instances, in order to trigger use of TLS for migration. After performing a TLS encrypted migration though, migration might be used for other reasons - for example, to save the QEMU state to a file. We need TLS turned off when doing this, but the migrate-set-parameters QAPI command does not provide any facility to clear/reset parameters to their default state. If you simply ommit the tls_creds parameter in migrate-set-parameters, then 'has_tls_creds' will be false and so no action will be taken. The only option that works with migrate-set-parameters is to treat "" on the wire as equivalent to requesting NULL. Failing that we would have to create a new 'migrate-reset-parameters' method to explicitly put a parameter back to its default value. Signed-off-by: Daniel P. Berrange --- CC'ing Eric & Markus since this is related to QAPI schema for migrate monitor commands migration/migration.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c6ae69d..a5d41a9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -872,11 +872,19 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) } if (params->has_tls_creds) { g_free(s->parameters.tls_creds); - s->parameters.tls_creds =3D g_strdup(params->tls_creds); + if (*params->tls_creds =3D=3D '\0') { + s->parameters.tls_creds =3D NULL; + } else { + s->parameters.tls_creds =3D g_strdup(params->tls_creds); + } } if (params->has_tls_hostname) { g_free(s->parameters.tls_hostname); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname); + if (*params->tls_hostnane =3D=3D '\0') { + s->parameters.tls_hostnane =3D NULL; + } else { + s->parameters.tls_hostname =3D g_strdup(params->tls_hostname); + } } if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; --=20 2.9.3