From nobody Sun Feb 8 09:23:06 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551915469496888.4887395762908; Wed, 6 Mar 2019 15:37:49 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7672C057F9F; Wed, 6 Mar 2019 23:37:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A08BBA4FAA; Wed, 6 Mar 2019 23:37:47 +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 5BD983FA46; Wed, 6 Mar 2019 23:37:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x26NbLRA005242 for ; Wed, 6 Mar 2019 18:37:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 573B11001DF1; Wed, 6 Mar 2019 23:37:21 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-121-104.rdu2.redhat.com [10.10.121.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id E67D11001DD9; Wed, 6 Mar 2019 23:37:20 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 6 Mar 2019 18:36:59 -0500 Message-Id: <967f4c7ce08001ad3d2ea3675c23cadffe864cab.1551914794.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/16] conf: domcaps: Don't output XML on tristate ABSENT 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 06 Mar 2019 23:37:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Change domcaps to skip formatting XML if the default TRISTATE_BOOL_ABSENT is found. Now when domcaps is extended, driver XML output won't change until an explicit TRISTATE_BOOL value is set in driver code. Signed-off-by: Cole Robinson --- src/conf/domain_capabilities.c | 10 +++++++--- tests/domaincapsschemadata/empty.xml | 9 --------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 081549eefb..f45a3bcc3d 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -370,10 +370,12 @@ virDomainCapsStringValuesFormat(virBufferPtr buf, =20 #define FORMAT_PROLOGUE(item) \ do { \ + if (item->supported =3D=3D VIR_TRISTATE_BOOL_ABSENT) \ + return; \ virBufferAsprintf(buf, "<" #item " supported=3D'%s'%s\n", \ (item->supported =3D=3D VIR_TRISTATE_BOOL_YES) ? "yes" : "= no", \ (item->supported =3D=3D VIR_TRISTATE_BOOL_YES) ? ">" : "/>= "); \ - if (item->supported !=3D VIR_TRISTATE_BOOL_YES) \ + if (item->supported =3D=3D VIR_TRISTATE_BOOL_NO) \ return; \ virBufferAdjustIndent(buf, 2); \ } while (0) @@ -386,8 +388,10 @@ virDomainCapsStringValuesFormat(virBufferPtr buf, =20 #define FORMAT_SINGLE(name, supported) \ do { \ - virBufferAsprintf(&buf, "<%s supported=3D'%s'/>\n", name, \ - (supported =3D=3D VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \ + if (supported !=3D VIR_TRISTATE_BOOL_ABSENT) { \ + virBufferAsprintf(&buf, "<%s supported=3D'%s'/>\n", name, \ + (supported =3D=3D VIR_TRISTATE_BOOL_YES) ? "yes" : "no= "); \ + } \ } while (0) =20 #define ENUM_PROCESS(master, capsEnum, valToStr) \ diff --git a/tests/domaincapsschemadata/empty.xml b/tests/domaincapsschemad= ata/empty.xml index 2b2e97d3b3..6c3f5f54fd 100644 --- a/tests/domaincapsschemadata/empty.xml +++ b/tests/domaincapsschemadata/empty.xml @@ -3,23 +3,14 @@ kvm my-machine-type x86_64 - - - - - - - - --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list