From patchwork Tue Feb 19 20:09:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 159031 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1752004jaa; Fri, 22 Feb 2019 05:47:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfYVlR5g/nZO4vQwJZ/pD+8RpPJ5jAG2+0/Frvr7jWTRA3tY2eBs4zbzK3SPI/9wgbMkPZ X-Received: by 2002:ac8:3413:: with SMTP id u19mr3111361qtb.348.1550843245741; Fri, 22 Feb 2019 05:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550843245; cv=none; d=google.com; s=arc-20160816; b=oxVGKKo2R+vyOleSxqsZJ1DSNTf495Zp73lMc2OOW59SVuzde9D1JhyoI/FfRvBM0c VtUsTh9Mib8345UpovFPJzeP1vrSYPVygOxXN+EGWI7yRuog/zamSK7bwx29CRYtHW0E tpMF5D1GN4AV3qEy/auB93LY+JpWqymOzXHULasy14aQByg3ydYgPrPz5ZCIxBcVQuvw znNmDd/AYUFrDQeqyV9/Q4h4DtfV5PgbtWQlbZasrnnPoDQ5YkvbjraLnVYd2hvB1nE2 piy1ftiBJKWZgZtrSjcrdUcwLVoK2B8xGV2182r78CqqYw0vBQrmXZNZll5GQJs+z9oF TmaA== 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=wAAea5y4cNMaxRUzWEAUyVWNTuLYHK5nCCUcFBLmiHg=; b=KrYX/dAI6IJUuza4KjyZ9surkvVcG2xbPZJTxdz3zraKIX2w8v8AMsv6iwy7o2k8cy GoZdtbTB+AEMuN4cH1p3NRwmopHGrsI8cBzjfqZ8g4nl4fWoNG2RsAJkW22R5vYerQny KiBXKt0aov91+aLWGNm6AsS9VEqIPjMa0WcqV+W+w0YsX5SWWr2fNniTXQexZAKEhVBl vewVi/mj+fgMMlAaiz5RFt7YeCw+z2rK/kYORpNATGo/eLATghr/ji248beZf5csrQpX oy7FTeYYPl/SfpySqkDHOR7BxwYYq2682etMBKdjofiex02+P7iVw2uAMKazExeR6UK+ Kxkg== 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 l49si937904qvc.80.2019.02.22.05.47.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 05:47:25 -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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5902330BC105; Fri, 22 Feb 2019 13:47:24 +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 31E945D97C; Fri, 22 Feb 2019 13:47:24 +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 E7767181A12C; Fri, 22 Feb 2019 13:47:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1JKAmKX000514 for ; Tue, 19 Feb 2019 15:10:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id F1A706014C; Tue, 19 Feb 2019 20:10:48 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (dhcp-17-6.bos.redhat.com [10.18.17.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97B1660140; Tue, 19 Feb 2019 20:10:48 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Feb 2019 15:09:39 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 22 Feb 2019 13:47:25 +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 6ae18515b6..a64f10842d 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 - - - - - - - -