[libvirt] [PATCH v2 3/6] tools: define YAML rules for virt-host-validate checks

Peter Krempa pkrempa at redhat.com
Mon Sep 30 08:36:39 UTC 2019


On Fri, Sep 27, 2019 at 13:52:22 +0100, Daniel Berrange wrote:
> This commit defines a set of YAML rules that result in the same set of
> logical checks as the existing hardcoded virt-host-validate
> implementation does.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  tools/host-validate/rules/builtin.yaml        |  20 +
>  tools/host-validate/rules/cpu.yaml            |  50 ++
>  tools/host-validate/rules/freebsd-kernel.yaml |  77 +++
>  tools/host-validate/rules/linux-acpi.yaml     |  39 ++
>  tools/host-validate/rules/linux-cgroups.yaml  | 470 ++++++++++++++++++
>  tools/host-validate/rules/linux-cpu.yaml      | 134 +++++
>  tools/host-validate/rules/linux-devices.yaml  |  71 +++
>  tools/host-validate/rules/linux-iommu.yaml    | 113 +++++
>  .../host-validate/rules/linux-namespaces.yaml | 119 +++++
>  tools/host-validate/rules/linux-pci.yaml      |  10 +
>  10 files changed, 1103 insertions(+)
>  create mode 100644 tools/host-validate/rules/builtin.yaml
>  create mode 100644 tools/host-validate/rules/cpu.yaml
>  create mode 100644 tools/host-validate/rules/freebsd-kernel.yaml
>  create mode 100644 tools/host-validate/rules/linux-acpi.yaml
>  create mode 100644 tools/host-validate/rules/linux-cgroups.yaml
>  create mode 100644 tools/host-validate/rules/linux-cpu.yaml
>  create mode 100644 tools/host-validate/rules/linux-devices.yaml
>  create mode 100644 tools/host-validate/rules/linux-iommu.yaml
>  create mode 100644 tools/host-validate/rules/linux-namespaces.yaml
>  create mode 100644 tools/host-validate/rules/linux-pci.yaml

[...]

> diff --git a/tools/host-validate/rules/cpu.yaml b/tools/host-validate/rules/cpu.yaml
> new file mode 100644
> index 0000000000..5af61b1ea1
> --- /dev/null
> +++ b/tools/host-validate/rules/cpu.yaml
> @@ -0,0 +1,50 @@
> +#
> +# Define facts related to host CPU properties
> +#
> +
> +facts:
> +- name: cpu.family.x86
> +  value:
> +    bool:
> +      any:
> +        expressions:
> +        - fact:
> +            name: cpu.arch
> +            value: x86_64
> +        - fact:
> +            name: cpu.arch
> +            value: i386
> +        - fact:
> +            name: cpu.arch
> +            value: i486
> +        - fact:
> +            name: cpu.arch
> +            value: i586
> +        - fact:
> +            name: cpu.arch
> +            value: i686

Honestly I don't think that adding a custom declarative language for
this does not make the maintenance any simpler or conforms with our
vision of decreasing the maintenance burden by introducing many random
languages.

Also additionally we'd have the parser engine to maintain.

Many of the check would look much simpler when described by actual code.

I'm not arguing against the actual list of more granular facts, but the
same can be achieved with much more understandable regular code.




More information about the libvir-list mailing list