From nobody Sat May 4 16:41:33 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1519265359170282.3486274158864; Wed, 21 Feb 2018 18:09:19 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AABFE81F0C; Thu, 22 Feb 2018 02:09:16 +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 12E51608F6; Thu, 22 Feb 2018 02:09: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 644F718033EA; Thu, 22 Feb 2018 02:09:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1M29BrM002935 for ; Wed, 21 Feb 2018 21:09:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B4075D793; Thu, 22 Feb 2018 02:09:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 540F25D75D for ; Thu, 22 Feb 2018 02:09:09 +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 1D1355D5ED for ; Thu, 22 Feb 2018 02:09:08 +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); Wed, 21 Feb 2018 19:09:06 -0700 From: Jim Fehlig To: libvir-list@redhat.com Date: Wed, 21 Feb 2018 19:08:41 -0700 Message-Id: <20180222020841.20229-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 22 Feb 2018 02:09:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 22 Feb 2018 02:09:08 +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: -2.301 (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.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] libxl: round memory values to next 1MiB increment 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 22 Feb 2018 02:09:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" libxl requires the memory sizes to be rounded to 1MiB increments. Attempting to start a domain that violates this requirement will fail with the marginally helpful error 2018-02-22 01:55:32.921+0000: xc: panic: xc_dom_boot.c:141: xc_dom_boot_mem= _init: can't allocate low memory for domain: Out of memory 2018-02-22 01:55:32.921+0000: libxl: libxl_dom.c:671:libxl__build_dom: xc_d= om_boot_mem_init failed: No such file or directory Round the maximum and current memory values to the next 1MiB increment when generating the libxl_domain_config object. Signed-off-by: Jim Fehlig --- The memory values could also be adjusted in the post parse callback, which might be better since the virDomainDef object would then reflect the actual values given to libxl. In general, I often find myself confused about the dividing line between adjusting such things in the post parse callback vs domain creation. src/libxl/libxl_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 57cb4c0ad..02bbf4e28 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -367,8 +367,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, } =20 b_info->sched_params.weight =3D 1000; - b_info->max_memkb =3D virDomainDefGetMemoryInitial(def); - b_info->target_memkb =3D def->mem.cur_balloon; + b_info->max_memkb =3D VIR_ROUND_UP(virDomainDefGetMemoryInitial(def), = 1024); + b_info->target_memkb =3D VIR_ROUND_UP(def->mem.cur_balloon, 1024); if (hvm) { char bootorder[VIR_DOMAIN_BOOT_LAST + 1]; =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list