From nobody Tue Feb 10 13:36:22 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=quarantine dis=none) header.from=swemel.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1702566638930825.4977835440394; Thu, 14 Dec 2023 07:10:38 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D23401A6B; Thu, 14 Dec 2023 10:10:37 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BDAA41A0B; Thu, 14 Dec 2023 09:54:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2407117B9; Thu, 14 Dec 2023 09:52:11 -0500 (EST) Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3430217F1 for ; Thu, 14 Dec 2023 09:52:03 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Dmitry Frolov To: devel@lists.libvirt.org Subject: [PATCH v2 05/14] libxl: turn libxl_get_physinfo() to void Date: Thu, 14 Dec 2023 17:50:57 +0300 Message-Id: <20231214145105.1808088-6-frolov@swemel.ru> In-Reply-To: <20231214145105.1808088-1-frolov@swemel.ru> References: <20231214145105.1808088-1-frolov@swemel.ru> MIME-Version: 1.0 Message-ID-Hash: LICQHX4CPAGGYJLWPNQWUGCFPALY5U42 X-Message-ID-Hash: LICQHX4CPAGGYJLWPNQWUGCFPALY5U42 X-MailFrom: frolov@swemel.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: sdl.libvirt@linuxtesting.org, Dmitry Frolov X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1702566639622100001 libxl_get_physinfo() always returns 0. Signed-off-by: Dmitry Frolov --- src/libxl/libxl_capabilities.c | 6 +----- src/libxl/libxl_conf.c | 20 +++++--------------- src/libxl/libxl_driver.c | 6 +----- tests/libxlmock.c | 5 +---- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 836f46341a..e141873775 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -170,11 +170,7 @@ libxlCapsInitHost(libxl_ctx *ctx, virCaps *caps) 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")); - goto cleanup; - } + libxl_get_physinfo(ctx, &phy_info); =20 if (libxlCapsInitCPU(caps, &phy_info) < 0) goto cleanup; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 62e1be6672..82f4dd80a2 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -856,12 +856,8 @@ libxlMakeVnumaList(virDomainDef *def, return 0; =20 libxl_physinfo_init(&physinfo); - if (libxl_get_physinfo(ctx, &physinfo) < 0) { - libxl_physinfo_dispose(&physinfo); - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libxl_get_physinfo_info failed")); - return -1; - } + libxl_get_physinfo(ctx, &physinfo); + nr_nodes =3D physinfo.nr_nodes; libxl_physinfo_dispose(&physinfo); =20 @@ -1927,10 +1923,8 @@ libxlDriverGetDom0MaxmemConf(libxlDriverConfig *cfg, physmem: /* No 'max' specified in dom0_mem, so dom0 can use all physical memory= */ libxl_physinfo_init(&physinfo); - if (libxl_get_physinfo(cfg->ctx, &physinfo)) { - VIR_WARN("libxl_get_physinfo failed"); - return -1; - } + libxl_get_physinfo(cfg->ctx, &physinfo); + *maxmem =3D (physinfo.total_pages * cfg->verInfo->pagesize) / 1024; libxl_physinfo_dispose(&physinfo); return 0; @@ -2405,11 +2399,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivate *driver, v= irNodeInfoPtr info) 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")); - goto cleanup; - } + libxl_get_physinfo(cfg->ctx, &phy_info); =20 if (virStrcpyStatic(info->model, virArchToString(hostarch)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c98d2d737a..d218cc63dc 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4489,11 +4489,7 @@ libxlNodeGetFreeMemory(virConnectPtr conn) if (virNodeGetFreeMemoryEnsureACL(conn) < 0) goto cleanup; =20 - if (libxl_get_physinfo(cfg->ctx, &phy_info)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libxl_get_physinfo_info failed")); - goto cleanup; - } + libxl_get_physinfo(cfg->ctx, &phy_info); =20 ret =3D phy_info.free_pages * cfg->verInfo->pagesize; =20 diff --git a/tests/libxlmock.c b/tests/libxlmock.c index f564a0ef72..87796e780d 100644 --- a/tests/libxlmock.c +++ b/tests/libxlmock.c @@ -68,8 +68,7 @@ VIR_MOCK_IMPL_RET_ARGS(libxl_get_version_info, return &info; } =20 -VIR_MOCK_IMPL_RET_ARGS(libxl_get_physinfo, - int, +VIR_MOCK_IMPL_VOID_ARGS(libxl_get_physinfo, libxl_ctx *, ctx, libxl_physinfo *, physinfo) { @@ -79,8 +78,6 @@ VIR_MOCK_IMPL_RET_ARGS(libxl_get_physinfo, /* silence gcc warning about unused function */ if (0) real_libxl_get_physinfo(ctx, physinfo); - - return 0; } =20 VIR_MOCK_STUB_RET_ARGS(libxl_get_free_memory, --=20 2.34.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org