From nobody Mon Feb 9 15:09:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487875731034603.7173922204813; Thu, 23 Feb 2017 10:48:51 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NIjC75051029; Thu, 23 Feb 2017 13:45:12 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NIgdNq028567 for ; Thu, 23 Feb 2017 13:42:39 -0500 Received: from localhost.localdomain.com (ovpn-117-109.phx2.redhat.com [10.3.117.109]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NIgXiH029831 for ; Thu, 23 Feb 2017 13:42:39 -0500 From: John Ferlan To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 13:42:13 -0500 Message-Id: <20170223184216.5158-12-jferlan@redhat.com> In-Reply-To: <20170223184216.5158-1-jferlan@redhat.com> References: <20170223184216.5158-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 11/14] qemu: Create #define for TLS configuration setup. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Create GET_CONFIG_TLS_CERT to set up the TLS for 'chardev' TLS setting. Soon to be reused. Signed-off-by: John Ferlan --- src/qemu/qemu_conf.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b5b0645..b75cd54 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -529,22 +529,33 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAut= oUnixSocket) < 0) goto cleanup; =20 - if (virConfGetValueBool(conf, "chardev_tls", &cfg->chardevTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "chardev_tls_x509_cert_dir", &cfg->cha= rdevTLSx509certdir) < 0) - goto cleanup; - if ((rv =3D virConfGetValueBool(conf, "chardev_tls_x509_verify", &cfg-= >chardevTLSx509verify)) < 0) - goto cleanup; - if (rv =3D=3D 0) - cfg->chardevTLSx509verify =3D cfg->defaultTLSx509verify; - if (virConfGetValueString(conf, "chardev_tls_x509_secret_uuid", - &cfg->chardevTLSx509secretUUID) < 0) - goto cleanup; - if (!cfg->chardevTLSx509secretUUID && cfg->defaultTLSx509secretUUID) { - if (VIR_STRDUP(cfg->chardevTLSx509secretUUID, - cfg->defaultTLSx509secretUUID) < 0) - goto cleanup; - } +#define GET_CONFIG_TLS_CERT(val) = \ + do { = \ + if (virConfGetValueBool(conf, #val "_tls", &cfg->val## TLS) < 0) = \ + goto cleanup; = \ + if ((rv =3D virConfGetValueBool(conf, #val "_tls_x509_verify", = \ + &cfg->val## TLSx509verify)) < 0) = \ + goto cleanup; = \ + if (rv =3D=3D 0) = \ + cfg->val## TLSx509verify =3D cfg->defaultTLSx509verify; = \ + if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", = \ + &cfg->val## TLSx509certdir) < 0) = \ + goto cleanup; = \ + if (virConfGetValueString(conf, = \ + #val "_tls_x509_secret_uuid", = \ + &cfg->val## TLSx509secretUUID) < 0) = \ + goto cleanup; = \ + if (!cfg->val## TLSx509secretUUID && = \ + cfg->defaultTLSx509secretUUID) { = \ + if (VIR_STRDUP(cfg->val## TLSx509secretUUID, = \ + cfg->defaultTLSx509secretUUID) < 0) = \ + goto cleanup; = \ + } = \ + } while (false); + + GET_CONFIG_TLS_CERT(chardev); + +#undef GET_CONFIG_TLS_CERT =20 if (virConfGetValueUInt(conf, "remote_websocket_port_min", &cfg->webSo= cketPortMin) < 0) goto cleanup; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list