From patchwork Tue Feb 19 20:09:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 158730 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4080844jaa; Tue, 19 Feb 2019 12:10:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBkbO64bW6LXv0N5HxCDqaH4GS94S39ouf89dmnhKfL4StV2ovE9OCrUEI0JXtyNdJeqd0 X-Received: by 2002:a0c:d4cc:: with SMTP id y12mr22832671qvh.37.1550607049770; Tue, 19 Feb 2019 12:10:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550607049; cv=none; d=google.com; s=arc-20160816; b=svpshEeSejYiMxCiAHNYxesnvbd4llbwcUR4SUZt3sDy7DAOHsksUln6MZo4PVjNDA nCb0TxSWGHnn0Z/GXwbr5s+WRAIpbZsfoffJEgj6ikEc2Iy3fUyD+h4BT07BP/y5oTp0 rL4sbGcOaDVvjqtcvYhIQSmRFONJJTNypOnuU0z/bzXMMOWBFA5Q/jaaetQHV3pk8xR4 dmFfGp0hJffaxH9KceQJQTL8MT/oTAyEXXMO/gdO3Gp50piih9xZ8mOkj7KqbBTGupFF bmGoTGiepwLZ+/W8tayW7Fc+BrZblFQOauD7ox7ZaD7IqwBisOPbxifSRqIjykhQx1ca gVuA== 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:message-id:date:to:from:delivered-to; bh=IjNTEsUjioXHP0871jsObL7Md3s3vdI9jF8YoTqBINY=; b=RuSIZnntn4qrjUodYsmZ2M+Yq2UdBCCKWRgqt1/fEdZRcY+1h6Hk2ibJRHArV6MBAb cBTIaiAqqCZqWj4vRAtgXEyF4k2u790UaREnVGf27aPGDfUNg6bI6ug+WdkTQR54iBzf oL7B//UergWLBYMJQ4Ec+gjeYsNHPIOgCxwxn5NyZYOwswKgb5PnbZkjja1xOTGRQF72 3LN2wMDRSZL9GqHL90mMBa3/eGeTDHq7CA1Eyyn+0RF1V3oFupS3afqdp6qihIxLxXI3 QP1Pkycyt27uw01R7dbSPlUdLXbSflGT1SHhoTlw71MYwOrxD1tK28U3ICNdxa/BcVAk smng== 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 o22si2847402qtf.16.2019.02.19.12.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 12:10: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-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 295F936883; Tue, 19 Feb 2019 20:10:48 +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 68F4419C59; Tue, 19 Feb 2019 20:10: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 32BA2181A00A; Tue, 19 Feb 2019 20:10:45 +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 x1JKAhoK000441 for ; Tue, 19 Feb 2019 15:10:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id D119F60140; Tue, 19 Feb 2019 20:10:43 +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 7689D600C8; Tue, 19 Feb 2019 20:10:40 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Feb 2019 15:09:29 -0500 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 00/10] domcaps: use virTristateBool 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 19 Feb 2019 20:10:48 +0000 (UTC) Extending domaincapabilities with new XML schema is currently a bit of a maintenance pain. Consider the case of adding a new enum for listing models. I want to output this info for the qemu driver. Internally in the domaincapabilities plumbing, whether a is supported= is tracked with boolean true/false. If I extend that pattern for devices and fill in data for the qemu driver, the other domcaps implementations will now automatically output a new XML element: Now, for bhyve I can 'git grep' confirm that it doesn't have any support, but for xen/libxl it _is_ supported. So if I don't fill in accurate support in the xen driver, I've just made their domcaps report blatantly incorrect info. Ideally I would make these changes and the other drivers output would _not_ change. xen output would now be incomplete, but not obviously wrong, which is easier on me the developer, and safer for the API consumer. This moves domcaps plumbing in that direction. It switches most internal 'supported' fields to virTristateBool so we can track an ABSENT state and map that to outputting no XML. Explicit supported='no' values are filled in where needed to ensure existing driver XML doesn't change. cpu and sev supported= values are left unconverted, but they require semi-special handling anyways so aren't really affected by the problem I laid out above. Cole Robinson (10): tests: domcaps: Add a default 'empty' test tests: domcaps: Remove unused typedef tests: domcaps: Remove 'full' test conf: domcaps: Add single line formatting macro conf: domcaps: use virTristateBool for 'supported' qemu: domcaps: fill in explicit supported BOOL_NO libxl: domcaps: fill in explicit supported BOOL_NO bhyve: domcaps: fill in explicit supported BOOL_NO schemas: domcaps: Make more elements optional conf: domcaps: Don't output XML on tristate ABSENT docs/schemas/domaincaps.rng | 20 +++++-- src/bhyve/bhyve_capabilities.c | 20 +++++-- src/conf/domain_capabilities.c | 26 ++++++---- src/conf/domain_capabilities.h | 20 +++---- src/libxl/libxl_capabilities.c | 18 ++++--- src/qemu/qemu_capabilities.c | 26 ++++++---- tests/domaincapsschemadata/empty.xml | 16 ++++++ tests/domaincapstest.c | 78 ++-------------------------- 8 files changed, 103 insertions(+), 121 deletions(-) create mode 100644 tests/domaincapsschemadata/empty.xml -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list