From nobody Mon Feb 9 09:15:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1633621011; cv=none; d=zohomail.com; s=zohoarc; b=gapyrGHS0Dn7RgwhkkoaoUvkHMXp/Q4tJ7Tb09ZXQYV4EoqKeegi6NwVo/tZBH8+sJu/7ooWdYTVrw93lsOX8M3r6KkgTWiVVu1+QC3I9oPpkh2tgWrd+wjp0b88ACDTg95Lx1kwtioglcQFhWBHXQOC0Hj/0MdgjLn+ues9V/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633621011; 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=ChHLqVYXi3R5pTRXjnbxoX7JBlTSsLwdU3M19s4f9n0=; b=euadmgp+bTtkO191y3q6BmPZ4kzQRqEigiEyUsld/LD9tybn4H98u9SvxaOJYYMHdNhR8kI6gUA4ME2OwhMuHEmfrEUt2+beuh/N12biAFfRBpcuxmqsFGhOIVdJMomsr7YieS7++YaLmeiNXzM1w8+kTMteNVoK/dwrC80A0fs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1633621011255801.8046695031433; Thu, 7 Oct 2021 08:36:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-OOFvX5NhNcyArdnPjZnFzQ-1; Thu, 07 Oct 2021 11:36:48 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6601D8EC790; Thu, 7 Oct 2021 15:29:11 +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 4891B37F5B; Thu, 7 Oct 2021 15:29:11 +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 F06661806D02; Thu, 7 Oct 2021 15:29:10 +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 197FKYoH024169 for ; Thu, 7 Oct 2021 11:20:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCE835F4F4; Thu, 7 Oct 2021 15:20:34 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 209B65F50C for ; Thu, 7 Oct 2021 15:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633621010; 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=ChHLqVYXi3R5pTRXjnbxoX7JBlTSsLwdU3M19s4f9n0=; b=igvZ1cr7SQAXxli4wHrap9bUMFzsRszbIrjJY17BDZUadnhTnBGtu205PnUq37Erhs3BiM Pb692u+Mc8qGlzePGyNEU6esN8HGv924tRxwRw42fa+0AQaPZP5eUlUbEncwkcr7fhVxk7 BkODIfnObcDA/GLec8oIKgT4xgLj65k= X-MC-Unique: OOFvX5NhNcyArdnPjZnFzQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 060/103] qemuBuildMemballoonCommandLine: Generate via JSON Date: Thu, 7 Oct 2021 17:17:48 +0200 Message-Id: <3b4dd9796e3afd1e43acdf4f85a01b0e8d84b098.1633619630.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1633621013384100001 Content-Type: text/plain; charset="utf-8" The generated properties have the following types according to QEMU: deflate-on-oom=3D - on/off (default: false) free-page-reporting=3D - on/off (default: false) Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cbd0b2890f..9b2e2f2719 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4210,36 +4210,35 @@ qemuBuildMemballoonCommandLine(virCommand *cmd, const virDomainDef *def, virQEMUCaps *qemuCaps) { - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + g_autoptr(virJSONValue) props =3D NULL; if (!virDomainDefHasMemballoon(def)) return 0; - if (qemuBuildVirtioDevStr(&buf, qemuCaps, - VIR_DOMAIN_DEVICE_MEMBALLOON, - def->memballoon) < 0) { + if (!(props =3D qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_MEMBALLOON, + def->memballoon, qemuCaps))) return -1; - } - virBufferAsprintf(&buf, ",id=3D%s", def->memballoon->info.alias); - if (qemuBuildDeviceAddressStr(&buf, def, &def->memballoon->info) < 0) + if (virJSONValueObjectAdd(props, + "s:id", def->memballoon->info.alias, + NULL) < 0) return -1; - if (def->memballoon->autodeflate !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&buf, ",deflate-on-oom=3D%s", - virTristateSwitchTypeToString(def->memballoon->a= utodeflate)); - } + if (qemuBuildDeviceAddressProps(props, def, &def->memballoon->info) < = 0) + return -1; - if (def->memballoon->free_page_reporting !=3D VIR_TRISTATE_SWITCH_ABSE= NT) { - virBufferAsprintf(&buf, ",free-page-reporting=3D%s", - virTristateSwitchTypeToString(def->memballoon->f= ree_page_reporting)); - } + if (virJSONValueObjectAdd(props, + "T:deflate-on-oom", def->memballoon->autodef= late, + "T:free-page-reporting", def->memballoon->fr= ee_page_reporting, + NULL) < 0) + return -1; if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) return -1; - virCommandAddArg(cmd, "-device"); - virCommandAddArgBuffer(cmd, &buf); + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; + return 0; } --=20 2.31.1