From patchwork Wed Mar 6 23:36:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 159766 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp6773650jad; Wed, 6 Mar 2019 15:37:22 -0800 (PST) X-Google-Smtp-Source: APXvYqw6yS/cW5HvbIFGf06juGBDHRR/+rFOGkiToTeSx7/tO3xf5dXr4Hzp4vXkapLgfO/SYjus X-Received: by 2002:a37:58c:: with SMTP id 134mr1842667qkf.297.1551915442244; Wed, 06 Mar 2019 15:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551915442; cv=none; d=google.com; s=arc-20160816; b=YC6I1rckmz8X3+MxAtMSZ5fWpnGRl4EjsK59uUgNspS0JY7/zKGdEjxlWuJokoyYqy LkSwAxkGhraX854aNaLN63j6aD0n5CSW8fyiRD2uPFRZJwWGdF9yxxZ+gAuiQfdJLsnD cEVA08wZyg8dCSjT3VVPCLpe2Ul0qBgpazKtHrcmCU0ORbAD/RZax4dBi9GXXube1dvZ fpFc7JNsO4U9W64EXN+GbpYOElBG5OHgp0QAmiWK59ld5erwU01T24aJ7aXuyK1Rkhl1 JmFzYItJ68J2YYr71zN9Z1HyGVscgiWp74iV7lNjEXqIQj9VkmrM8xz8n7JJJB2RluCh dxGg== 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=AP4iWOcZ18FADjIVmaZ5Y5cdoZ1ZIuwgqRM8241ucRs=; b=FkPW94D9ouITwKnHuJYifGQqLJzw0GP4kPurx0JjEMgZv2k3iqzXcj/L/15f9/RcSj XFTR2AHFRQMDOhnX4ePFFwcevXe8pghbivPmLSBFqFN1DM1lavQnZkAxUWJwNorzRRU4 8xgz1wvCAWpfWTZpnosbg4+PC/x3hDq695VT3mQwBxBQxikA4NJcPP30hW2UCViJLnD+ 3o4k6+3SNhrxYLDVW6+W4DmOoSEqLBI4jVbJ9pbhPgH4Fx5ICrt4+zNBA4yQzDpOuUow l5MOCzAT4Gt6QcoWNHaNQJvnGKJwGthanvR2eB+7ow8UM03nCUAOxPu3VT+FbHqtK59I xQOA== 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 f36si1042536qtb.164.2019.03.06.15.37.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 15:37:22 -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 92C9530789BE; Wed, 6 Mar 2019 23:37:20 +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 B12F819C67; Wed, 6 Mar 2019 23:37:19 +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 895DF41F3C; Wed, 6 Mar 2019 23:37:16 +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 x26NbFmt005151 for ; Wed, 6 Mar 2019 18:37:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4947A1001E63; Wed, 6 Mar 2019 23:37:15 +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 BC2771001E60; Wed, 6 Mar 2019 23:37:12 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 6 Mar 2019 18:36:49 -0500 Message-Id: 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 00/16] 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.49]); Wed, 06 Mar 2019 23:37:21 +0000 (UTC) v1 posting: https://www.redhat.com/archives/libvir-list/2019-February/msg01088.html v2 changes: - Rebase to master - Remove the full.xml test in patch #3 - Add virCapsEnum 'format' and use it - Extend docs to explain optional XML v1 cover letter: 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. In v2, I additionally added a mechanism to make values optionally formatted. Right now whenever a new is added, if the parent bit is supported (like ), the new is automatically formatted as well. This has the same problem described above with the @supported bit. Now drivers are required to set a virCapsPtr.report = true if they want the to be formatted. Existing drives have this value filled in to maintain back compat. Again, bhyve changes are untested. If someone can give them a spin that would be appreciated, otherwise I will try to get a freebsd build setup. Cole Robinson (16): 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 conf: domcaps: Add virCapsEnum 'report' qemu: fill in virCapsEnum 'report' libxl: fill in virCapsEnum 'report' bhyve: fill in virCapsEnum 'report' conf: domcaps: Don't format XML on report=false docs: formatdomaincaps: Describe optional XML changes docs/formatdomaincaps.html.in | 11 +++ docs/schemas/domaincaps.rng | 20 ++++- src/bhyve/bhyve_capabilities.c | 27 ++++-- src/conf/domain_capabilities.c | 31 ++++--- src/conf/domain_capabilities.h | 21 ++--- src/libxl/libxl_capabilities.c | 31 +++++-- src/qemu/qemu_capabilities.c | 41 ++++++--- tests/domaincapsschemadata/empty.xml | 16 ++++ tests/domaincapsschemadata/full.xml | 123 --------------------------- tests/domaincapstest.c | 79 +---------------- 10 files changed, 155 insertions(+), 245 deletions(-) create mode 100644 tests/domaincapsschemadata/empty.xml delete mode 100644 tests/domaincapsschemadata/full.xml -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list