From nobody Sat Apr 27 14:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1486075406470753.9745178949566; Thu, 2 Feb 2017 14:43:26 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12Me1JY013608; Thu, 2 Feb 2017 17:40:01 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12Mdxpd025134 for ; Thu, 2 Feb 2017 17:39:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id A8984BEDDD; Thu, 2 Feb 2017 22:39:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A3B63BEDD5 for ; Thu, 2 Feb 2017 22:39:59 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF6583B702 for ; Thu, 2 Feb 2017 22:39:58 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Thu, 02 Feb 2017 15:39:53 -0700 From: Jim Fehlig To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 15:39:44 -0700 Message-Id: <20170202223945.22203-2-jfehlig@suse.com> In-Reply-To: <20170202223945.22203-1-jfehlig@suse.com> References: <20170202223945.22203-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 Feb 2017 22:39:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 Feb 2017 22:39:59 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.501 (BAYES_50, RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] libxl: honor autoballoon setting in libxl.conf X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" libxlGetAutoballoonConf is supposed to honor user-specified autoballoon setting in libxl.conf. As written, the user-specified setting could be overwritten by the subsequent logic to check dom0_mem parameter. If user-specified setting is present and correct, accept it. Only fallback to checking Xen dom0_mem command line parameter if user-specfied setting is not present. Signed-off-by: Jim Fehlig Reviewed-by: Joao Martins --- src/libxl/libxl_conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index b5186f2..ee1e639 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1355,8 +1355,11 @@ libxlGetAutoballoonConf(libxlDriverConfigPtr cfg, regex_t regex; int res; =20 - if (virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon) < 0) + res =3D virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon); + if (res < 0) return -1; + else if (res =3D=3D 1) + return 0; =20 if ((res =3D regcomp(®ex, "(^| )dom0_mem=3D((|min:|max:)[0-9]+[bBkKmMgG]?,?)+(= $| )", --=20 2.9.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1486075404414733.8233342207286; Thu, 2 Feb 2017 14:43:24 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12Me8Hf041853; Thu, 2 Feb 2017 17:40:08 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v12Mdx0p025142 for ; Thu, 2 Feb 2017 17:39:59 -0500 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v12Mdxmi032253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 2 Feb 2017 17:39:59 -0500 Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1071980F8E for ; Thu, 2 Feb 2017 22:39:59 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Thu, 02 Feb 2017 15:39:53 -0700 From: Jim Fehlig To: libvir-list@redhat.com Date: Thu, 2 Feb 2017 15:39:45 -0700 Message-Id: <20170202223945.22203-3-jfehlig@suse.com> In-Reply-To: <20170202223945.22203-1-jfehlig@suse.com> References: <20170202223945.22203-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 02 Feb 2017 22:39:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 02 Feb 2017 22:39:59 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.501 (BAYES_50, RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] libxl: use init and dispose functions with libxl_physinfo X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The typical pattern when calling libxl functions that populate a structure is libxl_foo foo; libxl_foo_init(&foo); libxl_get_foo(ctx, &foo); ... libxl_foo_dispose(&foo); Fix several instances of libxl_physinfo missing the init and dispose calls. Signed-off-by: Jim Fehlig Acked-by: Joao Martins Reviewed-by: Joao Martins --- src/libxl/libxl_capabilities.c | 16 +++++++++++----- src/libxl/libxl_conf.c | 2 ++ src/libxl/libxl_driver.c | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index a1c0a87..2bbd2d1 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -211,27 +211,33 @@ libxlCapsInitHost(libxl_ctx *ctx, virCapsPtr caps) const libxl_version_info *ver_info; enum libxlHwcapVersion version; libxl_physinfo phy_info; + int ret =3D -1; =20 + libxl_physinfo_init(&phy_info); if (libxl_get_physinfo(ctx, &phy_info) !=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get node physical info from libxenligh= t")); - return -1; + goto cleanup; } =20 if ((ver_info =3D libxl_get_version_info(ctx)) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get version info from libxenlight")); - return -1; + goto cleanup; } =20 version =3D (ver_info->xen_version_minor >=3D 7); if (libxlCapsInitCPU(caps, &phy_info, version) < 0) - return -1; + goto cleanup; =20 if (virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN) < 0) - return -1; + goto cleanup; =20 - return 0; + ret =3D 0; + + cleanup: + libxl_physinfo_dispose(&phy_info); + return ret; } =20 static int diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index ee1e639..28b05e1 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1943,6 +1943,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver, = virNodeInfoPtr info) libxlDriverConfigPtr cfg =3D libxlDriverConfigGet(driver); int ret =3D -1; =20 + libxl_physinfo_init(&phy_info); if (libxl_get_physinfo(cfg->ctx, &phy_info)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_physinfo_info failed")); @@ -1967,6 +1968,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver, = virNodeInfoPtr info) ret =3D 0; =20 cleanup: + libxl_physinfo_dispose(&phy_info); virObjectUnref(cfg); return ret; } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 3a69720..8951bef 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4286,6 +4286,7 @@ libxlNodeGetFreeMemory(virConnectPtr conn) if (virNodeGetFreeMemoryEnsureACL(conn) < 0) goto cleanup; =20 + libxl_physinfo_init(&phy_info); if (libxl_get_physinfo(cfg->ctx, &phy_info)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_physinfo_info failed")); @@ -4295,6 +4296,7 @@ libxlNodeGetFreeMemory(virConnectPtr conn) ret =3D phy_info.free_pages * cfg->verInfo->pagesize; =20 cleanup: + libxl_physinfo_dispose(&phy_info); virObjectUnref(cfg); return ret; } --=20 2.9.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list