[PATCH 0/3] schema: Some fixes and maxphyaddr support in hostcpu

Inspired by Tim's patch to fix my earlier omission https://listman.redhat.com/archives/libvir-list/2022-August/233624.html Jim Fehlig (3): schema: Remove optional nesting in hostcpu rng schema: Don't enforce ordering of hostcpu capabilities elements schema: Add maxphysaddr element to hostcpu src/conf/schemas/cputypes.rng | 47 +++++++++++++----------- tests/capabilityschemadata/caps-test.xml | 2 + 2 files changed, 28 insertions(+), 21 deletions(-) -- 2.37.1

The hostcpu rng has an optional "model" element, with the remaining elements each within a nested optional. Remove the optional nesting and have each element explicitly listed as optional Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- Not sure about this one. That change seems correct though... src/conf/schemas/cputypes.rng | 124 +++++++++++++++++----------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index 4ae386c3c0..6fbb069661 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -346,70 +346,70 @@ <element name="model"> <text/> </element> - <optional> - <element name="vendor"> + </optional> + <optional> + <element name="vendor"> + <text/> + </element> + </optional> + <optional> + <element name="microcode"> + <attribute name="version"> + <ref name="positiveInteger"/> + </attribute> + </element> + </optional> + <optional> + <element name="signature"> + <attribute name="family"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="model"> + <ref name="unsignedInt"/> + </attribute> + <attribute name="stepping"> + <ref name="unsignedInt"/> + </attribute> + </element> + </optional> + <optional> + <element name="counter"> + <attribute name="name"> <text/> - </element> - </optional> - <optional> - <element name="microcode"> - <attribute name="version"> - <ref name="positiveInteger"/> - </attribute> - </element> - </optional> - <optional> - <element name="signature"> - <attribute name="family"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="model"> - <ref name="unsignedInt"/> - </attribute> - <attribute name="stepping"> - <ref name="unsignedInt"/> - </attribute> - </element> - </optional> - <optional> - <element name="counter"> - <attribute name="name"> - <text/> - </attribute> - <attribute name="frequency"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="scaling"> - <ref name="virYesNo"/> - </attribute> - </element> - </optional> - <optional> - <ref name="cpuTopology"/> - </optional> - <zeroOrMore> - <element name="feature"> - <attribute name="name"> - <data type="string"> - <param name="pattern">[a-zA-Z0-9\-_]+</param> - </data> - </attribute> - <empty/> - </element> - </zeroOrMore> - <zeroOrMore> - <element name="pages"> - <optional> - <attribute name="unit"> - <ref name="unit"/> - </attribute> - </optional> - <attribute name="size"> - <ref name="unsignedInt"/> - </attribute> - </element> - </zeroOrMore> + </attribute> + <attribute name="frequency"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="scaling"> + <ref name="virYesNo"/> + </attribute> + </element> + </optional> + <optional> + <ref name="cpuTopology"/> </optional> + <zeroOrMore> + <element name="feature"> + <attribute name="name"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9\-_]+</param> + </data> + </attribute> + <empty/> + </element> + </zeroOrMore> + <zeroOrMore> + <element name="pages"> + <optional> + <attribute name="unit"> + <ref name="unit"/> + </attribute> + </optional> + <attribute name="size"> + <ref name="unsignedInt"/> + </attribute> + </element> + </zeroOrMore> </element> </define> -- 2.37.1

The change to caps-test.xml demonstrates the need for the change to cputypes.rng. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/conf/schemas/cputypes.rng | 166 ++++++++++++----------- tests/capabilityschemadata/caps-test.xml | 1 + 2 files changed, 85 insertions(+), 82 deletions(-) diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index 6fbb069661..219acaef14 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -326,90 +326,92 @@ <element name="arch"> <ref name="archnames"/> </element> - <optional> - <element name="features"> - <optional> - <element name="pae"><empty/></element> - </optional> - <optional> - <element name="nonpae"><empty/></element> - </optional> - <optional> - <element name="vmx"><empty/></element> - </optional> - <optional> - <element name="svm"><empty/></element> - </optional> - </element> - </optional> - <optional> - <element name="model"> - <text/> - </element> - </optional> - <optional> - <element name="vendor"> - <text/> - </element> - </optional> - <optional> - <element name="microcode"> - <attribute name="version"> - <ref name="positiveInteger"/> - </attribute> - </element> - </optional> - <optional> - <element name="signature"> - <attribute name="family"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="model"> - <ref name="unsignedInt"/> - </attribute> - <attribute name="stepping"> - <ref name="unsignedInt"/> - </attribute> - </element> - </optional> - <optional> - <element name="counter"> - <attribute name="name"> + <interleave> + <optional> + <element name="features"> + <optional> + <element name="pae"><empty/></element> + </optional> + <optional> + <element name="nonpae"><empty/></element> + </optional> + <optional> + <element name="vmx"><empty/></element> + </optional> + <optional> + <element name="svm"><empty/></element> + </optional> + </element> + </optional> + <optional> + <element name="model"> <text/> - </attribute> - <attribute name="frequency"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="scaling"> - <ref name="virYesNo"/> - </attribute> - </element> - </optional> - <optional> - <ref name="cpuTopology"/> - </optional> - <zeroOrMore> - <element name="feature"> - <attribute name="name"> - <data type="string"> - <param name="pattern">[a-zA-Z0-9\-_]+</param> - </data> - </attribute> - <empty/> - </element> - </zeroOrMore> - <zeroOrMore> - <element name="pages"> - <optional> - <attribute name="unit"> - <ref name="unit"/> + </element> + </optional> + <optional> + <element name="vendor"> + <text/> + </element> + </optional> + <optional> + <element name="microcode"> + <attribute name="version"> + <ref name="positiveInteger"/> + </attribute> + </element> + </optional> + <optional> + <element name="signature"> + <attribute name="family"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="model"> + <ref name="unsignedInt"/> + </attribute> + <attribute name="stepping"> + <ref name="unsignedInt"/> + </attribute> + </element> + </optional> + <optional> + <element name="counter"> + <attribute name="name"> + <text/> + </attribute> + <attribute name="frequency"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="scaling"> + <ref name="virYesNo"/> + </attribute> + </element> + </optional> + <optional> + <ref name="cpuTopology"/> + </optional> + <zeroOrMore> + <element name="feature"> + <attribute name="name"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9\-_]+</param> + </data> + </attribute> + <empty/> + </element> + </zeroOrMore> + <zeroOrMore> + <element name="pages"> + <optional> + <attribute name="unit"> + <ref name="unit"/> + </attribute> + </optional> + <attribute name="size"> + <ref name="unsignedInt"/> </attribute> - </optional> - <attribute name="size"> - <ref name="unsignedInt"/> - </attribute> - </element> - </zeroOrMore> + </element> + </zeroOrMore> + </interleave> </element> </define> diff --git a/tests/capabilityschemadata/caps-test.xml b/tests/capabilityschemadata/caps-test.xml index da199611ea..44a390a5b6 100644 --- a/tests/capabilityschemadata/caps-test.xml +++ b/tests/capabilityschemadata/caps-test.xml @@ -3,6 +3,7 @@ <host> <cpu> <arch>i686</arch> + <vendor>Intel</vendor> <features> <pae/> <nonpae/> -- 2.37.1

The output of "virsh capabilities" was not conformant to the capability.rng schema. Add the missing element to the schema. Fixes: c647bf29afb9890c792172ecf7db2c9c27babbb6 Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- This is essentially a V2 of Tim's patch, with test case added https://listman.redhat.com/archives/libvir-list/2022-August/233624.html src/conf/schemas/cputypes.rng | 3 +++ tests/capabilityschemadata/caps-test.xml | 1 + 2 files changed, 4 insertions(+) diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index 219acaef14..986a5f3715 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -389,6 +389,9 @@ <optional> <ref name="cpuTopology"/> </optional> + <optional> + <ref name="cpuMaxPhysAddr"/> + </optional> <zeroOrMore> <element name="feature"> <attribute name="name"> diff --git a/tests/capabilityschemadata/caps-test.xml b/tests/capabilityschemadata/caps-test.xml index 44a390a5b6..b508f25dce 100644 --- a/tests/capabilityschemadata/caps-test.xml +++ b/tests/capabilityschemadata/caps-test.xml @@ -4,6 +4,7 @@ <cpu> <arch>i686</arch> <vendor>Intel</vendor> + <maxphysaddr mode='emulate' bits='46'/> <features> <pae/> <nonpae/> -- 2.37.1

On 8/12/22 00:44, Jim Fehlig wrote:
Inspired by Tim's patch to fix my earlier omission
https://listman.redhat.com/archives/libvir-list/2022-August/233624.html
Jim Fehlig (3): schema: Remove optional nesting in hostcpu rng schema: Don't enforce ordering of hostcpu capabilities elements schema: Add maxphysaddr element to hostcpu
src/conf/schemas/cputypes.rng | 47 +++++++++++++----------- tests/capabilityschemadata/caps-test.xml | 2 + 2 files changed, 28 insertions(+), 21 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Jim Fehlig
-
Michal Prívozník