From nobody Wed Nov 27 14:45:37 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 1544011330348916.0215249238795; Wed, 5 Dec 2018 04:02:10 -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 7B09D5277D; Wed, 5 Dec 2018 12:02: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 7CDB36012C; Wed, 5 Dec 2018 12:02:06 +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 13D1C1800540; Wed, 5 Dec 2018 12:02:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB5C227Z014404 for ; Wed, 5 Dec 2018 07:02:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE14D4F9AB; Wed, 5 Dec 2018 12:02:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA12A5D97E; Wed, 5 Dec 2018 12:01:58 +0000 (UTC) Received: from mail.univention.de (mail.univention.de [82.198.197.8]) (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 F192AC057E3A; Wed, 5 Dec 2018 12:01:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id 6F444468F26D; Wed, 5 Dec 2018 13:01:50 +0100 (CET) Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QZFfmuHd9cdW; Wed, 5 Dec 2018 13:01:42 +0100 (CET) Received: from fixa.knut.univention.de (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 6FF0A468F1D6; Wed, 5 Dec 2018 13:01:13 +0100 (CET) Received: by fixa.knut.univention.de (Postfix, from userid 2260) id 2A2DD15FA64; Wed, 5 Dec 2018 13:01:13 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at knut.univention.de From: Philipp Hahn To: libvir-list@redhat.com Date: Wed, 5 Dec 2018 13:01:13 +0100 Message-Id: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Dec 2018 12:01:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Dec 2018 12:01:52 +0000 (UTC) for IP:'82.198.197.8' DOMAIN:'mail.univention.de' HELO:'mail.univention.de' FROM:'hahn@univention.de' RCPT:'' X-RedHat-Spam-Score: -0.011 (RCVD_IN_DNSWL_NONE, SPF_PASS) 82.198.197.8 mail.univention.de 82.198.197.8 mail.univention.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Michal Privoznik Subject: [libvirt] [PATCH libvirt-python] virNodeInfo.memory is in KiB 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 05 Dec 2018 12:02:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" but the Python library does an extra left shift of 10 bits returning MiB instead: > # cat y.c > #include > #include > #include > int main(void) { > virConnectPtr conn =3D virConnectOpen("qemu:///system"); > virNodeInfo info; > int rv =3D virNodeGetInfo(conn, &info); > printf("%ld\n", info.memory); > return rv; > } > # gcc y.c -I/usr/include/libvirt -lvirt > # ./a.out > 4041088 > # python -c 'import libvirt;c=3Dlibvirt.open("qemu:///system");print(c.ge= tInfo()[1])' > 3946 Fixes: 197153c6 Signed-off-by: Philipp Hahn --- libvirt-override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-override.c b/libvirt-override.c index f7b2f6b..616fa1c 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2740,7 +2740,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSE= D, VIR_PY_LIST_SET_GOTO(py_retval, 0, libvirt_constcharPtrWrap(&info.model[0]), error); VIR_PY_LIST_SET_GOTO(py_retval, 1, - libvirt_longWrap((long) info.memory >> 10), error= ); + libvirt_longWrap((long) info.memory), error); VIR_PY_LIST_SET_GOTO(py_retval, 2, libvirt_intWrap((int) info.cpus), e= rror); VIR_PY_LIST_SET_GOTO(py_retval, 3, libvirt_intWrap((int) info.mhz), er= ror); VIR_PY_LIST_SET_GOTO(py_retval, 4, libvirt_intWrap((int) info.nodes), = error); --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list