From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558611591608.2208843582056; Tue, 15 Jan 2019 05:23:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75EBC85A07; Tue, 15 Jan 2019 13:23:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9D475D778; Tue, 15 Jan 2019 13:23:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EAE9618433EE; Tue, 15 Jan 2019 13:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNQac011023 for ; Tue, 15 Jan 2019 08:23:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8732B6031B; Tue, 15 Jan 2019 13:23:26 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C5CA600C8 for ; Tue, 15 Jan 2019 13:23:25 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:22:57 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/23] qemu: fix double space in augeas file 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 15 Jan 2019 13:23:30 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/libvirtd_qemu.aug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index ddc4bbfd1d..434ae510a0 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -76,7 +76,7 @@ module Libvirtd_qemu =3D | int_entry "seccomp_sandbox" | str_array_entry "namespaces" =20 - let save_entry =3D str_entry "save_image_format" + let save_entry =3D str_entry "save_image_format" | str_entry "dump_image_format" | str_entry "snapshot_image_format" | str_entry "auto_dump_path" --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15475586226821011.361791783675; Tue, 15 Jan 2019 05:23:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B3D4793C4; Tue, 15 Jan 2019 13:23:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D29E9108F83A; Tue, 15 Jan 2019 13:23:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6C0973F603; Tue, 15 Jan 2019 13:23:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNRAw011033 for ; Tue, 15 Jan 2019 08:23:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B9CA6031B; Tue, 15 Jan 2019 13:23:27 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5EFC600C8 for ; Tue, 15 Jan 2019 13:23:26 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:22:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/23] qemu: group swtpm entry in augeas file 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:23:41 +0000 (UTC) They are meant to be together. Signed-off-by: J=C3=A1n Tomko --- src/qemu/libvirtd_qemu.aug | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 434ae510a0..28bd851411 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -122,8 +122,8 @@ module Libvirtd_qemu =3D let nbd_entry =3D bool_entry "nbd_tls" | str_entry "nbd_tls_x509_cert_dir" =20 - let swtpm_user_entry =3D str_entry "swtpm_user" - let swtpm_group_entry =3D str_entry "swtpm_group" + let swtpm_entry =3D str_entry "swtpm_user" + | str_entry "swtpm_group" =20 (* Each entry in the config is one of the following ... *) let entry =3D default_tls_entry @@ -145,8 +145,7 @@ module Libvirtd_qemu =3D | memory_entry | vxhs_entry | nbd_entry - | swtpm_user_entry - | swtpm_group_entry + | swtpm_entry =20 let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] let empty =3D [ label "#empty" . eol ] --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558628756176.4679410933469; Tue, 15 Jan 2019 05:23:48 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96C457F6A7; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 540AD5D781; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ED6E33F604; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNWAg011051 for ; Tue, 15 Jan 2019 08:23:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2610A6031B; Tue, 15 Jan 2019 13:23:32 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FA0E600C8 for ; Tue, 15 Jan 2019 13:23:27 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:22:59 +0100 Message-Id: <700ae73b264e64657448ab88fed74a5098e7343f.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/23] qemu.conf: fill out TLS verify attributes after parsing 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:23:47 +0000 (UTC) Introduce a set of bool variables with the 'present' suffix to track whether the value was actually specified. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 28 ++++++++++++++++++++++++---- src/qemu/qemu_conf.h | 6 ++++++ src/qemu/qemu_driver.c | 3 +++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b03e38b831..a0855032e5 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -535,8 +535,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, goto cleanup; if ((rv =3D virConfGetValueBool(conf, "vnc_tls_x509_verify", &cfg->vnc= TLSx509verify)) < 0) goto cleanup; - if (rv =3D=3D 0) - cfg->vncTLSx509verify =3D cfg->defaultTLSx509verify; + if (rv =3D=3D 1) + cfg->vncTLSx509verifyPresent =3D true; if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir", &cfg->vncTLSx= 509certdir) < 0) goto cleanup; if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0) @@ -601,8 +601,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, 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 (rv =3D=3D 1) \ + cfg->val## TLSx509verifyPresent =3D true; \ if ((rv =3D virConfGetValueString(conf, #val "_tls_x509_cert_dir",= \ &cfg->val## TLSx509certdir)) < 0) \ goto cleanup; \ @@ -1055,6 +1055,26 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr c= fg) return 0; } =20 +int +virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg) +{ + int ret =3D -1; + +#define SET_TLS_VERIFY_DEFAULT(val) \ + do { \ + if (!cfg->val## TLSx509verifyPresent) \ + cfg->val## TLSx509verify =3D cfg->defaultTLSx509verify; \ + } while (0) + + SET_TLS_VERIFY_DEFAULT(vnc); + SET_TLS_VERIFY_DEFAULT(chardev); + SET_TLS_VERIFY_DEFAULT(migrate); + +#undef SET_TLS_VERIFY_DEFAULT + + ret =3D 0; + return ret; +} =20 virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver) { diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 1013cfcaed..87e730058b 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -122,6 +122,7 @@ struct _virQEMUDriverConfig { bool vncAutoUnixSocket; bool vncTLS; bool vncTLSx509verify; + bool vncTLSx509verifyPresent; bool vncSASL; char *vncTLSx509certdir; char *vncListen; @@ -139,10 +140,12 @@ struct _virQEMUDriverConfig { bool chardevTLS; char *chardevTLSx509certdir; bool chardevTLSx509verify; + bool chardevTLSx509verifyPresent; char *chardevTLSx509secretUUID; =20 char *migrateTLSx509certdir; bool migrateTLSx509verify; + bool migrateTLSx509verifyPresent; char *migrateTLSx509secretUUID; =20 unsigned int remotePortMin; @@ -317,6 +320,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, int virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg); =20 +int +virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg); + virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver); bool virQEMUDriverIsPrivileged(virQEMUDriverPtr driver); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1d961707cc..5032edec50 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -628,6 +628,9 @@ qemuStateInitialize(bool privileged, if (virQEMUDriverConfigValidate(cfg) < 0) goto error; =20 + if (virQEMUDriverConfigSetDefaults(cfg) < 0) + goto error; + if (virFileMakePath(cfg->stateDir) < 0) { virReportSystemError(errno, _("Failed to create state dir %s"), cfg->stateDir); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558618998533.8321176745792; Tue, 15 Jan 2019 05:23:38 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B41E512F91A; Tue, 15 Jan 2019 13:23:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E65F5E9C0; Tue, 15 Jan 2019 13:23:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0E5011832E8F; Tue, 15 Jan 2019 13:23:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNXKd011056 for ; Tue, 15 Jan 2019 08:23:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id F02B66031B; Tue, 15 Jan 2019 13:23:32 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75FDB600C8 for ; Tue, 15 Jan 2019 13:23:32 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:00 +0100 Message-Id: <128dfe0d11b08a5f147ae98c9f95854299a4ee66.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/23] qemu: fill out usage-specific TLS settings after parsing 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Jan 2019 13:23:37 +0000 (UTC) Instead of copying the default default values upfront and then wondering whether the user has given us a new default, leave the per-usage TLS certdirs and secrets empty during parsing and only fill them afterwards if they weren't provided by the user. This means that instead of looking whether the specific certdir paths match the default default, the Validate function (which is called inbetween parsing and setting the defaults) can error out for missing directories if the value is present, because it must've come from the user. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 150 ++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 94 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index a0855032e5..837bff6b30 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -277,35 +277,6 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool pri= vileged) if (VIR_STRDUP(cfg->spiceListen, VIR_LOOPBACK_IPV4_ADDR) < 0) goto error; =20 - /* - * If a "SYSCONFDIR" + "pki/libvirt-" exists, then assume someone - * has created a val specific area to place service specific certifica= tes. - * - * If the service specific directory doesn't exist, 'assume' that the - * user has created and populated the "SYSCONFDIR" + "pki/libvirt-defa= ult". - */ -#define SET_TLS_X509_CERT_DEFAULT(val) \ - do { \ - if (virFileExists(SYSCONFDIR "/pki/libvirt-"#val)) { \ - if (VIR_STRDUP(cfg->val ## TLSx509certdir, \ - SYSCONFDIR "/pki/libvirt-"#val) < 0) \ - goto error; \ - } else { \ - if (VIR_STRDUP(cfg->val ## TLSx509certdir, \ - cfg->defaultTLSx509certdir) < 0) \ - goto error; \ - } \ - } while (0) - - SET_TLS_X509_CERT_DEFAULT(vnc); - SET_TLS_X509_CERT_DEFAULT(spice); - SET_TLS_X509_CERT_DEFAULT(chardev); - SET_TLS_X509_CERT_DEFAULT(migrate); - SET_TLS_X509_CERT_DEFAULT(vxhs); - SET_TLS_X509_CERT_DEFAULT(nbd); - -#undef SET_TLS_X509_CERT_DEFAULT - cfg->remotePortMin =3D QEMU_REMOTE_PORT_MIN; cfg->remotePortMax =3D QEMU_REMOTE_PORT_MAX; =20 @@ -452,45 +423,6 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 -/** - * @cfg: Just read config TLS values - * - * If the default_tls_x509_cert_dir was uncommented or changed from - * the default value assigned to the *_tls_x509_cert_dir values when - * virQEMUDriverConfigNew was executed, we need to check if we need - * to update the other defaults. - * - * Returns 0 on success, -1 on failure - */ -static int -virQEMUDriverConfigTLSDirResetDefaults(virQEMUDriverConfigPtr cfg) -{ - /* Not changed or set to the default default, nothing to do */ - if (!cfg->checkdefaultTLSx509certdir || - STREQ(cfg->defaultTLSx509certdir, SYSCONFDIR "/pki/qemu")) - return 0; - -#define CHECK_RESET_CERT_DIR_DEFAULT(val) \ - do { \ - if (STREQ(cfg->val ## TLSx509certdir, SYSCONFDIR "/pki/qemu")) { \ - VIR_FREE(cfg->val ## TLSx509certdir); \ - if (VIR_STRDUP(cfg->val ## TLSx509certdir, \ - cfg->defaultTLSx509certdir) < 0) \ - return -1; \ - } \ - } while (0) - - CHECK_RESET_CERT_DIR_DEFAULT(vnc); - CHECK_RESET_CERT_DIR_DEFAULT(spice); - CHECK_RESET_CERT_DIR_DEFAULT(chardev); - CHECK_RESET_CERT_DIR_DEFAULT(migrate); - CHECK_RESET_CERT_DIR_DEFAULT(vxhs); - CHECK_RESET_CERT_DIR_DEFAULT(nbd); - - return 0; -} - - int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, const char *filename, bool privileged) @@ -603,23 +535,13 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, goto cleanup; \ if (rv =3D=3D 1) \ cfg->val## TLSx509verifyPresent =3D true; \ - if ((rv =3D virConfGetValueString(conf, #val "_tls_x509_cert_dir",= \ - &cfg->val## TLSx509certdir)) < 0) \ + 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; \ - /* Only if a *tls_x509_cert_dir wasn't found (e.g. rv =3D=3D 0), s= hould \ - * we copy the defaultTLSx509secretUUID. If this environment needs= \ - * a passphrase to decode the certificate, then it should provide \ - * it's own secretUUID for that. */ \ - if (rv =3D=3D 0 && !cfg->val## TLSx509secretUUID && \ - cfg->defaultTLSx509secretUUID) { \ - if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \ - cfg->defaultTLSx509secretUUID) < 0) \ - goto cleanup; \ - } \ } while (0) =20 if (virConfGetValueBool(conf, "chardev_tls", &cfg->chardevTLS) < 0) @@ -630,9 +552,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, =20 #undef GET_CONFIG_TLS_CERTINFO =20 - if (virQEMUDriverConfigTLSDirResetDefaults(cfg) < 0) - goto cleanup; - if (virConfGetValueUInt(conf, "remote_websocket_port_min", &cfg->webSo= cketPortMin) < 0) goto cleanup; if (cfg->webSocketPortMin < QEMU_WEBSOCKET_PORT_MIN) { @@ -989,7 +908,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, int virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) { - /* If the default entry was uncommented, then validate existence */ if (cfg->checkdefaultTLSx509certdir) { if (!virFileExists(cfg->defaultTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, @@ -1000,11 +918,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cf= g) } } =20 - /* For each of the others - if the value is not to the default default - * then check if the directory exists (this may duplicate the check do= ne - * during virQEMUDriverConfigNew). - */ - if (STRNEQ(cfg->vncTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->vncTLSx509certdir && !virFileExists(cfg->vncTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("vnc_tls_x509_cert_dir directory '%s' does not ex= ist"), @@ -1012,7 +926,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) return -1; } =20 - if (STRNEQ(cfg->spiceTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->spiceTLSx509certdir && !virFileExists(cfg->spiceTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("spice_tls_x509_cert_dir directory '%s' does not = exist"), @@ -1020,7 +934,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) return -1; } =20 - if (STRNEQ(cfg->chardevTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->chardevTLSx509certdir && !virFileExists(cfg->chardevTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("chardev_tls_x509_cert_dir directory '%s' does no= t exist"), @@ -1028,7 +942,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) return -1; } =20 - if (STRNEQ(cfg->migrateTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->migrateTLSx509certdir && !virFileExists(cfg->migrateTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("migrate_tls_x509_cert_dir directory '%s' does no= t exist"), @@ -1036,7 +950,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) return -1; } =20 - if (STRNEQ(cfg->vxhsTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->vxhsTLSx509certdir && !virFileExists(cfg->vxhsTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("vxhs_tls_x509_cert_dir directory '%s' does not e= xist"), @@ -1044,7 +958,7 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) return -1; } =20 - if (STRNEQ(cfg->nbdTLSx509certdir, SYSCONFDIR "/pki/qemu") && + if (cfg->nbdTLSx509certdir && !virFileExists(cfg->nbdTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("nbd_tls_x509_cert_dir directory '%s' does not ex= ist"), @@ -1060,6 +974,53 @@ virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr= cfg) { int ret =3D -1; =20 +#define SET_TLS_SECRET_UUID_DEFAULT(val) \ + do { \ + if (!cfg->val## TLSx509certdir && \ + !cfg->val## TLSx509secretUUID && \ + cfg->defaultTLSx509secretUUID) { \ + if (VIR_STRDUP(cfg->val## TLSx509secretUUID, \ + cfg->defaultTLSx509secretUUID) < 0) \ + goto cleanup; \ + } \ + } while (0) + + SET_TLS_SECRET_UUID_DEFAULT(chardev); + SET_TLS_SECRET_UUID_DEFAULT(migrate); + +#undef SET_TLS_SECRET_UUID_DEFAULT + + /* + * If a "SYSCONFDIR" + "pki/libvirt-" exists, then assume someone + * has created a val specific area to place service specific certifica= tes. + * + * If the service specific directory doesn't exist, 'assume' that the + * user has created and populated the "SYSCONFDIR" + "pki/libvirt-defa= ult". + */ +#define SET_TLS_X509_CERT_DEFAULT(val) \ + do { \ + if (cfg->val ## TLSx509certdir) \ + break; \ + if (virFileExists(SYSCONFDIR "/pki/libvirt-"#val)) { \ + if (VIR_STRDUP(cfg->val ## TLSx509certdir, \ + SYSCONFDIR "/pki/libvirt-"#val) < 0) \ + goto cleanup; \ + } else { \ + if (VIR_STRDUP(cfg->val ## TLSx509certdir, \ + cfg->defaultTLSx509certdir) < 0) \ + goto cleanup; \ + } \ + } while (0) + + SET_TLS_X509_CERT_DEFAULT(vnc); + SET_TLS_X509_CERT_DEFAULT(spice); + SET_TLS_X509_CERT_DEFAULT(chardev); + SET_TLS_X509_CERT_DEFAULT(migrate); + SET_TLS_X509_CERT_DEFAULT(vxhs); + SET_TLS_X509_CERT_DEFAULT(nbd); + +#undef SET_TLS_X509_CERT_DEFAULT + #define SET_TLS_VERIFY_DEFAULT(val) \ do { \ if (!cfg->val## TLSx509verifyPresent) \ @@ -1073,6 +1034,7 @@ virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr= cfg) #undef SET_TLS_VERIFY_DEFAULT =20 ret =3D 0; + cleanup: return ret; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558633248640.0524849345499; Tue, 15 Jan 2019 05:23:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8ABAA0C3F; Tue, 15 Jan 2019 13:23:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6372E19C7C; Tue, 15 Jan 2019 13:23:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01AB43F607; Tue, 15 Jan 2019 13:23:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNX7a011066 for ; Tue, 15 Jan 2019 08:23:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id C54AE6031B; Tue, 15 Jan 2019 13:23:33 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A134600C8 for ; Tue, 15 Jan 2019 13:23:33 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:01 +0100 Message-Id: <9943c8933b54c527d130461259c3ec11b0cde1f7.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/23] qemu_conf: split out virQEMUDriverConfigLoadSWTPMEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 837bff6b30..325e5ccfd5 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,30 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + char *swtpm_user =3D NULL, *swtpm_group =3D NULL; + int ret =3D -1; + + if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0) + goto cleanup; + if (swtpm_user && virGetUserID(swtpm_user, &cfg->swtpm_user) < 0) + goto cleanup; + + if (virConfGetValueString(conf, "swtpm_group", &swtpm_group) < 0) + goto cleanup; + if (swtpm_group && virGetGroupID(swtpm_group, &cfg->swtpm_group) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + VIR_FREE(swtpm_user); + VIR_FREE(swtpm_group); + return ret; +} + int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, const char *filename, bool privileged) @@ -433,7 +457,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, size_t i, j; char *stdioHandler =3D NULL; char *user =3D NULL, *group =3D NULL; - char *swtpm_user =3D NULL, *swtpm_group =3D NULL; char **controllers =3D NULL; char **hugetlbfs =3D NULL; char **nvram =3D NULL; @@ -871,14 +894,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBack= ingDir) < 0) goto cleanup; =20 - if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0) - goto cleanup; - if (swtpm_user && virGetUserID(swtpm_user, &cfg->swtpm_user) < 0) - goto cleanup; - - if (virConfGetValueString(conf, "swtpm_group", &swtpm_group) < 0) - goto cleanup; - if (swtpm_group && virGetGroupID(swtpm_group, &cfg->swtpm_group) < 0) + if (virQEMUDriverConfigLoadSWTPMEntry(cfg, conf) < 0) goto cleanup; =20 ret =3D 0; @@ -891,8 +907,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, VIR_FREE(corestr); VIR_FREE(user); VIR_FREE(group); - VIR_FREE(swtpm_user); - VIR_FREE(swtpm_group); virConfFree(conf); return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558627039181.8823545268724; Tue, 15 Jan 2019 05:23:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F7B6A7878; Tue, 15 Jan 2019 13:23:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C79CD5D98E; Tue, 15 Jan 2019 13:23:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 72E3F18436BF; Tue, 15 Jan 2019 13:23:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNYnv011071 for ; Tue, 15 Jan 2019 08:23:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9664C6031B; Tue, 15 Jan 2019 13:23:34 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C936600C8 for ; Tue, 15 Jan 2019 13:23:33 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/23] qemu_conf: split out virQEMUDriverConfigLoadMemoryEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Jan 2019 13:23:42 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 325e5ccfd5..7fdfed7db1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,16 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadMemoryEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBack= ingDir) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -891,7 +901,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, } } =20 - if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBack= ingDir) < 0) + if (virQEMUDriverConfigLoadMemoryEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadSWTPMEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558627991513.8212563871588; Tue, 15 Jan 2019 05:23:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DAFB2D4B75; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41D4F19751; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EE44B181BA1A; Tue, 15 Jan 2019 13:23:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNZkm011077 for ; Tue, 15 Jan 2019 08:23:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6B51B6031B; Tue, 15 Jan 2019 13:23:35 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id E572B600C8 for ; Tue, 15 Jan 2019 13:23:34 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:03 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/23] qemu_conf: split out virQEMUDriverConfigLoadSecurityEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 219 +++++++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 102 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 7fdfed7db1..135cb9e25d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,121 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huge= tlbfs, } =20 =20 +static int +virQEMUDriverConfigLoadSecurityEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf, + bool privileged) +{ + char *user =3D NULL, *group =3D NULL; + char **controllers =3D NULL; + char **namespaces =3D NULL; + int ret =3D -1; + size_t i, j; + + if (virConfGetValueStringList(conf, "security_driver", true, &cfg->sec= urityDriverNames) < 0) + goto cleanup; + + for (i =3D 0; cfg->securityDriverNames && cfg->securityDriverNames[i] = !=3D NULL; i++) { + for (j =3D i + 1; cfg->securityDriverNames[j] !=3D NULL; j++) { + if (STREQ(cfg->securityDriverNames[i], + cfg->securityDriverNames[j])) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("Duplicate security driver %s"), + cfg->securityDriverNames[i]); + goto cleanup; + } + } + } + + if (virConfGetValueBool(conf, "security_default_confined", &cfg->secur= ityDefaultConfined) < 0) + goto cleanup; + if (virConfGetValueBool(conf, "security_require_confined", &cfg->secur= ityRequireConfined) < 0) + goto cleanup; + if (virConfGetValueString(conf, "user", &user) < 0) + goto cleanup; + if (user && virGetUserID(user, &cfg->user) < 0) + goto cleanup; + + if (virConfGetValueString(conf, "group", &group) < 0) + goto cleanup; + if (group && virGetGroupID(group, &cfg->group) < 0) + goto cleanup; + + if (virConfGetValueBool(conf, "dynamic_ownership", &cfg->dynamicOwners= hip) < 0) + goto cleanup; + + if (virConfGetValueStringList(conf, "cgroup_controllers", false, + &controllers) < 0) + goto cleanup; + + if (controllers) { + cfg-> cgroupControllers =3D 0; + for (i =3D 0; controllers[i] !=3D NULL; i++) { + int ctl; + if ((ctl =3D virCgroupControllerTypeFromString(controllers[i])= ) < 0) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("Unknown cgroup controller '%s'"), + controllers[i]); + goto cleanup; + } + cfg->cgroupControllers |=3D (1 << ctl); + } + } + + if (virConfGetValueStringList(conf, "cgroup_device_acl", false, + &cfg->cgroupDeviceACL) < 0) + goto cleanup; + + if (virConfGetValueInt(conf, "seccomp_sandbox", &cfg->seccompSandbox) = < 0) + goto cleanup; + + if (virConfGetValueStringList(conf, "namespaces", false, &namespaces) = < 0) + goto cleanup; + + if (namespaces) { + virBitmapClearAll(cfg->namespaces); + + for (i =3D 0; namespaces[i]; i++) { + int ns =3D qemuDomainNamespaceTypeFromString(namespaces[i]); + + if (ns < 0) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("Unknown namespace: %s"), + namespaces[i]); + goto cleanup; + } + + if (!privileged) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("cannot use namespaces in session mode")); + goto cleanup; + } + + if (!qemuDomainNamespaceAvailable(ns)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s namespace is not available"), + namespaces[i]); + goto cleanup; + } + + if (virBitmapSetBit(cfg->namespaces, ns) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to enable namespace: %s"), + namespaces[i]); + goto cleanup; + } + } + } + + ret =3D 0; + cleanup: + virStringListFree(controllers); + virStringListFree(namespaces); + VIR_FREE(user); + VIR_FREE(group); + return ret; +} + static int virQEMUDriverConfigLoadMemoryEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -464,14 +579,11 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, virConfPtr conf =3D NULL; int ret =3D -1; int rv; - size_t i, j; + size_t i; char *stdioHandler =3D NULL; - char *user =3D NULL, *group =3D NULL; - char **controllers =3D NULL; char **hugetlbfs =3D NULL; char **nvram =3D NULL; char *corestr =3D NULL; - char **namespaces =3D NULL; bool tmp; =20 /* Just check the file is readable before opening it, otherwise @@ -518,26 +630,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, goto cleanup; =20 =20 - if (virConfGetValueStringList(conf, "security_driver", true, &cfg->sec= urityDriverNames) < 0) - goto cleanup; - - for (i =3D 0; cfg->securityDriverNames && cfg->securityDriverNames[i] = !=3D NULL; i++) { - for (j =3D i + 1; cfg->securityDriverNames[j] !=3D NULL; j++) { - if (STREQ(cfg->securityDriverNames[i], - cfg->securityDriverNames[j])) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("Duplicate security driver %s"), - cfg->securityDriverNames[i]); - goto cleanup; - } - } - } - - if (virConfGetValueBool(conf, "security_default_confined", &cfg->secur= ityDefaultConfined) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "security_require_confined", &cfg->secur= ityRequireConfined) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) goto cleanup; if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spice= TLSx509certdir) < 0) @@ -667,41 +759,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, goto cleanup; } =20 - if (virConfGetValueString(conf, "user", &user) < 0) - goto cleanup; - if (user && virGetUserID(user, &cfg->user) < 0) - goto cleanup; - - if (virConfGetValueString(conf, "group", &group) < 0) - goto cleanup; - if (group && virGetGroupID(group, &cfg->group) < 0) - goto cleanup; - - if (virConfGetValueBool(conf, "dynamic_ownership", &cfg->dynamicOwners= hip) < 0) - goto cleanup; - - if (virConfGetValueStringList(conf, "cgroup_controllers", false, - &controllers) < 0) - goto cleanup; - - if (controllers) { - cfg-> cgroupControllers =3D 0; - for (i =3D 0; controllers[i] !=3D NULL; i++) { - int ctl; - if ((ctl =3D virCgroupControllerTypeFromString(controllers[i])= ) < 0) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("Unknown cgroup controller '%s'"), - controllers[i]); - goto cleanup; - } - cfg->cgroupControllers |=3D (1 << ctl); - } - } - - if (virConfGetValueStringList(conf, "cgroup_device_acl", false, - &cfg->cgroupDeviceACL) < 0) - goto cleanup; - if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFo= rmat) < 0) goto cleanup; if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFo= rmat) < 0) @@ -812,9 +869,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) goto cleanup; =20 - if (virConfGetValueInt(conf, "seccomp_sandbox", &cfg->seccompSandbox) = < 0) - goto cleanup; - if (virConfGetValueString(conf, "migration_host", &cfg->migrateHost) <= 0) goto cleanup; virStringStripIPv6Brackets(cfg->migrateHost); @@ -863,44 +917,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) goto cleanup; =20 - if (virConfGetValueStringList(conf, "namespaces", false, &namespaces) = < 0) + if (virQEMUDriverConfigLoadSecurityEntry(cfg, conf, privileged) < 0) goto cleanup; =20 - if (namespaces) { - virBitmapClearAll(cfg->namespaces); - - for (i =3D 0; namespaces[i]; i++) { - int ns =3D qemuDomainNamespaceTypeFromString(namespaces[i]); - - if (ns < 0) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("Unknown namespace: %s"), - namespaces[i]); - goto cleanup; - } - - if (!privileged) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("cannot use namespaces in session mode")); - goto cleanup; - } - - if (!qemuDomainNamespaceAvailable(ns)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s namespace is not available"), - namespaces[i]); - goto cleanup; - } - - if (virBitmapSetBit(cfg->namespaces, ns) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to enable namespace: %s"), - namespaces[i]); - goto cleanup; - } - } - } - if (virQEMUDriverConfigLoadMemoryEntry(cfg, conf) < 0) goto cleanup; =20 @@ -910,13 +929,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, ret =3D 0; =20 cleanup: - virStringListFree(namespaces); - virStringListFree(controllers); virStringListFree(hugetlbfs); virStringListFree(nvram); VIR_FREE(corestr); - VIR_FREE(user); - VIR_FREE(group); virConfFree(conf); return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558638823180.69398160869082; Tue, 15 Jan 2019 05:23:58 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF3CE3E2CF; Tue, 15 Jan 2019 13:23:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D89917B31; Tue, 15 Jan 2019 13:23:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 36E483F605; Tue, 15 Jan 2019 13:23:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNapk011091 for ; Tue, 15 Jan 2019 08:23:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F63763B85; Tue, 15 Jan 2019 13:23:36 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id B96C3600C8 for ; Tue, 15 Jan 2019 13:23:35 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/23] qemu_conf: split out virQEMUDriverConfigLoadGlusterDebugEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Jan 2019 13:23:56 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 135cb9e25d..ca31a222e8 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,15 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadGlusterDebugEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) + return -1; + return 0; +} + static int virQEMUDriverConfigLoadSecurityEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf, @@ -914,7 +923,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, goto cleanup; } } - if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebu= gLevel) < 0) + + if (virQEMUDriverConfigLoadGlusterDebugEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadSecurityEntry(cfg, conf, privileged) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558642897394.2304796587101; Tue, 15 Jan 2019 05:24:02 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B3E5C0828A9; Tue, 15 Jan 2019 13:24:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9E67108BD11; Tue, 15 Jan 2019 13:23:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 75560184B54A; Tue, 15 Jan 2019 13:23:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNbjk011103 for ; Tue, 15 Jan 2019 08:23:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1CFC66031B; Tue, 15 Jan 2019 13:23:37 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96A9E53E10 for ; Tue, 15 Jan 2019 13:23:36 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:05 +0100 Message-Id: <83f47c273e0c0b92500db8ccb7c7e78e11222930.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/23] qemu_conf: split out virQEMUDriverConfigLoadNVRAMEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 15 Jan 2019 13:24:01 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 49 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ca31a222e8..29f948346d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,37 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + char **nvram =3D NULL; + int ret =3D -1; + size_t i; + + if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0) + goto cleanup; + if (nvram) { + virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); + + cfg->nfirmwares =3D virStringListLength((const char *const *)nvram= ); + if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0) + goto cleanup; + + for (i =3D 0; nvram[i] !=3D NULL; i++) { + if (VIR_ALLOC(cfg->firmwares[i]) < 0) + goto cleanup; + if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0) + goto cleanup; + } + } + + ret =3D 0; + cleanup: + virStringListFree(nvram); + return ret; +} + static int virQEMUDriverConfigLoadGlusterDebugEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -591,7 +622,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, size_t i; char *stdioHandler =3D NULL; char **hugetlbfs =3D NULL; - char **nvram =3D NULL; char *corestr =3D NULL; bool tmp; =20 @@ -907,22 +937,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueBool(conf, "log_timestamp", &cfg->logTimestamp) < 0) goto cleanup; =20 - if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0) + if (virQEMUDriverConfigLoadNVRAMEntry(cfg, conf) < 0) goto cleanup; - if (nvram) { - virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); - - cfg->nfirmwares =3D virStringListLength((const char *const *)nvram= ); - if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0) - goto cleanup; - - for (i =3D 0; nvram[i] !=3D NULL; i++) { - if (VIR_ALLOC(cfg->firmwares[i]) < 0) - goto cleanup; - if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0) - goto cleanup; - } - } =20 if (virQEMUDriverConfigLoadGlusterDebugEntry(cfg, conf) < 0) goto cleanup; @@ -940,7 +956,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, =20 cleanup: virStringListFree(hugetlbfs); - virStringListFree(nvram); VIR_FREE(corestr); virConfFree(conf); return ret; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558649093485.6508190106846; Tue, 15 Jan 2019 05:24:09 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40C177AE84; Tue, 15 Jan 2019 13:24:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFEFD18539; Tue, 15 Jan 2019 13:24:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 749FB184B54D; Tue, 15 Jan 2019 13:24:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNf7D011133 for ; Tue, 15 Jan 2019 08:23:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B11D5C6DD; Tue, 15 Jan 2019 13:23:41 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DDAE5B084 for ; Tue, 15 Jan 2019 13:23:37 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:06 +0100 Message-Id: <2f84b452592b768489124be8d18c7101b20be219.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/23] qemu_conf: split out virQEMUDriverConfigLoadLogEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:24:06 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 29f948346d..b7d258f17a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,16 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadLogEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueBool(conf, "log_timestamp", &cfg->logTimestamp) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -934,7 +944,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, goto cleanup; } =20 - if (virConfGetValueBool(conf, "log_timestamp", &cfg->logTimestamp) < 0) + if (virQEMUDriverConfigLoadLogEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadNVRAMEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558631603522.6632695322227; Tue, 15 Jan 2019 05:23:51 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79062C0C9A75; Tue, 15 Jan 2019 13:23:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 219DD17790; Tue, 15 Jan 2019 13:23:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9A6763F604; Tue, 15 Jan 2019 13:23:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNgJI011138 for ; Tue, 15 Jan 2019 08:23:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id F142C6031B; Tue, 15 Jan 2019 13:23:41 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 704495C6DA for ; Tue, 15 Jan 2019 13:23:41 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/23] qemu_conf: split out virQEMUDriverConfigLoadNetworkEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 15 Jan 2019 13:23:50 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 99 +++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b7d258f17a..8aa5157cd1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,60 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf, + const char *filename) +{ + if (virConfGetValueUInt(conf, "migration_port_min", &cfg->migrationPor= tMin) < 0) + return -1; + if (cfg->migrationPortMin <=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: migration_port_min: port must be greater tha= n 0"), + filename); + return -1; + } + + if (virConfGetValueUInt(conf, "migration_port_max", &cfg->migrationPor= tMax) < 0) + return -1; + if (cfg->migrationPortMax > 65535 || + cfg->migrationPortMax < cfg->migrationPortMin) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: migration_port_max: port must be between " + "the minimal port %d and 65535"), + filename, cfg->migrationPortMin); + return -1; + } + + if (virConfGetValueString(conf, "migration_host", &cfg->migrateHost) <= 0) + return -1; + virStringStripIPv6Brackets(cfg->migrateHost); + if (cfg->migrateHost && + (STRPREFIX(cfg->migrateHost, "localhost") || + virSocketAddrIsNumericLocalhost(cfg->migrateHost))) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("migration_host must not be the address of" + " the local machine: %s"), + cfg->migrateHost); + return -1; + } + + if (virConfGetValueString(conf, "migration_address", &cfg->migrationAd= dress) < 0) + return -1; + virStringStripIPv6Brackets(cfg->migrationAddress); + if (cfg->migrationAddress && + (STRPREFIX(cfg->migrationAddress, "localhost") || + virSocketAddrIsNumericLocalhost(cfg->migrationAddress))) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("migration_address must not be the address of" + " the local machine: %s"), + cfg->migrationAddress); + return -1; + } + + return 0; +} + static int virQEMUDriverConfigLoadLogEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -788,25 +842,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, goto cleanup; } =20 - if (virConfGetValueUInt(conf, "migration_port_min", &cfg->migrationPor= tMin) < 0) - goto cleanup; - if (cfg->migrationPortMin <=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: migration_port_min: port must be greater tha= n 0"), - filename); - goto cleanup; - } - - if (virConfGetValueUInt(conf, "migration_port_max", &cfg->migrationPor= tMax) < 0) - goto cleanup; - if (cfg->migrationPortMax > 65535 || - cfg->migrationPortMax < cfg->migrationPortMin) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: migration_port_max: port must be between " - "the minimal port %d and 65535"), - filename, cfg->migrationPortMin); - goto cleanup; - } =20 if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFo= rmat) < 0) goto cleanup; @@ -858,6 +893,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, goto cleanup; if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->cle= arEmulatorCapabilities) < 0) goto cleanup; + if ((rv =3D virConfGetValueBool(conf, "allow_disk_format_probing", &tm= p)) < 0) goto cleanup; if (rv =3D=3D 1 && tmp) { @@ -918,31 +954,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) goto cleanup; =20 - if (virConfGetValueString(conf, "migration_host", &cfg->migrateHost) <= 0) + if (virQEMUDriverConfigLoadNetworkEntry(cfg, conf, filename) < 0) goto cleanup; - virStringStripIPv6Brackets(cfg->migrateHost); - if (cfg->migrateHost && - (STRPREFIX(cfg->migrateHost, "localhost") || - virSocketAddrIsNumericLocalhost(cfg->migrateHost))) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("migration_host must not be the address of" - " the local machine: %s"), - cfg->migrateHost); - goto cleanup; - } - - if (virConfGetValueString(conf, "migration_address", &cfg->migrationAd= dress) < 0) - goto cleanup; - virStringStripIPv6Brackets(cfg->migrationAddress); - if (cfg->migrationAddress && - (STRPREFIX(cfg->migrationAddress, "localhost") || - virSocketAddrIsNumericLocalhost(cfg->migrationAddress))) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("migration_address must not be the address of" - " the local machine: %s"), - cfg->migrationAddress); - goto cleanup; - } =20 if (virQEMUDriverConfigLoadLogEntry(cfg, conf) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558653007534.0628121337853; Tue, 15 Jan 2019 05:24:13 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EA2840F03; Tue, 15 Jan 2019 13:24:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D0CDA5CC02; Tue, 15 Jan 2019 13:24:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4ADCC3F605; Tue, 15 Jan 2019 13:24:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNgud011149 for ; Tue, 15 Jan 2019 08:23:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id C07B818B4E; Tue, 15 Jan 2019 13:23:42 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 461976031B for ; Tue, 15 Jan 2019 13:23:42 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:08 +0100 Message-Id: <3c4fa5f96613d511235a8d876bee7511c9a02708.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/23] qemu_conf: split out virQEMUDriverConfigLoadRPCEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Jan 2019 13:24:11 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8aa5157cd1..b555e33e7b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,20 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadRPCEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueUInt(conf, "max_queued", &cfg->maxQueuedJobs) < 0) + return -1; + if (virConfGetValueInt(conf, "keepalive_interval", &cfg->keepAliveInte= rval) < 0) + return -1; + if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf, @@ -946,12 +960,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, VIR_FREE(stdioHandler); } =20 - if (virConfGetValueUInt(conf, "max_queued", &cfg->maxQueuedJobs) < 0) - goto cleanup; - - if (virConfGetValueInt(conf, "keepalive_interval", &cfg->keepAliveInte= rval) < 0) - goto cleanup; - if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) + if (virQEMUDriverConfigLoadRPCEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadNetworkEntry(cfg, conf, filename) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558632713554.0741756038333; Tue, 15 Jan 2019 05:23:52 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AE76A0BF9; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A0EC5D777; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EB09B18434BE; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNhZd011158 for ; Tue, 15 Jan 2019 08:23:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A47018B4E; Tue, 15 Jan 2019 13:23:43 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E7306031B for ; Tue, 15 Jan 2019 13:23:42 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:09 +0100 Message-Id: <4384d9e7c3931b39052feac65526982dd9c269f4.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 13/23] qemu_conf: split out virQEMUDriverConfigLoadDeviceEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 45 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b555e33e7b..776ba3f3ad 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,31 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadDeviceEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + bool tmp; + int rv; + + if (virConfGetValueBool(conf, "mac_filter", &cfg->macFilter) < 0) + return -1; + + if (virConfGetValueBool(conf, "relaxed_acs_check", &cfg->relaxedACS) <= 0) + return -1; + if (virConfGetValueString(conf, "lock_manager", &cfg->lockManagerName)= < 0) + return -1; + if ((rv =3D virConfGetValueBool(conf, "allow_disk_format_probing", &tm= p)) < 0) + return -1; + if (rv =3D=3D 1 && tmp) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("allow_disk_format_probing is no longer supported= ")); + return -1; + } + + return 0; +} + static int virQEMUDriverConfigLoadRPCEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -701,7 +726,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, char *stdioHandler =3D NULL; char **hugetlbfs =3D NULL; char *corestr =3D NULL; - bool tmp; =20 /* Just check the file is readable before opening it, otherwise * libvirt emits an error. @@ -900,21 +924,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, if (virConfGetValueString(conf, "pr_helper", &cfg->prHelperName) < 0) goto cleanup; =20 - if (virConfGetValueBool(conf, "mac_filter", &cfg->macFilter) < 0) - goto cleanup; - - if (virConfGetValueBool(conf, "relaxed_acs_check", &cfg->relaxedACS) <= 0) - goto cleanup; if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->cle= arEmulatorCapabilities) < 0) goto cleanup; - - if ((rv =3D virConfGetValueBool(conf, "allow_disk_format_probing", &tm= p)) < 0) - goto cleanup; - if (rv =3D=3D 1 && tmp) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("allow_disk_format_probing is no longer supported= ")); - goto cleanup; - } if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName= ) < 0) goto cleanup; if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0) @@ -940,9 +951,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, if (virConfGetValueBool(conf, "dump_guest_core", &cfg->dumpGuestCore) = < 0) goto cleanup; =20 - if (virConfGetValueString(conf, "lock_manager", &cfg->lockManagerName)= < 0) - goto cleanup; - if (virConfGetValueString(conf, "stdio_handler", &stdioHandler) < 0) goto cleanup; if (stdioHandler) { @@ -960,6 +968,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, VIR_FREE(stdioHandler); } =20 + if (virQEMUDriverConfigLoadDeviceEntry(cfg, conf) < 0) + goto cleanup; + if (virQEMUDriverConfigLoadRPCEntry(cfg, conf) < 0) goto cleanup; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558637992459.1662393297257; Tue, 15 Jan 2019 05:23:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66DE1811D8; Tue, 15 Jan 2019 13:23:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 199555C7A0; Tue, 15 Jan 2019 13:23:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B6F4518434BE; Tue, 15 Jan 2019 13:23:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNiFk011166 for ; Tue, 15 Jan 2019 08:23:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7322B600C8; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDAB75C7A0 for ; Tue, 15 Jan 2019 13:23:43 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:10 +0100 Message-Id: <682df89c64b2efe2b7bb66cc7c2530db65f607f1.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 14/23] qemu_conf: split out virQEMUDriverConfigLoadProcessEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 15 Jan 2019 13:23:56 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 162 ++++++++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 72 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 776ba3f3ad..8bc653fa9e 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,95 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + char *stdioHandler =3D NULL; + char **hugetlbfs =3D NULL; + char *corestr =3D NULL; + int ret =3D -1; + size_t i; + + if (virConfGetValueStringList(conf, "hugetlbfs_mount", true, + &hugetlbfs) < 0) + goto cleanup; + if (hugetlbfs) { + /* There already might be something autodetected. Avoid leaking it= . */ + while (cfg->nhugetlbfs) { + cfg->nhugetlbfs--; + VIR_FREE(cfg->hugetlbfs[cfg->nhugetlbfs].mnt_dir); + } + VIR_FREE(cfg->hugetlbfs); + + cfg->nhugetlbfs =3D virStringListLength((const char *const *)huget= lbfs); + if (hugetlbfs[0] && + VIR_ALLOC_N(cfg->hugetlbfs, cfg->nhugetlbfs) < 0) + goto cleanup; + + for (i =3D 0; hugetlbfs[i] !=3D NULL; i++) { + if (virQEMUDriverConfigHugeTLBFSInit(&cfg->hugetlbfs[i], + hugetlbfs[i], i !=3D 0) <= 0) + goto cleanup; + } + } + + if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->cle= arEmulatorCapabilities) < 0) + goto cleanup; + if (virConfGetValueString(conf, "bridge_helper", &cfg->bridgeHelperNam= e) < 0) + goto cleanup; + + if (virConfGetValueString(conf, "pr_helper", &cfg->prHelperName) < 0) + goto cleanup; + + if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName= ) < 0) + goto cleanup; + if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0) + goto cleanup; + if (virConfGetValueUInt(conf, "max_files", &cfg->maxFiles) < 0) + goto cleanup; + + if (virConfGetValueType(conf, "max_core") =3D=3D VIR_CONF_STRING) { + if (virConfGetValueString(conf, "max_core", &corestr) < 0) + goto cleanup; + if (STREQ(corestr, "unlimited")) { + cfg->maxCore =3D ULLONG_MAX; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown core size '%s'"), + corestr); + goto cleanup; + } + } else if (virConfGetValueULLong(conf, "max_core", &cfg->maxCore) < 0)= { + goto cleanup; + } + + if (virConfGetValueBool(conf, "dump_guest_core", &cfg->dumpGuestCore) = < 0) + goto cleanup; + if (virConfGetValueString(conf, "stdio_handler", &stdioHandler) < 0) + goto cleanup; + if (stdioHandler) { + if (STREQ(stdioHandler, "logd")) { + cfg->stdioLogD =3D true; + } else if (STREQ(stdioHandler, "file")) { + cfg->stdioLogD =3D false; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown stdio handler %s"), + stdioHandler); + VIR_FREE(stdioHandler); + goto cleanup; + } + VIR_FREE(stdioHandler); + } + + ret =3D 0; + cleanup: + virStringListFree(hugetlbfs); + VIR_FREE(corestr); + return ret; +} + static int virQEMUDriverConfigLoadDeviceEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -722,8 +811,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, virConfPtr conf =3D NULL; int ret =3D -1; int rv; - size_t i; - char *stdioHandler =3D NULL; char **hugetlbfs =3D NULL; char *corestr =3D NULL; =20 @@ -894,79 +981,10 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, goto cleanup; if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoSta= rtBypassCache) < 0) goto cleanup; - - if (virConfGetValueStringList(conf, "hugetlbfs_mount", true, - &hugetlbfs) < 0) - goto cleanup; - if (hugetlbfs) { - /* There already might be something autodetected. Avoid leaking it= . */ - while (cfg->nhugetlbfs) { - cfg->nhugetlbfs--; - VIR_FREE(cfg->hugetlbfs[cfg->nhugetlbfs].mnt_dir); - } - VIR_FREE(cfg->hugetlbfs); - - cfg->nhugetlbfs =3D virStringListLength((const char *const *)huget= lbfs); - if (hugetlbfs[0] && - VIR_ALLOC_N(cfg->hugetlbfs, cfg->nhugetlbfs) < 0) - goto cleanup; - - for (i =3D 0; hugetlbfs[i] !=3D NULL; i++) { - if (virQEMUDriverConfigHugeTLBFSInit(&cfg->hugetlbfs[i], - hugetlbfs[i], i !=3D 0) <= 0) - goto cleanup; - } - } - - if (virConfGetValueString(conf, "bridge_helper", &cfg->bridgeHelperNam= e) < 0) - goto cleanup; - - if (virConfGetValueString(conf, "pr_helper", &cfg->prHelperName) < 0) goto cleanup; =20 - if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->cle= arEmulatorCapabilities) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName= ) < 0) + if (virQEMUDriverConfigLoadProcessEntry(cfg, conf) < 0) goto cleanup; - if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0) - goto cleanup; - if (virConfGetValueUInt(conf, "max_files", &cfg->maxFiles) < 0) - goto cleanup; - - if (virConfGetValueType(conf, "max_core") =3D=3D VIR_CONF_STRING) { - if (virConfGetValueString(conf, "max_core", &corestr) < 0) - goto cleanup; - if (STREQ(corestr, "unlimited")) { - cfg->maxCore =3D ULLONG_MAX; - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown core size '%s'"), - corestr); - goto cleanup; - } - } else if (virConfGetValueULLong(conf, "max_core", &cfg->maxCore) < 0)= { - goto cleanup; - } - - if (virConfGetValueBool(conf, "dump_guest_core", &cfg->dumpGuestCore) = < 0) - goto cleanup; - - if (virConfGetValueString(conf, "stdio_handler", &stdioHandler) < 0) - goto cleanup; - if (stdioHandler) { - if (STREQ(stdioHandler, "logd")) { - cfg->stdioLogD =3D true; - } else if (STREQ(stdioHandler, "file")) { - cfg->stdioLogD =3D false; - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown stdio handler %s"), - stdioHandler); - VIR_FREE(stdioHandler); - goto cleanup; - } - VIR_FREE(stdioHandler); - } =20 if (virQEMUDriverConfigLoadDeviceEntry(cfg, conf) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558634563842.9762163656964; Tue, 15 Jan 2019 05:23:54 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C16C27BDDF; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AE6A5C239; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 06F9718434BE; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNjA4011178 for ; Tue, 15 Jan 2019 08:23:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4E8B818B4E; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4F566031B for ; Tue, 15 Jan 2019 13:23:44 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:11 +0100 Message-Id: <29893f9722f3dc7919715a18b05a126c7423da62.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 15/23] qemu_conf: split out virQEMUDriverConfigLoadSaveEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 15 Jan 2019 13:23:52 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8bc653fa9e..e03c0b29e3 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,26 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFo= rmat) < 0) + return -1; + if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFo= rmat) < 0) + return -1; + if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapsho= tImageFormat) < 0) + return -1; + if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) = < 0) + return -1; + if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDump= BypassCache) < 0) + return -1; + if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoSta= rtBypassCache) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -967,20 +987,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, goto cleanup; } =20 - - if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFo= rmat) < 0) - goto cleanup; - if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFo= rmat) < 0) - goto cleanup; - if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapsho= tImageFormat) < 0) - goto cleanup; - - if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) = < 0) - goto cleanup; - if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDump= BypassCache) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoSta= rtBypassCache) < 0) - goto cleanup; + if (virQEMUDriverConfigLoadSaveEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadProcessEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558641568969.5754653326106; Tue, 15 Jan 2019 05:24:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 834F67F3F1; Tue, 15 Jan 2019 13:23:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 219AF5D77B; Tue, 15 Jan 2019 13:23:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C61D23F605; Tue, 15 Jan 2019 13:23:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNkn8011186 for ; Tue, 15 Jan 2019 08:23:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2D86618B4E; Tue, 15 Jan 2019 13:23:46 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6EEA5C7A1 for ; Tue, 15 Jan 2019 13:23:45 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/23] qemu_conf: split out virQEMUDriverConfigLoadRemoteDisplayEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:24:00 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 131 +++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e03c0b29e3..317756d2a0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,76 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf, + const char *filename) +{ + if (virConfGetValueUInt(conf, "remote_websocket_port_min", &cfg->webSo= cketPortMin) < 0) + return -1; + if (cfg->webSocketPortMin < QEMU_WEBSOCKET_PORT_MIN) { + /* if the port is too low, we can't get the display name + * to tell to vnc (usually subtract 5700, e.g. localhost:1 + * for port 5701) */ + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_websocket_port_min: port must be grea= ter " + "than or equal to %d"), + filename, QEMU_WEBSOCKET_PORT_MIN); + return -1; + } + + if (virConfGetValueUInt(conf, "remote_websocket_port_max", &cfg->webSo= cketPortMax) < 0) + return -1; + if (cfg->webSocketPortMax > QEMU_WEBSOCKET_PORT_MAX || + cfg->webSocketPortMax < cfg->webSocketPortMin) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_websocket_port_max: port must be bet= ween " + "the minimal port and %d"), + filename, QEMU_WEBSOCKET_PORT_MAX); + return -1; + } + + if (cfg->webSocketPortMin > cfg->webSocketPortMax) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_websocket_port_min: min port must no= t be " + "greater than max port"), filename); + return -1; + } + + if (virConfGetValueUInt(conf, "remote_display_port_min", &cfg->remoteP= ortMin) < 0) + return -1; + if (cfg->remotePortMin < QEMU_REMOTE_PORT_MIN) { + /* if the port is too low, we can't get the display name + * to tell to vnc (usually subtract 5900, e.g. localhost:1 + * for port 5901) */ + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_display_port_min: port must be greate= r " + "than or equal to %d"), + filename, QEMU_REMOTE_PORT_MIN); + return -1; + } + + if (virConfGetValueUInt(conf, "remote_display_port_max", &cfg->remoteP= ortMax) < 0) + return -1; + if (cfg->remotePortMax > QEMU_REMOTE_PORT_MAX || + cfg->remotePortMax < cfg->remotePortMin) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_display_port_max: port must be betwe= en " + "the minimal port and %d"), + filename, QEMU_REMOTE_PORT_MAX); + return -1; + } + + if (cfg->remotePortMin > cfg->remotePortMax) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: remote_display_port_min: min port must not = be " + "greater than max port"), filename); + return -1; + } + + return 0; +} + static int virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -925,67 +995,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, =20 #undef GET_CONFIG_TLS_CERTINFO =20 - if (virConfGetValueUInt(conf, "remote_websocket_port_min", &cfg->webSo= cketPortMin) < 0) - goto cleanup; - if (cfg->webSocketPortMin < QEMU_WEBSOCKET_PORT_MIN) { - /* if the port is too low, we can't get the display name - * to tell to vnc (usually subtract 5700, e.g. localhost:1 - * for port 5701) */ - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_websocket_port_min: port must be grea= ter " - "than or equal to %d"), - filename, QEMU_WEBSOCKET_PORT_MIN); - goto cleanup; - } - - if (virConfGetValueUInt(conf, "remote_websocket_port_max", &cfg->webSo= cketPortMax) < 0) - goto cleanup; - if (cfg->webSocketPortMax > QEMU_WEBSOCKET_PORT_MAX || - cfg->webSocketPortMax < cfg->webSocketPortMin) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_websocket_port_max: port must be bet= ween " - "the minimal port and %d"), - filename, QEMU_WEBSOCKET_PORT_MAX); + if (virQEMUDriverConfigLoadRemoteDisplayEntry(cfg, conf, filename) < 0) goto cleanup; - } - - if (cfg->webSocketPortMin > cfg->webSocketPortMax) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_websocket_port_min: min port must no= t be " - "greater than max port"), filename); - goto cleanup; - } - - if (virConfGetValueUInt(conf, "remote_display_port_min", &cfg->remoteP= ortMin) < 0) - goto cleanup; - if (cfg->remotePortMin < QEMU_REMOTE_PORT_MIN) { - /* if the port is too low, we can't get the display name - * to tell to vnc (usually subtract 5900, e.g. localhost:1 - * for port 5901) */ - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_display_port_min: port must be greate= r " - "than or equal to %d"), - filename, QEMU_REMOTE_PORT_MIN); - goto cleanup; - } - - if (virConfGetValueUInt(conf, "remote_display_port_max", &cfg->remoteP= ortMax) < 0) - goto cleanup; - if (cfg->remotePortMax > QEMU_REMOTE_PORT_MAX || - cfg->remotePortMax < cfg->remotePortMin) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_display_port_max: port must be betwe= en " - "the minimal port and %d"), - filename, QEMU_REMOTE_PORT_MAX); - goto cleanup; - } - - if (cfg->remotePortMin > cfg->remotePortMax) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: remote_display_port_min: min port must not = be " - "greater than max port"), filename); - goto cleanup; - } =20 if (virQEMUDriverConfigLoadSaveEntry(cfg, conf) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558644151815.9031438934632; Tue, 15 Jan 2019 05:24:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 403A4DC900; Tue, 15 Jan 2019 13:24:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 034FB18EF2; Tue, 15 Jan 2019 13:24:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9A3E3184B54A; Tue, 15 Jan 2019 13:24:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNlSq011193 for ; Tue, 15 Jan 2019 08:23:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 036BD600C8; Tue, 15 Jan 2019 13:23:47 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DFFE5B08B for ; Tue, 15 Jan 2019 13:23:46 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:13 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/23] qemu_conf: split out virQEMUDriverConfigLoadSpecificTLS 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Jan 2019 13:24:03 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. This is the only patch that mixes various augeas entry groups in one function. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 71 ++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 317756d2a0..b5024705d8 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,47 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + int rv; + + if (virConfGetValueBool(conf, "vxhs_tls", &cfg->vxhsTLS) < 0) + return -1; + if (virConfGetValueString(conf, "vxhs_tls_x509_cert_dir", &cfg->vxhsTL= Sx509certdir) < 0) + return -1; + if (virConfGetValueBool(conf, "nbd_tls", &cfg->nbdTLS) < 0) + return -1; + if (virConfGetValueString(conf, "nbd_tls_x509_cert_dir", &cfg->nbdTLSx= 509certdir) < 0) + return -1; + +#define GET_CONFIG_TLS_CERTINFO(val) \ + do { \ + if ((rv =3D virConfGetValueBool(conf, #val "_tls_x509_verify", \ + &cfg->val## TLSx509verify)) < 0) \ + return -1; \ + if (rv =3D=3D 1) \ + cfg->val## TLSx509verifyPresent =3D true; \ + if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", \ + &cfg->val## TLSx509certdir) < 0) \ + return -1; \ + if (virConfGetValueString(conf, \ + #val "_tls_x509_secret_uuid", \ + &cfg->val## TLSx509secretUUID) < 0) \ + return -1; \ + } while (0) + + if (virConfGetValueBool(conf, "chardev_tls", &cfg->chardevTLS) < 0) + return -1; + GET_CONFIG_TLS_CERTINFO(chardev); + + GET_CONFIG_TLS_CERTINFO(migrate); + +#undef GET_CONFIG_TLS_CERTINFO + return 0; +} + static int virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf, @@ -962,38 +1003,10 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigP= tr cfg, goto cleanup; if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAut= oUnixSocket) < 0) goto cleanup; - if (virConfGetValueBool(conf, "vxhs_tls", &cfg->vxhsTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "vxhs_tls_x509_cert_dir", &cfg->vxhsTL= Sx509certdir) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "nbd_tls", &cfg->nbdTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "nbd_tls_x509_cert_dir", &cfg->nbdTLSx= 509certdir) < 0) goto cleanup; =20 -#define GET_CONFIG_TLS_CERTINFO(val) \ - do { \ - if ((rv =3D virConfGetValueBool(conf, #val "_tls_x509_verify", \ - &cfg->val## TLSx509verify)) < 0) \ - goto cleanup; \ - if (rv =3D=3D 1) \ - cfg->val## TLSx509verifyPresent =3D true; \ - 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; \ - } while (0) - - if (virConfGetValueBool(conf, "chardev_tls", &cfg->chardevTLS) < 0) + if (virQEMUDriverConfigLoadSpecificTLSEntry(cfg, conf) < 0) goto cleanup; - GET_CONFIG_TLS_CERTINFO(chardev); - - GET_CONFIG_TLS_CERTINFO(migrate); - -#undef GET_CONFIG_TLS_CERTINFO =20 if (virQEMUDriverConfigLoadRemoteDisplayEntry(cfg, conf, filename) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558658408142.7249704602176; Tue, 15 Jan 2019 05:24:18 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FBC089ACD; Tue, 15 Jan 2019 13:24:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3A5E19C7C; Tue, 15 Jan 2019 13:24:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5B00D3F605; Tue, 15 Jan 2019 13:24:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNlCE011199 for ; Tue, 15 Jan 2019 08:23:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id D23B55C6E4; Tue, 15 Jan 2019 13:23:47 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 539BB600C8 for ; Tue, 15 Jan 2019 13:23:47 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:14 +0100 Message-Id: <25e974539041f4309dc58cabe755c4e79a1ea8bd.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 18/23] qemu_conf: split out virQEMUDriverConfigLoadSPICEEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 15 Jan 2019 13:24:17 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b5024705d8..d3f266e338 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,28 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) + return -1; + if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spice= TLSx509certdir) < 0) + return -1; + if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) + return -1; + if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) = < 0) + return -1; + if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) + return -1; + if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword)= < 0) + return -1; + if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAut= oUnixSocket) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -988,21 +1010,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, if (virConfGetValueBool(conf, "nographics_allow_host_audio", &cfg->nog= fxAllowHostAudio) < 0) goto cleanup; =20 - - if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spice= TLSx509certdir) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) = < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword)= < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAut= oUnixSocket) < 0) - goto cleanup; + if (virQEMUDriverConfigLoadSPICEEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadSpecificTLSEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558649615899.5239489235007; Tue, 15 Jan 2019 05:24:09 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6247A3F75C; Tue, 15 Jan 2019 13:24:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 290AA1084260; Tue, 15 Jan 2019 13:24:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C49F118436BF; Tue, 15 Jan 2019 13:24:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNmqi011209 for ; Tue, 15 Jan 2019 08:23:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id A3A0B18B4E; Tue, 15 Jan 2019 13:23:48 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 286A2600C8 for ; Tue, 15 Jan 2019 13:23:47 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:15 +0100 Message-Id: <75b6fc5088e07e6e924f6acce759962858439898.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 19/23] qemu_conf: split out virQEMUDriverConfigLoadNographicsEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Jan 2019 13:24:08 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index d3f266e338..62c49c600c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,16 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadNographicsEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueBool(conf, "nographics_allow_host_audio", &cfg->nog= fxAllowHostAudio) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -1007,7 +1017,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, goto cleanup; if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHo= stAudio) < 0) goto cleanup; - if (virConfGetValueBool(conf, "nographics_allow_host_audio", &cfg->nog= fxAllowHostAudio) < 0) + + if (virQEMUDriverConfigLoadNographicsEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadSPICEEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558655465938.5587361607629; Tue, 15 Jan 2019 05:24:15 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD5EB8F4EA; Tue, 15 Jan 2019 13:24:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71EE319744; Tue, 15 Jan 2019 13:24:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 039E23F606; Tue, 15 Jan 2019 13:24:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNnkl011225 for ; Tue, 15 Jan 2019 08:23:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7B83518B4E; Tue, 15 Jan 2019 13:23:49 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1C56600C8 for ; Tue, 15 Jan 2019 13:23:48 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:16 +0100 Message-Id: <59d3ad7f282f30fa78d22398236cd10e88d7900b.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/23] qemu_conf: split out virQEMUDriverConfigLoadVNCEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 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]); Tue, 15 Jan 2019 13:24:14 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 50 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 62c49c600c..7eecb3ef91 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,36 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + int rv; + + if (virConfGetValueBool(conf, "vnc_auto_unix_socket", &cfg->vncAutoUni= xSocket) < 0) + return -1; + if (virConfGetValueBool(conf, "vnc_tls", &cfg->vncTLS) < 0) + return -1; + if ((rv =3D virConfGetValueBool(conf, "vnc_tls_x509_verify", &cfg->vnc= TLSx509verify)) < 0) + return -1; + if (rv =3D=3D 1) + cfg->vncTLSx509verifyPresent =3D true; + if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir", &cfg->vncTLSx= 509certdir) < 0) + return -1; + if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0) + return -1; + if (virConfGetValueString(conf, "vnc_password", &cfg->vncPassword) < 0) + return -1; + if (virConfGetValueBool(conf, "vnc_sasl", &cfg->vncSASL) < 0) + return -1; + if (virConfGetValueString(conf, "vnc_sasl_dir", &cfg->vncSASLdir) < 0) + return -1; + if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHo= stAudio) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadNographicsEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -997,25 +1027,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, &cfg->defaultTLSx509secretUUID) < 0) goto cleanup; =20 - if (virConfGetValueBool(conf, "vnc_auto_unix_socket", &cfg->vncAutoUni= xSocket) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "vnc_tls", &cfg->vncTLS) < 0) - goto cleanup; - if ((rv =3D virConfGetValueBool(conf, "vnc_tls_x509_verify", &cfg->vnc= TLSx509verify)) < 0) - goto cleanup; - if (rv =3D=3D 1) - cfg->vncTLSx509verifyPresent =3D true; - if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir", &cfg->vncTLSx= 509certdir) < 0) - goto cleanup; - if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0) - goto cleanup; - if (virConfGetValueString(conf, "vnc_password", &cfg->vncPassword) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "vnc_sasl", &cfg->vncSASL) < 0) - goto cleanup; - if (virConfGetValueString(conf, "vnc_sasl_dir", &cfg->vncSASLdir) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHo= stAudio) < 0) + if (virQEMUDriverConfigLoadVNCEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadNographicsEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558643388155.71294880120706; Tue, 15 Jan 2019 05:24:03 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D09AC7AE98; Tue, 15 Jan 2019 13:24:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 921B65D777; Tue, 15 Jan 2019 13:24:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 12467184B54B; Tue, 15 Jan 2019 13:24:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNoiX011232 for ; Tue, 15 Jan 2019 08:23:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4D7CC18B4E; Tue, 15 Jan 2019 13:23:50 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id C877A6031B for ; Tue, 15 Jan 2019 13:23:49 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:17 +0100 Message-Id: <0b2bfb63a7f310824048c8bb1be2dba44da6e7a9.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 21/23] qemu_conf: split out virQEMUDriverConfigLoadDefaultTLSEntry 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:24:01 +0000 (UTC) Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 7eecb3ef91..0877a5b7c1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,24 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr huget= lbfs, } =20 =20 +static int +virQEMUDriverConfigLoadDefaultTLSEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + int rv; + + if ((rv =3D virConfGetValueString(conf, "default_tls_x509_cert_dir", &= cfg->defaultTLSx509certdir)) < 0) + return -1; + cfg->checkdefaultTLSx509certdir =3D (rv =3D=3D 1); + if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->default= TLSx509verify) < 0) + return -1; + if (virConfGetValueString(conf, "default_tls_x509_secret_uuid", + &cfg->defaultTLSx509secretUUID) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -485,6 +503,7 @@ virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPt= r cfg, return 0; } =20 + static int virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -1003,7 +1022,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, { virConfPtr conf =3D NULL; int ret =3D -1; - int rv; char **hugetlbfs =3D NULL; char *corestr =3D NULL; =20 @@ -1018,13 +1036,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigP= tr cfg, if (!(conf =3D virConfReadFile(filename, 0))) goto cleanup; =20 - if ((rv =3D virConfGetValueString(conf, "default_tls_x509_cert_dir", &= cfg->defaultTLSx509certdir)) < 0) - goto cleanup; - cfg->checkdefaultTLSx509certdir =3D (rv =3D=3D 1); - if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->default= TLSx509verify) < 0) - goto cleanup; - if (virConfGetValueString(conf, "default_tls_x509_secret_uuid", - &cfg->defaultTLSx509secretUUID) < 0) + if (virQEMUDriverConfigLoadDefaultTLSEntry(cfg, conf) < 0) goto cleanup; =20 if (virQEMUDriverConfigLoadVNCEntry(cfg, conf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558661891690.8421132124903; Tue, 15 Jan 2019 05:24:21 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8A9692A6B; Tue, 15 Jan 2019 13:24:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61BA15C239; Tue, 15 Jan 2019 13:24:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0C87318434BE; Tue, 15 Jan 2019 13:24:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNp5i011240 for ; Tue, 15 Jan 2019 08:23:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 20AF56031B; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B7F05C7A0 for ; Tue, 15 Jan 2019 13:23:50 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 22/23] qemu_conf: rename checkdefaultTLSx509certdir 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 15 Jan 2019 13:24:20 +0000 (UTC) Use defaultTLSx509certdirPresent for consistencty. Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 4 ++-- src/qemu/qemu_conf.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 0877a5b7c1..0aa428b87f 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -431,7 +431,7 @@ virQEMUDriverConfigLoadDefaultTLSEntry(virQEMUDriverCon= figPtr cfg, =20 if ((rv =3D virConfGetValueString(conf, "default_tls_x509_cert_dir", &= cfg->defaultTLSx509certdir)) < 0) return -1; - cfg->checkdefaultTLSx509certdir =3D (rv =3D=3D 1); + cfg->defaultTLSx509certdirPresent =3D (rv =3D=3D 1); if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->default= TLSx509verify) < 0) return -1; if (virConfGetValueString(conf, "default_tls_x509_secret_uuid", @@ -1107,7 +1107,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, int virQEMUDriverConfigValidate(virQEMUDriverConfigPtr cfg) { - if (cfg->checkdefaultTLSx509certdir) { + if (cfg->defaultTLSx509certdirPresent) { if (!virFileExists(cfg->defaultTLSx509certdir)) { virReportError(VIR_ERR_CONF_SYNTAX, _("default_tls_x509_cert_dir directory '%s' " diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 87e730058b..bce8364c5a 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -115,7 +115,7 @@ struct _virQEMUDriverConfig { char *swtpmStorageDir; =20 char *defaultTLSx509certdir; - bool checkdefaultTLSx509certdir; + bool defaultTLSx509certdirPresent; bool defaultTLSx509verify; char *defaultTLSx509secretUUID; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 04:09:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547558665975990.3680380339902; Tue, 15 Jan 2019 05:24:25 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54ACCCD4D1; Tue, 15 Jan 2019 13:24:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91D835D778; Tue, 15 Jan 2019 13:24:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 47745184B54A; Tue, 15 Jan 2019 13:24:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FDNpk9011258 for ; Tue, 15 Jan 2019 08:23:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id E98EA6031B; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) Received: from lpt.brq.redhat.com (unknown [10.43.2.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FB2F600C8 for ; Tue, 15 Jan 2019 13:23:51 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 15 Jan 2019 14:23:19 +0100 Message-Id: <79c1c7b9547cb5dad30160c58951e430734cb4aa.1547558465.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 23/23] qemu_conf: fix stray space 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Jan 2019 13:24:25 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko Reviewed-by: John Ferlan --- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 0aa428b87f..18ad99c173 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -915,7 +915,7 @@ virQEMUDriverConfigLoadSecurityEntry(virQEMUDriverConfi= gPtr cfg, goto cleanup; =20 if (controllers) { - cfg-> cgroupControllers =3D 0; + cfg->cgroupControllers =3D 0; for (i =3D 0; controllers[i] !=3D NULL; i++) { int ctl; if ((ctl =3D virCgroupControllerTypeFromString(controllers[i])= ) < 0) { --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list