From nobody Sun Feb 8 17:46:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678812812; cv=none; d=zohomail.com; s=zohoarc; b=SqEIImT2HVpxRHX/uuAtrNENYdEpoPU1f+zbV52FHHdqlPtxF/5f3b58nZgbU4LNArTmK2BBqIGVc4JPOp9woTA/BgO+WJ6vlR1Jo3qnO/Gu54zJubj9VFxwTIKAOO7uRqm/qgtX+bQOSIwHDzniOtwYhWI2wkuUKRT3QKW7CE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678812812; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yQKfQUmiZLoWdGksyE69hqVLntTupxRx8vutGDfVM0A=; b=i+dypW7h6JVG3qD/LyxHDsSyOtbpwvq6FMOuc6Aa0u5sQwOcqvGeAy6nc9lfq84nk0LDszXmy4MR2plr8rEDKs7kxc+03OJ0QjAzpBd30In1B68UtWz2CaGgsZKvvwBWSSq7ahRNsBkYOrFdF10H6bLQs3Q4QQOXoYFqk/6J+Fo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678812812472936.6791535482623; Tue, 14 Mar 2023 09:53:32 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-PNWrIrByNvWMv2PuMvQjHQ-1; Tue, 14 Mar 2023 12:53:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5629104456B; Tue, 14 Mar 2023 16:53:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99FA420316DA; Tue, 14 Mar 2023 16:53:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A0AD119472F5; Tue, 14 Mar 2023 16:53:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E207419465B2 for ; Tue, 14 Mar 2023 16:52:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 129352166B35; Tue, 14 Mar 2023 16:52:38 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACD402166B26 for ; Tue, 14 Mar 2023 16:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678812811; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yQKfQUmiZLoWdGksyE69hqVLntTupxRx8vutGDfVM0A=; b=epQyoi6m0zxxUE6GtyBDXITs+6kLaRUGpf8fpvro1D7tLM0Ol3zDikS2E0mqUnHLpiVaGx K8/08/F4kUW0xtVE0OFbWmVwxe2iCtIvFlwFjDB8qo04TID328BryxgzuF+Sz84fezVXk9 InQ5MnnSiD6o67jqGEBdN8Xrtoqzp8c= X-MC-Unique: PNWrIrByNvWMv2PuMvQjHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 11/15] qemu: Add @nodemaskRet argument to qemuBuildMemoryBackendProps() Date: Tue, 14 Mar 2023 17:52:25 +0100 Message-Id: <7e69de957db7e8d001e7741e6ec8533b202be8e0.1678812657.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678812814079100001 Content-Type: text/plain; charset="utf-8"; x-default="true" While it's true that anybody who's interested in getting .host-nodes attribute value can just use virJSONValueObjectGetArray() (and that's exactly what qemuBuildThreadContextProps() is doing, btw), if somebody is interested in getting the actual virBitmap, they would have to parse the JSON array. Instead, introduce an argument to qemuBuildMemoryBackendProps() which is set to corresponding value used when formatting the attribute. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- src/qemu/qemu_command.c | 14 ++++++++++---- src/qemu/qemu_command.h | 4 +++- src/qemu/qemu_hotplug.c | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b0cb252d0b..15ba3c02d1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3240,6 +3240,7 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, * @def: domain definition object * @mem: memory definition object * @force: forcibly use one of the backends + * @nodemaskRet: [out] bitmap used to format .host-nodes attribute * * Creates a configuration object that represents memory backend of given = guest * NUMA node (domain @def and @mem). Use @priv->autoNodeset to fine tune t= he @@ -3264,7 +3265,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, const virDomainDef *def, const virDomainMemoryDef *mem, bool force, - bool systemMemory) + bool systemMemory, + virBitmap **nodemaskRet) { const char *backendType =3D "memory-backend-file"; virDomainNumatuneMemMode mode; @@ -3451,6 +3453,9 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, "S:policy", qemuNumaPolicyTypeToStri= ng(mode), NULL) < 0) return -1; + + if (nodemaskRet) + *nodemaskRet =3D nodemask; } } =20 @@ -3504,7 +3509,8 @@ qemuBuildMemoryCellBackendProps(virDomainDef *def, mem.targetNode =3D cell; mem.info.alias =3D alias; =20 - return qemuBuildMemoryBackendProps(props, alias, cfg, priv, def, &mem,= false, false); + return qemuBuildMemoryBackendProps(props, alias, cfg, priv, + def, &mem, false, false, NULL); } =20 =20 @@ -3528,7 +3534,7 @@ qemuBuildMemoryDimmBackendStr(virCommand *cmd, alias =3D g_strdup_printf("mem%s", mem->info.alias); =20 if (qemuBuildMemoryBackendProps(&props, alias, cfg, - priv, def, mem, true, false) < 0) + priv, def, mem, true, false, NULL) < 0) return -1; =20 if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0) @@ -7179,7 +7185,7 @@ qemuBuildMemCommandLineMemoryDefaultBackend(virComman= d *cmd, mem.info.alias =3D (char *) defaultRAMid; =20 if (qemuBuildMemoryBackendProps(&props, defaultRAMid, cfg, - priv, def, &mem, false, true) < 0) + priv, def, &mem, false, true, NULL) < = 0) return -1; =20 if (qemuBuildThreadContextProps(&tcProps, &props, priv) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index c49096a057..9074822bc5 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -22,6 +22,7 @@ #pragma once =20 #include "domain_conf.h" +#include "virbitmap.h" #include "vircommand.h" #include "virenum.h" #include "qemu_block.h" @@ -140,7 +141,8 @@ int qemuBuildMemoryBackendProps(virJSONValue **backendP= rops, const virDomainDef *def, const virDomainMemoryDef *mem, bool force, - bool systemMemory); + bool systemMemory, + virBitmap **nodemaskRet); =20 virJSONValue * qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index da17525824..b9f6a031de 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2280,7 +2280,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver, goto cleanup; =20 if (qemuBuildMemoryBackendProps(&props, objalias, cfg, - priv, vm->def, mem, true, false) < 0) + priv, vm->def, mem, true, false, NULL)= < 0) goto cleanup; =20 if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0) --=20 2.39.2