From patchwork Wed Mar 6 23:36:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 159778 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp6774035jad; Wed, 6 Mar 2019 15:37:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwBqVxquCRb+AR7VlNNz+WgVvZxPXQfO0aicsxLXRQs5Q6g0ji4Zq6xHeydYOiTmLsISqed X-Received: by 2002:aed:38a5:: with SMTP id k34mr8019851qte.60.1551915469248; Wed, 06 Mar 2019 15:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551915469; cv=none; d=google.com; s=arc-20160816; b=tPsny1F4mQ5jJamVzygtWWXiP1oUv2lHOzCdcKfTiD+Qa3XTKVLvmc6Hfb68STpk/H UyS3mucWE0UZnEJIgLMLJ3LA1Z6WbElCfmReVzFbxRmKkFkjVmcJH8WT2XtHNsZ15ijj HdWJm3NH8E98p9/Mhdu0ECtKOfThzK2A09xINLj7bEChu6/nh1++Sm6Mg/Wl5DOFN75u zNA3C3zgq3DTJB4JLaVGdEr66i9GYZNqdHC2VZJ9LoeZ846SG1rYQ3iOGzCVJNnNEIeD cZKCXM5LcxhbZhRI69eMBLbF6oIWbzqwcnei0VELwDHLOH8KtI3pIS7/xMfEbM4OwBjE Xy9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=z4nTWT8JnvrVDxJhE9KmSY12biiiQZh2W2gVOvvzbAc=; b=Y96GajhpKfTxLLM7Kj9XCbH/9Xl8UaqKT7Z3SNs4VHLuQW7BvIhuyXWdKvK2IpwSJ0 RBoeXozGLmJSwI2lj7D4ctoqBJcP7Q9crDt3y4FOwuf1y7uUM2pJecmFKPRKJdvoq/90 i2x2V2vcxBaGSZoFxKd7+VRbQlXwR7Tk86mxfuDSK4L+TzOZ6lyC3Rtx6/dE99Mg6oFw C3tDW3oQW0E9D23vSjbkKvjFUKWcPRJYeCvbOl5X1z/QKsw8iFwlciixBayYSsCYPCn1 b1osUX3fbaE02eCKr70gdYcJJHFk0V7plAZX7kgdGs0S6zYv4mKM3lbABBCLpNbg3W/x GOUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id a7si1859491qkk.249.2019.03.06.15.37.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 15:37:49 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) Delivered-To: libvirt-list@redhat.com 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: , 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) 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(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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, #define FORMAT_PROLOGUE(item) \ do { \ + if (item->supported == VIR_TRISTATE_BOOL_ABSENT) \ + return; \ virBufferAsprintf(buf, "<" #item " supported='%s'%s\n", \ (item->supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no", \ (item->supported == VIR_TRISTATE_BOOL_YES) ? ">" : "/>"); \ - if (item->supported != VIR_TRISTATE_BOOL_YES) \ + if (item->supported == VIR_TRISTATE_BOOL_NO) \ return; \ virBufferAdjustIndent(buf, 2); \ } while (0) @@ -386,8 +388,10 @@ virDomainCapsStringValuesFormat(virBufferPtr buf, #define FORMAT_SINGLE(name, supported) \ do { \ - virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \ - (supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \ + if (supported != VIR_TRISTATE_BOOL_ABSENT) { \ + virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \ + (supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \ + } \ } while (0) #define ENUM_PROCESS(master, capsEnum, valToStr) \ diff --git a/tests/domaincapsschemadata/empty.xml b/tests/domaincapsschemadata/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 - - - - - - - -