[libvirt PATCH 0/9] Make unknown XML elements fail CPU comparison

We currently ignore unknown elements in the CPU XML description, e.g. with virsh cpu-compare and hypervisor-cpu-compare. This makes '<cpu><faeture name=3D"..."/></cpu>' (note the typo in "faeture") semantically identic to '<cpu/>'. No error is reported. This series adds checks for unrecognized attributes and elements in the "<cpu>" element, catching this kind of mistake. V1: https://www.redhat.com/archives/libvir-list/2020-September/msg00933.html Changed: * Factored out Schema defintion of different cpu elements * Performing validation against actual schema * Add "--validate" option to virsh [hypervisor-]cpu-compare to opt-in to vali= dation * Drive-by: Unify quotation style in docs/schemas/* Tim Wiederhake (9): schema: Unify apostrophe and quotation mark usage schema: Move host cpu definition to cputypes.rng schema: Move guest cpu definition to cputypes.rng schema: Add schema for guest or host cpu definition util: Allow validation for single XML node cpu: Validate XML virsh: Add "validate" argument to [hypervisor-]cpu-compare tests: cpu: Allow passing flags to cpuTestLoadXML tests: Add tests for unknown elements and attributes in cpu defintion docs/schemas/basictypes.rng | 82 +-- docs/schemas/capability.rng | 466 ++++++--------- docs/schemas/cpu.rng | 12 + docs/schemas/cputypes.rng | 117 +++- docs/schemas/domain.rng | 10 +- docs/schemas/domainbackup.rng | 178 +++--- docs/schemas/domaincaps.rng | 236 ++++---- docs/schemas/domaincheckpoint.rng | 62 +- docs/schemas/domaincommon.rng | 431 +++++++------- docs/schemas/domainsnapshot.rng | 104 ++-- docs/schemas/interface.rng | 6 +- docs/schemas/meson.build | 1 + docs/schemas/network.rng | 44 +- docs/schemas/networkcommon.rng | 26 +- docs/schemas/networkport.rng | 6 +- docs/schemas/nodedev.rng | 464 +++++++-------- docs/schemas/nwfilter.rng | 32 +- docs/schemas/nwfilterbinding.rng | 4 +- docs/schemas/secret.rng | 70 +-- docs/schemas/storagecommon.rng | 110 ++-- docs/schemas/storagepool.rng | 584 +++++++++---------- docs/schemas/storagepoolcaps.rng | 64 +- docs/schemas/storagevol.rng | 150 ++--- include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c | 7 +- src/conf/cpu_conf.c | 28 +- src/conf/cpu_conf.h | 6 +- src/conf/domain_conf.c | 3 +- src/cpu/cpu.c | 5 +- src/cpu/cpu.h | 3 +- src/libxl/libxl_driver.c | 7 +- src/qemu/qemu_domain.c | 5 +- src/qemu/qemu_driver.c | 18 +- src/qemu/qemu_migration_cookie.c | 3 +- src/util/virxml.c | 15 + src/util/virxml.h | 6 + tests/cputest.c | 52 +- tests/cputestdata/x86_64-bogus-attribute.xml | 2 + tests/cputestdata/x86_64-bogus-element.xml | 3 + tools/virsh-host.c | 14 + 40 files changed, 1773 insertions(+), 1664 deletions(-) create mode 100644 docs/schemas/cpu.rng create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml create mode 100644 tests/cputestdata/x86_64-bogus-element.xml --=20 2.26.2

Quotation marks were used ~ 7000 times, apostrophes ~ 3000 times. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/basictypes.rng | 82 ++--- docs/schemas/capability.rng | 452 +++++++++++------------ docs/schemas/cputypes.rng | 4 +- docs/schemas/domain.rng | 10 +- docs/schemas/domainbackup.rng | 178 ++++----- docs/schemas/domaincaps.rng | 236 ++++++------ docs/schemas/domaincheckpoint.rng | 62 ++-- docs/schemas/domaincommon.rng | 388 ++++++++++---------- docs/schemas/domainsnapshot.rng | 104 +++--- docs/schemas/interface.rng | 6 +- docs/schemas/network.rng | 44 +-- docs/schemas/networkcommon.rng | 26 +- docs/schemas/networkport.rng | 6 +- docs/schemas/nodedev.rng | 464 ++++++++++++------------ docs/schemas/nwfilter.rng | 32 +- docs/schemas/nwfilterbinding.rng | 4 +- docs/schemas/secret.rng | 70 ++-- docs/schemas/storagecommon.rng | 110 +++--- docs/schemas/storagepool.rng | 584 +++++++++++++++--------------- docs/schemas/storagepoolcaps.rng | 64 ++-- docs/schemas/storagevol.rng | 150 ++++---- 21 files changed, 1538 insertions(+), 1538 deletions(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 79d96451f1..58a295ff1b 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -8,14 +8,14 @@ <param name="pattern">[0-9]+</param> </data> </define> - <define name='unsignedLong'> - <data type='unsignedLong'> - <param name='pattern'>[0-9]+</param> + <define name="unsignedLong"> + <data type="unsignedLong"> + <param name="pattern">[0-9]+</param> </data> </define> - <define name='hexuint'> - <data type='string'> + <define name="hexuint"> + <data type="string"> <param name="pattern">(0x)?[0-9a-f]+</param> </data> </define> @@ -26,9 +26,9 @@ </data> </define> - <define name='octalMode'> + <define name="octalMode"> <data type="unsignedInt"> - <param name='pattern'>[0-7]+</param> + <param name="pattern">[0-7]+</param> </data> </define> @@ -48,7 +48,7 @@ <data type="string"> <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param> </data> - <data type='int'> + <data type="int"> <param name="minInclusive">0</param> <param name="maxInclusive">65535</param> </data> @@ -309,18 +309,18 @@ </data> </define> - <define name='unit'> - <data type='string'> - <param name='pattern'>([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtTpPeE]([iI]?[bB])?)</param> + <define name="unit"> + <data type="string"> + <param name="pattern">([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtTpPeE]([iI]?[bB])?)</param> </data> </define> - <define name='scaledInteger'> + <define name="scaledInteger"> <optional> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> </optional> - <ref name='unsignedLong'/> + <ref name="unsignedLong"/> </define> <define name="pciDomain"> @@ -352,9 +352,9 @@ </choice> </define> - <define name='wwn'> - <data type='string'> - <param name='pattern'>(0x)?[0-9a-fA-F]{16}</param> + <define name="wwn"> + <data type="string"> + <param name="pattern">(0x)?[0-9a-fA-F]{16}</param> </data> </define> @@ -395,9 +395,9 @@ </data> </define> - <define name='volName'> + <define name="volName"> <!-- directory pools allow almost any file name as a volume name --> - <data type='string'> + <data type="string"> <param name="pattern">[^/]+</param> <except> <choice> @@ -408,7 +408,7 @@ </data> </define> - <define name='archnames'> + <define name="archnames"> <choice> <value>aarch64</value> <value>alpha</value> @@ -454,20 +454,20 @@ </data> </define> - <define name='sourceinfoadapter'> - <element name='adapter'> + <define name="sourceinfoadapter"> + <element name="adapter"> <choice> <group> - <!-- To keep back-compat, 'type' is not mandatory for + <!-- To keep back-compat, "type" is not mandatory for scsi_host adapter --> <optional> - <attribute name='type'> + <attribute name="type"> <value>scsi_host</value> </attribute> </optional> <choice> <group> - <attribute name='name'> + <attribute name="name"> <text/> </attribute> </group> @@ -475,8 +475,8 @@ <interleave> <element name="parentaddr"> <optional> - <attribute name='unique_id'> - <ref name='positiveInteger'/> + <attribute name="unique_id"> + <ref name="positiveInteger"/> </attribute> </optional> <element name="address"> @@ -488,39 +488,39 @@ </choice> </group> <group> - <attribute name='type'> + <attribute name="type"> <value>fc_host</value> </attribute> <optional> - <attribute name='parent'> + <attribute name="parent"> <text/> </attribute> </optional> <optional> - <attribute name='managed'> + <attribute name="managed"> <ref name="virYesNo"/> </attribute> </optional> <optional> - <attribute name='parent_wwnn'> - <ref name='wwn'/> + <attribute name="parent_wwnn"> + <ref name="wwn"/> </attribute> </optional> <optional> - <attribute name='parent_wwpn'> - <ref name='wwn'/> + <attribute name="parent_wwpn"> + <ref name="wwn"/> </attribute> </optional> <optional> - <attribute name='parent_fabric_wwn'> - <ref name='wwn'/> + <attribute name="parent_fabric_wwn"> + <ref name="wwn"/> </attribute> </optional> - <attribute name='wwnn'> - <ref name='wwn'/> + <attribute name="wwnn"> + <ref name="wwn"/> </attribute> - <attribute name='wwpn'> - <ref name='wwn'/> + <attribute name="wwpn"> + <ref name="wwn"/> </attribute> </group> </choice> diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 031c55bf20..68bdb29695 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -2,76 +2,76 @@ <!-- A Relax NG schema for the libvirt capabilities XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> <start> - <ref name='capabilities'/> + <ref name="capabilities"/> </start> - <define name='capabilities'> - <element name='capabilities'> - <ref name='hostcaps'/> + <define name="capabilities"> + <element name="capabilities"> + <ref name="hostcaps"/> <zeroOrMore> - <ref name='guestcaps'/> + <ref name="guestcaps"/> </zeroOrMore> </element> </define> - <define name='hostcaps'> - <element name='host'> + <define name="hostcaps"> + <element name="host"> <optional> - <element name='uuid'> - <ref name='UUID'/> + <element name="uuid"> + <ref name="UUID"/> </element> </optional> - <element name='cpu'> - <element name='arch'> - <ref name='archnames'/> + <element name="cpu"> + <element name="arch"> + <ref name="archnames"/> </element> <optional> - <ref name='cpufeatures'/> + <ref name="cpufeatures"/> </optional> <optional> - <ref name='cpuspec'/> + <ref name="cpuspec"/> </optional> </element> <optional> - <ref name='power_management'/> + <ref name="power_management"/> </optional> <optional> - <ref name='iommu_support'/> + <ref name="iommu_support"/> </optional> <optional> - <ref name='migration'/> + <ref name="migration"/> </optional> <optional> - <ref name='topology'/> + <ref name="topology"/> </optional> <optional> - <ref name='cache'/> + <ref name="cache"/> </optional> <optional> - <ref name='memory_bandwidth'/> + <ref name="memory_bandwidth"/> </optional> <zeroOrMore> - <ref name='secmodel'/> + <ref name="secmodel"/> </zeroOrMore> </element> </define> - <define name='secmodel'> - <element name='secmodel'> + <define name="secmodel"> + <element name="secmodel"> <interleave> - <element name='model'> + <element name="model"> <text/> </element> - <element name='doi'> + <element name="doi"> <text/> </element> <zeroOrMore> - <element name='baselabel'> - <attribute name='type'> + <element name="baselabel"> + <attribute name="type"> <text/> </attribute> <text/> @@ -82,78 +82,78 @@ </define> - <define name='cpufeatures'> - <element name='features'> + <define name="cpufeatures"> + <element name="features"> <optional> - <element name='pae'><empty/></element> + <element name="pae"><empty/></element> </optional> <optional> - <element name='nonpae'><empty/></element> + <element name="nonpae"><empty/></element> </optional> <optional> - <element name='vmx'><empty/></element> + <element name="vmx"><empty/></element> </optional> <optional> - <element name='svm'><empty/></element> + <element name="svm"><empty/></element> </optional> </element> </define> - <define name='cpuspec'> - <element name='model'> + <define name="cpuspec"> + <element name="model"> <text/> </element> <optional> - <element name='vendor'> + <element name="vendor"> <text/> </element> </optional> <optional> - <element name='microcode'> - <attribute name='version'> - <ref name='positiveInteger'/> + <element name="microcode"> + <attribute name="version"> + <ref name="positiveInteger"/> </attribute> </element> </optional> - <element name='topology'> - <attribute name='sockets'> - <ref name='positiveInteger'/> + <element name="topology"> + <attribute name="sockets"> + <ref name="positiveInteger"/> </attribute> - <attribute name='cores'> - <ref name='positiveInteger'/> + <attribute name="cores"> + <ref name="positiveInteger"/> </attribute> - <attribute name='threads'> - <ref name='positiveInteger'/> + <attribute name="threads"> + <ref name="positiveInteger"/> </attribute> </element> <zeroOrMore> - <element name='feature'> - <attribute name='name'> - <ref name='featureName'/> + <element name="feature"> + <attribute name="name"> + <ref name="featureName"/> </attribute> <empty/> </element> </zeroOrMore> <zeroOrMore> - <ref name='pagesHost'/> + <ref name="pagesHost"/> </zeroOrMore> </define> - <define name='power_management'> - <element name='power_management'> + <define name="power_management"> + <element name="power_management"> <interleave> <optional> - <element name='suspend_mem'> + <element name="suspend_mem"> <empty/> </element> </optional> <optional> - <element name='suspend_disk'> + <element name="suspend_disk"> <empty/> </element> </optional> <optional> - <element name='suspend_hybrid'> + <element name="suspend_hybrid"> <empty/> </element> </optional> @@ -161,27 +161,27 @@ </element> </define> - <define name='iommu_support'> - <element name='iommu'> + <define name="iommu_support"> + <element name="iommu"> <optional> - <attribute name='support'> - <ref name='virYesNo'/> + <attribute name="support"> + <ref name="virYesNo"/> </attribute> </optional> </element> </define> - <define name='migration'> - <element name='migration_features'> + <define name="migration"> + <element name="migration_features"> <optional> - <element name='live'> + <element name="live"> <empty/> </element> </optional> <optional> - <element name='uri_transports'> + <element name="uri_transports"> <oneOrMore> - <element name='uri_transport'> + <element name="uri_transport"> <choice> <value>vpxmigr</value> <value>tcp</value> @@ -195,42 +195,42 @@ </element> </define> - <define name='topology'> - <element name='topology'> - <element name='cells'> - <attribute name='num'> - <ref name='unsignedInt'/> + <define name="topology"> + <element name="topology"> + <element name="cells"> + <attribute name="num"> + <ref name="unsignedInt"/> </attribute> <oneOrMore> - <ref name='cell'/> + <ref name="cell"/> </oneOrMore> </element> </element> </define> - <define name='cell'> - <element name='cell'> - <attribute name='id'> - <ref name='unsignedInt'/> + <define name="cell"> + <element name="cell"> + <attribute name="id"> + <ref name="unsignedInt"/> </attribute> <optional> - <ref name='memory'/> + <ref name="memory"/> </optional> <zeroOrMore> - <ref name='pagesNuma'/> + <ref name="pagesNuma"/> </zeroOrMore> <optional> - <element name='distances'> + <element name="distances"> <zeroOrMore> - <element name='sibling'> - <attribute name='id'> - <ref name='unsignedInt'/> + <element name="sibling"> + <attribute name="id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='value'> - <ref name='unsignedInt'/> + <attribute name="value"> + <ref name="unsignedInt"/> </attribute> </element> </zeroOrMore> @@ -238,95 +238,95 @@ </optional> <optional> - <element name='cpus'> - <attribute name='num'> - <ref name='unsignedInt'/> + <element name="cpus"> + <attribute name="num"> + <ref name="unsignedInt"/> </attribute> <oneOrMore> - <ref name='cpu'/> + <ref name="cpu"/> </oneOrMore> </element> </optional> </element> </define> - <define name='memory'> - <element name='memory'> - <ref name='scaledInteger'/> + <define name="memory"> + <element name="memory"> + <ref name="scaledInteger"/> </element> </define> - <define name='cpu'> - <element name='cpu'> - <attribute name='id'> - <ref name='unsignedInt'/> + <define name="cpu"> + <element name="cpu"> + <attribute name="id"> + <ref name="unsignedInt"/> </attribute> <optional> - <attribute name='socket_id'> - <ref name='unsignedInt'/> + <attribute name="socket_id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='die_id'> - <ref name='unsignedInt'/> + <attribute name="die_id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='core_id'> - <ref name='unsignedInt'/> + <attribute name="core_id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='siblings'> - <ref name='cpuset'/> + <attribute name="siblings"> + <ref name="cpuset"/> </attribute> </optional> </element> </define> - <define name='cache'> - <element name='cache'> + <define name="cache"> + <element name="cache"> <oneOrMore> - <element name='bank'> - <attribute name='id'> - <ref name='unsignedInt'/> + <element name="bank"> + <attribute name="id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='level'> - <ref name='unsignedInt'/> + <attribute name="level"> + <ref name="unsignedInt"/> </attribute> - <ref name='cacheType'/> - <attribute name='size'> - <ref name='unsignedInt'/> + <ref name="cacheType"/> + <attribute name="size"> + <ref name="unsignedInt"/> </attribute> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> - <attribute name='cpus'> - <ref name='cpuset'/> + <attribute name="cpus"> + <ref name="cpuset"/> </attribute> <zeroOrMore> - <element name='control'> - <attribute name='granularity'> - <ref name='unsignedInt'/> + <element name="control"> + <attribute name="granularity"> + <ref name="unsignedInt"/> </attribute> <optional> - <attribute name='min'> - <ref name='unsignedInt'/> + <attribute name="min"> + <ref name="unsignedInt"/> </attribute> </optional> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> - <ref name='cacheType'/> - <attribute name='maxAllocs'> - <ref name='unsignedInt'/> + <ref name="cacheType"/> + <attribute name="maxAllocs"> + <ref name="unsignedInt"/> </attribute> </element> </zeroOrMore> </element> </oneOrMore> <optional> - <ref name='cpuMonitor'/> + <ref name="cpuMonitor"/> </optional> </element> </define> - <define name='cacheType'> - <attribute name='type'> + <define name="cacheType"> + <attribute name="type"> <choice> <value>both</value> <value>code</value> @@ -335,83 +335,83 @@ </attribute> </define> - <define name='memory_bandwidth'> - <element name='memory_bandwidth'> + <define name="memory_bandwidth"> + <element name="memory_bandwidth"> <oneOrMore> - <element name='node'> - <attribute name='id'> - <ref name='unsignedInt'/> + <element name="node"> + <attribute name="id"> + <ref name="unsignedInt"/> </attribute> - <attribute name='cpus'> - <ref name='cpuset'/> + <attribute name="cpus"> + <ref name="cpuset"/> </attribute> <zeroOrMore> - <element name='control'> - <attribute name='granularity'> - <ref name='unsignedInt'/> + <element name="control"> + <attribute name="granularity"> + <ref name="unsignedInt"/> </attribute> <optional> - <attribute name='min'> - <ref name='unsignedInt'/> + <attribute name="min"> + <ref name="unsignedInt"/> </attribute> </optional> - <attribute name='maxAllocs'> - <ref name='unsignedInt'/> + <attribute name="maxAllocs"> + <ref name="unsignedInt"/> </attribute> </element> </zeroOrMore> </element> </oneOrMore> <optional> - <ref name='cpuMonitor'/> + <ref name="cpuMonitor"/> </optional> </element> </define> - <define name='cpuMonitor'> - <element name='monitor'> + <define name="cpuMonitor"> + <element name="monitor"> <optional> - <attribute name='level'> - <ref name='unsignedInt'/> + <attribute name="level"> + <ref name="unsignedInt"/> </attribute> - <attribute name='reuseThreshold'> - <ref name='unsignedInt'/> + <attribute name="reuseThreshold"> + <ref name="unsignedInt"/> </attribute> </optional> - <attribute name='maxMonitors'> - <ref name='unsignedInt'/> + <attribute name="maxMonitors"> + <ref name="unsignedInt"/> </attribute> <oneOrMore> - <element name='feature'> - <attribute name='name'> - <ref name='monitorFeature'/> + <element name="feature"> + <attribute name="name"> + <ref name="monitorFeature"/> </attribute> </element> </oneOrMore> </element> </define> - <define name='monitorFeature'> - <data type='string'> - <param name='pattern'>(llc_|mbm_)[a-zA-Z0-9\-_]+</param> + <define name="monitorFeature"> + <data type="string"> + <param name="pattern">(llc_|mbm_)[a-zA-Z0-9\-_]+</param> </data> </define> - <define name='guestcaps'> - <element name='guest'> - <ref name='ostype'/> - <ref name='arch'/> + <define name="guestcaps"> + <element name="guest"> + <ref name="ostype"/> + <ref name="arch"/> <optional> - <ref name='features'/> + <ref name="features"/> </optional> </element> </define> - <define name='ostype'> - <element name='os_type'> + <define name="ostype"> + <element name="os_type"> <choice> <value>xen</value> <!-- Xen 3.0 pv --> - <value>linux</value> <!-- same as 'xen' - meant to be legacy --> + <value>linux</value> <!-- same as "xen" - meant to be legacy --> <value>hvm</value> <!-- unmodified OS --> <value>exe</value> <!-- For container based virt --> <value>uml</value> <!-- user mode linux; NOT USED ANYMORE --> @@ -419,41 +419,41 @@ </element> </define> - <define name='arch'> - <element name='arch'> - <attribute name='name'> - <ref name='archnames'/> + <define name="arch"> + <element name="arch"> + <attribute name="name"> + <ref name="archnames"/> </attribute> - <ref name='wordsize'/> + <ref name="wordsize"/> <optional> - <ref name='emulator'/> + <ref name="emulator"/> </optional> <optional> - <ref name='loader'/> + <ref name="loader"/> </optional> <zeroOrMore> - <ref name='machine'/> + <ref name="machine"/> </zeroOrMore> <oneOrMore> - <ref name='domain'/> + <ref name="domain"/> </oneOrMore> </element> </define> - <define name='emulator'> - <element name='emulator'> - <ref name='absFilePath'/> + <define name="emulator"> + <element name="emulator"> + <ref name="absFilePath"/> </element> </define> - <define name='loader'> - <element name='loader'> - <ref name='absFilePath'/> + <define name="loader"> + <element name="loader"> + <ref name="absFilePath"/> </element> </define> - <define name='wordsize'> - <element name='wordsize'> + <define name="wordsize"> + <element name="wordsize"> <choice> <value>31</value> <value>32</value> @@ -462,25 +462,25 @@ </element> </define> - <define name='machine'> - <element name='machine'> + <define name="machine"> + <element name="machine"> <optional> - <attribute name='canonical'> + <attribute name="canonical"> <text/> </attribute> </optional> <optional> - <attribute name='maxCpus'> - <ref name='unsignedInt'/> + <attribute name="maxCpus"> + <ref name="unsignedInt"/> </attribute> </optional> <text/> </element> </define> - <define name='domain'> - <element name='domain'> - <attribute name='type'> + <define name="domain"> + <element name="domain"> + <attribute name="type"> <choice> <value>qemu</value> <value>kqemu</value> @@ -494,63 +494,63 @@ </attribute> <optional> - <ref name='emulator'/> + <ref name="emulator"/> </optional> <zeroOrMore> - <ref name='machine'/> + <ref name="machine"/> </zeroOrMore> </element> </define> - <define name='features'> - <element name='features'> + <define name="features"> + <element name="features"> <interleave> <optional> - <element name='pae'> + <element name="pae"> <empty/> </element> </optional> <optional> - <element name='nonpae'> + <element name="nonpae"> <empty/> </element> </optional> <optional> - <element name='ia64_be'> + <element name="ia64_be"> <empty/> </element> </optional> <optional> - <element name='acpi'> - <ref name='featuretoggle'/> + <element name="acpi"> + <ref name="featuretoggle"/> <empty/> </element> </optional> <optional> - <element name='apic'> - <ref name='featuretoggle'/> + <element name="apic"> + <ref name="featuretoggle"/> <empty/> </element> </optional> <optional> - <element name='cpuselection'> + <element name="cpuselection"> <empty/> </element> </optional> <optional> - <element name='deviceboot'> + <element name="deviceboot"> <empty/> </element> </optional> <optional> - <element name='disksnapshot'> - <ref name='featuretoggle'/> + <element name="disksnapshot"> + <ref name="featuretoggle"/> <empty/> </element> </optional> <optional> - <element name='hap'> - <ref name='featuretoggle'/> + <element name="hap"> + <ref name="featuretoggle"/> <empty/> </element> </optional> @@ -558,40 +558,40 @@ </element> </define> - <define name='featuretoggle'> - <attribute name='toggle'> + <define name="featuretoggle"> + <attribute name="toggle"> <ref name="virYesNo"/> </attribute> - <attribute name='default'> + <attribute name="default"> <ref name="virOnOff"/> </attribute> </define> - <define name='featureName'> - <data type='string'> - <param name='pattern'>[a-zA-Z0-9\-_]+</param> + <define name="featureName"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9\-_]+</param> </data> </define> - <define name='pagesHost'> - <element name='pages'> - <ref name='pagesElem'/> + <define name="pagesHost"> + <element name="pages"> + <ref name="pagesElem"/> </element> </define> - <define name='pagesNuma'> - <element name='pages'> - <ref name='pagesElem'/> - <ref name='unsignedInt'/> + <define name="pagesNuma"> + <element name="pages"> + <ref name="pagesElem"/> + <ref name="unsignedInt"/> </element> </define> - <define name='pagesElem'> + <define name="pagesElem"> <optional> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> </optional> - <attribute name='size'> - <ref name='unsignedInt'/> + <attribute name="size"> + <ref name="unsignedInt"/> </attribute> </define> </grammar> diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng index a1cae23161..e6e82b5fd2 100644 --- a/docs/schemas/cputypes.rng +++ b/docs/schemas/cputypes.rng @@ -46,7 +46,7 @@ <optional> <attribute name="vendor_id"> <data type="string"> - <param name='pattern'>[^,]{12}</param> + <param name="pattern">[^,]{12}</param> </data> </attribute> </optional> @@ -274,7 +274,7 @@ </define> <define name="featureName"> <data type="string"> - <param name='pattern'>[a-zA-Z0-9\-_\.]+</param> + <param name="pattern">[a-zA-Z0-9\-_\.]+</param> </data> </define> diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 114b87e261..b93bbed959 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -6,16 +6,16 @@ <ref name="domain"/> </start> - <include href='domaincommon.rng'/> + <include href="domaincommon.rng"/> - <define name='storageStartupPolicy' combine='choice'> + <define name="storageStartupPolicy" combine="choice"> <!-- overrides the no-op version in storagecommon.rng --> - <ref name='startupPolicy'/> + <ref name="startupPolicy"/> </define> - <define name='storageSourceExtra' combine='choice'> + <define name="storageSourceExtra" combine="choice"> <!-- overrides the no-op version in storagecommon.rng --> - <ref name='diskspec'/> + <ref name="diskspec"/> </define> </grammar> diff --git a/docs/schemas/domainbackup.rng b/docs/schemas/domainbackup.rng index 579b62a658..c03455a5a7 100644 --- a/docs/schemas/domainbackup.rng +++ b/docs/schemas/domainbackup.rng @@ -2,57 +2,57 @@ <!-- A Relax NG schema for the libvirt domain backup properties XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> - <ref name='domainbackup'/> + <ref name="domainbackup"/> </start> - <include href='domaincommon.rng'/> + <include href="domaincommon.rng"/> - <define name='backupEncryption'> - <element name='encryption'> - <attribute name='format'> + <define name="backupEncryption"> + <element name="encryption"> + <attribute name="format"> <choice> <value>luks</value> </choice> </attribute> <interleave> - <ref name='secret'/> + <ref name="secret"/> <optional> - <element name='cipher'> - <ref name='keycipher'/> + <element name="cipher"> + <ref name="keycipher"/> </element> - <element name='ivgen'> - <ref name='keyivgen'/> + <element name="ivgen"> + <ref name="keyivgen"/> </element> </optional> </interleave> </element> </define> - <define name='domainbackup'> - <element name='domainbackup'> + <define name="domainbackup"> + <element name="domainbackup"> <interleave> <optional> - <element name='incremental'> + <element name="incremental"> <text/> </element> </optional> <choice> <group> <optional> - <attribute name='mode'> + <attribute name="mode"> <value>push</value> </attribute> </optional> - <ref name='backupDisksPush'/> + <ref name="backupDisksPush"/> </group> <group> - <attribute name='mode'> + <attribute name="mode"> <value>pull</value> </attribute> <interleave> - <element name='server'> + <element name="server"> <optional> - <attribute name='tls'> + <attribute name="tls"> <choice> <value>yes</value> <value>no</value> @@ -62,33 +62,33 @@ <choice> <group> <optional> - <attribute name='transport'> + <attribute name="transport"> <value>tcp</value> </attribute> </optional> - <attribute name='name'> + <attribute name="name"> <choice> - <ref name='dnsName'/> - <ref name='ipAddr'/> + <ref name="dnsName"/> + <ref name="ipAddr"/> </choice> </attribute> <optional> - <attribute name='port'> - <ref name='unsignedInt'/> + <attribute name="port"> + <ref name="unsignedInt"/> </attribute> </optional> </group> <group> - <attribute name='transport'> + <attribute name="transport"> <value>unix</value> </attribute> - <attribute name='socket'> - <ref name='absFilePath'/> + <attribute name="socket"> + <ref name="absFilePath"/> </attribute> </group> </choice> </element> - <ref name='backupDisksPull'/> + <ref name="backupDisksPull"/> </interleave> </group> </choice> @@ -97,49 +97,49 @@ </define> - <define name='backupDiskMode'> + <define name="backupDiskMode"> <optional> <choice> - <attribute name='backupmode'> + <attribute name="backupmode"> <value>full</value> </attribute> <group> <optional> - <attribute name='backupmode'> + <attribute name="backupmode"> <value>incremental</value> </attribute> </optional> <optional> - <attribute name='incremental'/> + <attribute name="incremental"/> </optional> </group> </choice> </optional> </define> - <define name='backupPushDriver'> + <define name="backupPushDriver"> <optional> - <element name='driver'> - <attribute name='type'> - <ref name='storageFormat'/> + <element name="driver"> + <attribute name="type"> + <ref name="storageFormat"/> </attribute> </element> </optional> </define> - <define name='backupPullDriver'> + <define name="backupPullDriver"> <optional> - <element name='driver'> - <attribute name='type'> + <element name="driver"> + <attribute name="type"> <value>qcow2</value> </attribute> </element> </optional> </define> - <define name='backupAttr'> + <define name="backupAttr"> <optional> - <attribute name='backup'> + <attribute name="backup"> <choice> <value>yes</value> </choice> @@ -147,67 +147,67 @@ </optional> </define> - <define name='backupDisksPush'> + <define name="backupDisksPush"> <optional> - <element name='disks'> + <element name="disks"> <oneOrMore> - <element name='disk'> - <attribute name='name'> - <ref name='diskTarget'/> + <element name="disk"> + <attribute name="name"> + <ref name="diskTarget"/> </attribute> - <ref name='backupDiskMode'/> + <ref name="backupDiskMode"/> <choice> <group> - <attribute name='backup'> + <attribute name="backup"> <value>no</value> </attribute> </group> <group> - <ref name='backupAttr'/> - <attribute name='type'> + <ref name="backupAttr"/> + <attribute name="type"> <value>file</value> </attribute> <interleave> <optional> - <element name='target'> - <attribute name='file'> - <ref name='absFilePath'/> + <element name="target"> + <attribute name="file"> + <ref name="absFilePath"/> </attribute> <interleave> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='backupEncryption'/> + <ref name="backupEncryption"/> </optional> </interleave> </element> </optional> - <ref name='backupPushDriver'/> + <ref name="backupPushDriver"/> </interleave> </group> <group> - <ref name='backupAttr'/> - <attribute name='type'> + <ref name="backupAttr"/> + <attribute name="type"> <value>block</value> </attribute> <interleave> <optional> - <element name='target'> - <attribute name='dev'> - <ref name='absFilePath'/> + <element name="target"> + <attribute name="dev"> + <ref name="absFilePath"/> </attribute> <interleave> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='backupEncryption'/> + <ref name="backupEncryption"/> </optional> </interleave> </element> </optional> - <ref name='backupPushDriver'/> + <ref name="backupPushDriver"/> </interleave> </group> </choice> @@ -217,77 +217,77 @@ </optional> </define> - <define name='backupDisksPull'> + <define name="backupDisksPull"> <optional> - <element name='disks'> + <element name="disks"> <oneOrMore> - <element name='disk'> - <attribute name='name'> - <ref name='diskTarget'/> + <element name="disk"> + <attribute name="name"> + <ref name="diskTarget"/> </attribute> - <ref name='backupDiskMode'/> + <ref name="backupDiskMode"/> <optional> - <attribute name='exportname'> + <attribute name="exportname"> <text/> </attribute> </optional> <optional> - <attribute name='exportbitmap'> + <attribute name="exportbitmap"> <text/> </attribute> </optional> <choice> <group> - <attribute name='backup'> + <attribute name="backup"> <value>no</value> </attribute> </group> <group> <optional> - <ref name='backupAttr'/> - <attribute name='type'> + <ref name="backupAttr"/> + <attribute name="type"> <value>file</value> </attribute> </optional> <optional> <interleave> - <element name='scratch'> - <attribute name='file'> - <ref name='absFilePath'/> + <element name="scratch"> + <attribute name="file"> + <ref name="absFilePath"/> </attribute> <interleave> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='backupEncryption'/> + <ref name="backupEncryption"/> </optional> </interleave> </element> - <ref name='backupPullDriver'/> + <ref name="backupPullDriver"/> </interleave> </optional> </group> <group> - <ref name='backupAttr'/> - <attribute name='type'> + <ref name="backupAttr"/> + <attribute name="type"> <value>block</value> </attribute> <interleave> - <element name='scratch'> - <attribute name='dev'> - <ref name='absFilePath'/> + <element name="scratch"> + <attribute name="dev"> + <ref name="absFilePath"/> </attribute> <interleave> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='backupEncryption'/> + <ref name="backupEncryption"/> </optional> </interleave> </element> - <ref name='backupPullDriver'/> + <ref name="backupPullDriver"/> </interleave> </group> </choice> diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 325581476d..0dbffb28ac 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -1,116 +1,116 @@ <?xml version="1.0"?> <!-- A Relax NG schema for the libvirt domain capabilities XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> - <include href='cputypes.rng'/> + <include href="basictypes.rng"/> + <include href="cputypes.rng"/> <start> - <ref name='domainCapabilities'/> + <ref name="domainCapabilities"/> </start> - <define name='domainCapabilities'> - <element name='domainCapabilities'> + <define name="domainCapabilities"> + <element name="domainCapabilities"> <interleave> - <element name='path'> + <element name="path"> <ref name="absFilePath"/> </element> - <element name='domain'> + <element name="domain"> <text/> </element> <optional> - <element name='machine'> + <element name="machine"> <text/> </element> </optional> - <element name='arch'> + <element name="arch"> <text/> </element> <optional> - <ref name='vcpu'/> + <ref name="vcpu"/> </optional> <optional> - <ref name='iothreads'/> + <ref name="iothreads"/> </optional> <optional> - <ref name='os'/> + <ref name="os"/> </optional> <optional> - <ref name='cpu'/> + <ref name="cpu"/> </optional> <optional> - <ref name='devices'/> + <ref name="devices"/> </optional> <optional> - <ref name='features'/> + <ref name="features"/> </optional> </interleave> </element> </define> - <define name='vcpu'> - <element name='vcpu'> - <attribute name='max'> - <ref name='unsignedInt'/> + <define name="vcpu"> + <element name="vcpu"> + <attribute name="max"> + <ref name="unsignedInt"/> </attribute> <empty/> </element> </define> - <define name='iothreads'> - <element name='iothreads'> - <ref name='supported'/> + <define name="iothreads"> + <element name="iothreads"> + <ref name="supported"/> <empty/> </element> </define> - <define name='loader'> - <element name='loader'> - <ref name='supported'/> + <define name="loader"> + <element name="loader"> + <ref name="supported"/> <optional> - <ref name='value'/> + <ref name="value"/> </optional> - <ref name='enum'/> + <ref name="enum"/> </element> </define> - <define name='os'> - <element name='os'> + <define name="os"> + <element name="os"> <interleave> - <ref name='supported'/> - <ref name='enum'/> + <ref name="supported"/> + <ref name="enum"/> <optional> - <ref name='loader'/> + <ref name="loader"/> </optional> </interleave> </element> </define> - <define name='cpu'> - <element name='cpu'> - <ref name='cpuHost'/> - <ref name='cpuHostModel'/> - <ref name='cpuCustom'/> + <define name="cpu"> + <element name="cpu"> + <ref name="cpuHost"/> + <ref name="cpuHostModel"/> + <ref name="cpuCustom"/> </element> </define> - <define name='cpuHost'> - <element name='mode'> - <attribute name='name'> + <define name="cpuHost"> + <element name="mode"> + <attribute name="name"> <value>host-passthrough</value> </attribute> - <ref name='supported'/> + <ref name="supported"/> <optional> - <ref name='enum'/> + <ref name="enum"/> </optional> </element> </define> - <define name='cpuHostModel'> - <element name='mode'> - <attribute name='name'> + <define name="cpuHostModel"> + <element name="mode"> + <attribute name="name"> <value>host-model</value> </attribute> - <ref name='supported'/> + <ref name="supported"/> <optional> <ref name="cpuModel"/> <optional> @@ -123,15 +123,15 @@ </element> </define> - <define name='cpuCustom'> - <element name='mode'> - <attribute name='name'> + <define name="cpuCustom"> + <element name="mode"> + <attribute name="name"> <value>custom</value> </attribute> - <ref name='supported'/> + <ref name="supported"/> <zeroOrMore> - <element name='model'> - <attribute name='usable'> + <element name="model"> + <attribute name="usable"> <choice> <value>yes</value> <value>no</value> @@ -144,150 +144,150 @@ </element> </define> - <define name='devices'> - <element name='devices'> + <define name="devices"> + <element name="devices"> <optional> - <ref name='disk'/> + <ref name="disk"/> </optional> <optional> - <ref name='graphics'/> + <ref name="graphics"/> </optional> <optional> - <ref name='video'/> + <ref name="video"/> </optional> <optional> - <ref name='hostdev'/> + <ref name="hostdev"/> </optional> <optional> - <ref name='rng'/> + <ref name="rng"/> </optional> </element> </define> - <define name='disk'> - <element name='disk'> - <ref name='supported'/> - <ref name='enum'/> + <define name="disk"> + <element name="disk"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='graphics'> - <element name='graphics'> - <ref name='supported'/> - <ref name='enum'/> + <define name="graphics"> + <element name="graphics"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='video'> - <element name='video'> - <ref name='supported'/> - <ref name='enum'/> + <define name="video"> + <element name="video"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='hostdev'> - <element name='hostdev'> - <ref name='supported'/> - <ref name='enum'/> + <define name="hostdev"> + <element name="hostdev"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='rng'> - <element name='rng'> - <ref name='supported'/> - <ref name='enum'/> + <define name="rng"> + <element name="rng"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='features'> - <element name='features'> + <define name="features"> + <element name="features"> <optional> - <ref name='gic'/> + <ref name="gic"/> </optional> <optional> - <ref name='vmcoreinfo'/> + <ref name="vmcoreinfo"/> </optional> <optional> - <ref name='vmgenid'/> + <ref name="vmgenid"/> </optional> <optional> - <ref name='backingStoreInput'/> + <ref name="backingStoreInput"/> </optional> <optional> - <ref name='backup'/> + <ref name="backup"/> </optional> <optional> - <ref name='sev'/> + <ref name="sev"/> </optional> </element> </define> - <define name='gic'> - <element name='gic'> - <ref name='supported'/> - <ref name='enum'/> + <define name="gic"> + <element name="gic"> + <ref name="supported"/> + <ref name="enum"/> </element> </define> - <define name='vmcoreinfo'> - <element name='vmcoreinfo'> - <ref name='supported'/> + <define name="vmcoreinfo"> + <element name="vmcoreinfo"> + <ref name="supported"/> </element> </define> - <define name='vmgenid'> - <element name='genid'> - <ref name='supported'/> + <define name="vmgenid"> + <element name="genid"> + <ref name="supported"/> </element> </define> - <define name='backingStoreInput'> - <element name='backingStoreInput'> - <ref name='supported'/> + <define name="backingStoreInput"> + <element name="backingStoreInput"> + <ref name="supported"/> </element> </define> - <define name='backup'> - <element name='backup'> - <ref name='supported'/> + <define name="backup"> + <element name="backup"> + <ref name="supported"/> </element> </define> - <define name='sev'> - <element name='sev'> - <ref name='supported'/> + <define name="sev"> + <element name="sev"> + <ref name="supported"/> <optional> - <element name='cbitpos'> - <data type='unsignedInt'/> + <element name="cbitpos"> + <data type="unsignedInt"/> </element> - <element name='reducedPhysBits'> - <data type='unsignedInt'/> + <element name="reducedPhysBits"> + <data type="unsignedInt"/> </element> </optional> </element> </define> - <define name='value'> + <define name="value"> <zeroOrMore> - <element name='value'> + <element name="value"> <text/> </element> </zeroOrMore> </define> - <define name='supported'> - <attribute name='supported'> + <define name="supported"> + <attribute name="supported"> <ref name="virYesNo"/> </attribute> </define> - <define name='enum'> + <define name="enum"> <zeroOrMore> - <element name='enum'> - <attribute name='name'> + <element name="enum"> + <attribute name="name"> <text/> </attribute> - <ref name='value'/> + <ref name="value"/> </element> </zeroOrMore> </define> diff --git a/docs/schemas/domaincheckpoint.rng b/docs/schemas/domaincheckpoint.rng index 4399eca7fc..a1c8b0bb9c 100644 --- a/docs/schemas/domaincheckpoint.rng +++ b/docs/schemas/domaincheckpoint.rng @@ -1,34 +1,34 @@ -<?xml version='1.0'?> +<?xml version="1.0"?> <!-- A Relax NG schema for the libvirt domain checkpoint properties XML format --> -<grammar xmlns='http://relaxng.org/ns/structure/1.0' datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> - <ref name='domaincheckpoint'/> + <ref name="domaincheckpoint"/> </start> - <include href='domaincommon.rng'/> + <include href="domaincommon.rng"/> - <define name='domaincheckpoint'> - <element name='domaincheckpoint'> + <define name="domaincheckpoint"> + <element name="domaincheckpoint"> <interleave> <optional> - <element name='name'> - <ref name='checkpointName'/> + <element name="name"> + <ref name="checkpointName"/> </element> </optional> <optional> - <element name='description'> + <element name="description"> <text/> </element> </optional> <optional> - <element name='creationTime'> - <ref name='unsignedLong'/> + <element name="creationTime"> + <ref name="unsignedLong"/> </element> </optional> <optional> - <element name='disks'> + <element name="disks"> <oneOrMore> - <ref name='diskcheckpoint'/> + <ref name="diskcheckpoint"/> </oneOrMore> </element> </optional> @@ -37,13 +37,13 @@ storagecommon/domaincommon defines do not conflict with any domain.rng overrides. --> <grammar> - <include href='domain.rng'/> + <include href="domain.rng"/> </grammar> </optional> <optional> - <element name='parent'> - <element name='name'> - <ref name='checkpointName'/> + <element name="parent"> + <element name="name"> + <ref name="checkpointName"/> </element> </element> </optional> @@ -51,32 +51,32 @@ </element> </define> - <define name='diskcheckpoint'> - <element name='disk'> - <attribute name='name'> + <define name="diskcheckpoint"> + <element name="disk"> + <attribute name="name"> <choice> - <ref name='diskTarget'/> - <ref name='absFilePath'/> + <ref name="diskTarget"/> + <ref name="absFilePath"/> </choice> </attribute> <choice> - <attribute name='checkpoint'> + <attribute name="checkpoint"> <value>no</value> </attribute> <group> <optional> - <attribute name='checkpoint'> + <attribute name="checkpoint"> <value>bitmap</value> </attribute> </optional> <optional> - <attribute name='bitmap'> + <attribute name="bitmap"> <text/> </attribute> </optional> <optional> - <attribute name='size'> - <ref name='unsignedLong'/> + <attribute name="size"> + <ref name="unsignedLong"/> </attribute> </optional> </group> @@ -84,10 +84,10 @@ </element> </define> - <define name='checkpointName'> - <data type='string'> - <!-- Notably: no leading '.' and no embedded '/' or newline --> - <param name='pattern'>[a-zA-Z0-9_\-][a-zA-Z0-9_\-.]*</param> + <define name="checkpointName"> + <data type="string"> + <!-- Notably: no leading "." and no embedded "/" or newline --> + <param name="pattern">[a-zA-Z0-9_\-][a-zA-Z0-9_\-.]*</param> </data> </define> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a1d6d19e2f..dedaf17b85 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1,11 +1,11 @@ <?xml version="1.0"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <!-- domain-related definitions used in multiple grammars --> - <include href='basictypes.rng'/> - <include href='storagecommon.rng'/> - <include href='networkcommon.rng'/> - <include href='cputypes.rng'/> - <include href='nwfilter_params.rng'/> + <include href="basictypes.rng"/> + <include href="storagecommon.rng"/> + <include href="networkcommon.rng"/> + <include href="cputypes.rng"/> + <include href="nwfilter_params.rng"/> <!-- description and title element, may be placed anywhere under the root @@ -70,25 +70,25 @@ <ref name="seclabel"/> </zeroOrMore> <optional> - <ref name='qemucmdline'/> + <ref name="qemucmdline"/> </optional> <optional> - <ref name='qemucapabilities'/> + <ref name="qemucapabilities"/> </optional> <optional> - <ref name='lxcsharens'/> + <ref name="lxcsharens"/> </optional> <optional> - <ref name='keywrap'/> + <ref name="keywrap"/> </optional> <optional> - <ref name='launchSecurity'/> + <ref name="launchSecurity"/> </optional> <optional> - <ref name='bhyvecmdline'/> + <ref name="bhyvecmdline"/> </optional> <optional> - <ref name='xencmdline'/> + <ref name="xencmdline"/> </optional> </interleave> </element> @@ -96,7 +96,7 @@ <define name="seclabel"> <element name="seclabel"> <optional> - <attribute name='model'> + <attribute name="model"> <text/> </attribute> </optional> @@ -105,28 +105,28 @@ <!-- with dynamic label (default), relabel must be yes, baselabel is optional, and label and imagelabel are output-only --> <optional> - <attribute name='type'> + <attribute name="type"> <value>dynamic</value> </attribute> </optional> <optional> - <attribute name='relabel'> + <attribute name="relabel"> <value>yes</value> </attribute> </optional> <interleave> <optional> - <element name='label'> + <element name="label"> <text/> </element> </optional> <optional> - <element name='imagelabel'> + <element name="imagelabel"> <text/> </element> </optional> <optional> - <element name='baselabel'> + <element name="baselabel"> <text/> </element> </optional> @@ -136,20 +136,20 @@ <!-- with static label, relabel can be either format (default no), label is required, imagelabel is output-only, and no baselabel is present --> - <attribute name='type'> + <attribute name="type"> <value>static</value> </attribute> <optional> - <attribute name='relabel'> + <attribute name="relabel"> <ref name="virYesNo"/> </attribute> </optional> <interleave> - <element name='label'> + <element name="label"> <text/> </element> <optional> - <element name='imagelabel'> + <element name="imagelabel"> <text/> </element> </optional> @@ -157,11 +157,11 @@ </group> <group> <!-- with none, relabel must be no if present --> - <attribute name='type'> + <attribute name="type"> <value>none</value> </attribute> <optional> - <attribute name='relabel'> + <attribute name="relabel"> <value>no</value> </attribute> </optional> @@ -175,29 +175,29 @@ relabel=no or a <label> must be present on input; output also can include labelskip=yes. --> <optional> - <attribute name='model'> + <attribute name="model"> <text/> </attribute> </optional> <choice> <group> - <attribute name='relabel'> + <attribute name="relabel"> <value>no</value> </attribute> </group> <group> - <attribute name='labelskip'> + <attribute name="labelskip"> <value>yes</value> </attribute> </group> <group> <optional> - <attribute name='relabel'> + <attribute name="relabel"> <value>yes</value> </attribute> </optional> <oneOrMore> - <element name='label'> + <element name="label"> <text/> </element> </oneOrMore> @@ -413,8 +413,8 @@ <zeroOrMore> <element name="initenv"> <attribute name="name"> - <data type='string'> - <param name='pattern'>[a-zA-Z_]+[a-zA-Z0-9_]*</param> + <data type="string"> + <param name="pattern">[a-zA-Z_]+[a-zA-Z0-9_]*</param> </data> </attribute> <text/> @@ -454,7 +454,7 @@ </choice> </attribute> <attribute name="state"> - <ref name='virOnOff'/> + <ref name="virOnOff"/> </attribute> </element> </oneOrMore> @@ -468,17 +468,17 @@ </attribute> <interleave> <element name="cbitpos"> - <data type='unsignedInt'/> + <data type="unsignedInt"/> </element> <element name="reducedPhysBits"> - <data type='unsignedInt'/> + <data type="unsignedInt"/> </element> <element name="policy"> - <ref name='hexuint'/> + <ref name="hexuint"/> </element> <optional> <element name="handle"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </element> </optional> <optional> @@ -614,7 +614,7 @@ <interleave> <optional> <element name="memory"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> <optional> <attribute name="dumpCore"> <ref name="virOnOff"/> @@ -632,7 +632,7 @@ </optional> <optional> <element name="currentMemory"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> <optional> @@ -646,13 +646,13 @@ <ref name="unsignedLong"/> </attribute> <optional> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> </optional> <optional> <attribute name="nodeset"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> </optional> <empty/> @@ -822,22 +822,22 @@ </optional> <optional> <element name="read_iops_sec"> - <data type='unsignedInt'/> + <data type="unsignedInt"/> </element> </optional> <optional> <element name="write_iops_sec"> - <data type='unsignedInt'/> + <data type="unsignedInt"/> </element> </optional> <optional> <element name="read_bytes_sec"> - <data type='unsignedLong'/> + <data type="unsignedLong"/> </element> </optional> <optional> <element name="write_bytes_sec"> - <data type='unsignedLong'/> + <data type="unsignedLong"/> </element> </optional> </interleave> @@ -853,25 +853,25 @@ <!-- Maximum memory the VM can use --> <optional> <element name="hard_limit"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> <!-- Minimum memory ascertained for the VM during contention --> <optional> <element name="soft_limit"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> <!-- Minimum amount of memory required to start the VM --> <optional> <element name="min_guarantee"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> <!-- Maximum swap area the VM can use --> <optional> <element name="swap_hard_limit"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> </element> @@ -957,7 +957,7 @@ <element name="vcpusched"> <optional> <attribute name="vcpus"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> </optional> <ref name="schedparam"/> @@ -967,7 +967,7 @@ <element name="iothreadsched"> <optional> <attribute name="iothreads"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> </optional> <ref name="schedparam"/> @@ -981,16 +981,16 @@ <zeroOrMore> <element name="cachetune"> <attribute name="vcpus"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> <oneOrMore> <choice> <element name="cache"> <attribute name="id"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </attribute> <attribute name="level"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </attribute> <attribute name="type"> <choice> @@ -1000,20 +1000,20 @@ </choice> </attribute> <attribute name="size"> - <ref name='unsignedLong'/> + <ref name="unsignedLong"/> </attribute> <optional> - <attribute name='unit'> - <ref name='unit'/> + <attribute name="unit"> + <ref name="unit"/> </attribute> </optional> </element> <element name="monitor"> <attribute name="level"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </attribute> <attribute name="vcpus"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> </element> </choice> @@ -1023,21 +1023,21 @@ <zeroOrMore> <element name="memorytune"> <attribute name="vcpus"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> <oneOrMore> <choice> <element name="node"> <attribute name="id"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </attribute> <attribute name="bandwidth"> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> </attribute> </element> <element name="monitor"> <attribute name="vcpus"> - <ref name='cpuset'/> + <ref name="cpuset"/> </attribute> </element> </choice> @@ -1090,17 +1090,17 @@ <choice> <group> <optional> - <attribute name='placement'> + <attribute name="placement"> <value>static</value> </attribute> </optional> <optional> - <attribute name='nodeset'> - <ref name='cpuset'/> + <attribute name="nodeset"> + <ref name="cpuset"/> </attribute> </optional> </group> - <attribute name='placement'> + <attribute name="placement"> <value>auto</value> </attribute> </choice> @@ -1118,8 +1118,8 @@ <value>interleave</value> </choice> </attribute> - <attribute name='nodeset'> - <ref name='cpuset'/> + <attribute name="nodeset"> + <ref name="cpuset"/> </attribute> </element> </zeroOrMore> @@ -1147,9 +1147,9 @@ </choice> </attribute> <optional> - <attribute name='adjustment'> + <attribute name="adjustment"> <choice> - <ref name='timeDelta'/> + <ref name="timeDelta"/> <value>reset</value> </choice> </attribute> @@ -1374,7 +1374,7 @@ <ref name="diskDriver"/> </optional> <optional> - <ref name='diskMirror'/> + <ref name="diskMirror"/> </optional> <optional> <ref name="diskAuth"/> @@ -1600,10 +1600,10 @@ </define> <define name="diskSourceSlice"> - <attribute name='offset'> + <attribute name="offset"> <ref name="positiveInteger"/> </attribute> - <attribute name='size'> + <attribute name="size"> <ref name="positiveInteger"/> </attribute> </define> @@ -1615,9 +1615,9 @@ </attribute> </optional> <optional> - <element name='slices'> - <element name='slice'> - <attribute name='type'> + <element name="slices"> + <element name="slice"> + <attribute name="type"> <value>storage</value> </attribute> <ref name="diskSourceSlice"/> @@ -1659,7 +1659,7 @@ <ref name="encryption"/> </optional> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> </interleave> </element> @@ -1689,7 +1689,7 @@ <ref name="reservations"/> </optional> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> </interleave> </element> @@ -2066,7 +2066,7 @@ <ref name="encryption"/> </optional> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> </interleave> </element> @@ -2221,7 +2221,7 @@ <ref name="detect_zeroes"/> </optional> <optional> - <attribute name='queues'> + <attribute name="queues"> <ref name="positiveInteger"/> </attribute> </optional> @@ -2236,10 +2236,10 @@ </attribute> </optional> <optional> - <attribute name='type'> + <attribute name="type"> <choice> - <ref name='storageFormat'/> - <value>aio</value> <!-- back-compat for 'raw' --> + <ref name="storageFormat"/> + <value>aio</value> <!-- back-compat for "raw" --> </choice> </attribute> </optional> @@ -2296,12 +2296,12 @@ </attribute> </define> <define name="copy_on_read"> - <attribute name='copy_on_read'> + <attribute name="copy_on_read"> <ref name="virOnOff"/> </attribute> </define> <define name="discard"> - <attribute name='discard'> + <attribute name="discard"> <choice> <value>unmap</value> <value>ignore</value> @@ -2309,12 +2309,12 @@ </attribute> </define> <define name="driverIOThread"> - <attribute name='iothread'> + <attribute name="iothread"> <ref name="unsignedInt"/> </attribute> </define> <define name="detect_zeroes"> - <attribute name='detect_zeroes'> + <attribute name="detect_zeroes"> <choice> <value>off</value> <value>on</value> @@ -2428,24 +2428,24 @@ <element name="model"> <attribute name="name"> <choice> - <!-- implementations of 'pci-root' --> + <!-- implementations of "pci-root" --> <value>spapr-pci-host-bridge</value> - <!-- implementations of 'pci-bridge' --> + <!-- implementations of "pci-bridge" --> <value>pci-bridge</value> - <!-- implementations of 'dmi-to-pci-bridge' --> + <!-- implementations of "dmi-to-pci-bridge" --> <value>i82801b11-bridge</value> - <!-- implementations of 'pcie-to-pci-bridge' --> + <!-- implementations of "pcie-to-pci-bridge" --> <value>pcie-pci-bridge</value> - <!-- implementations of 'pcie-root-port' --> + <!-- implementations of "pcie-root-port" --> <value>ioh3420</value> <value>pcie-root-port</value> - <!-- implementations of 'pcie-switch-upstream-port' --> + <!-- implementations of "pcie-switch-upstream-port" --> <value>x3130-upstream</value> - <!-- implementations of 'pcie-switch-downstream-port' --> + <!-- implementations of "pcie-switch-downstream-port" --> <value>xio3130-downstream</value> - <!-- implementations of 'pci-expander-bus' --> + <!-- implementations of "pci-expander-bus" --> <value>pxb</value> - <!-- implementations of 'pcie-expander-bus' --> + <!-- implementations of "pcie-expander-bus" --> <value>pxb-pcie</value> </choice> </attribute> @@ -2455,38 +2455,38 @@ <optional> <element name="target"> <optional> - <attribute name='chassisNr'> - <ref name='uint8'/> + <attribute name="chassisNr"> + <ref name="uint8"/> </attribute> </optional> <optional> <attribute name="chassis"> - <ref name='uint8'/> + <ref name="uint8"/> </attribute> </optional> <optional> <attribute name="port"> - <ref name='uint8'/> + <ref name="uint8"/> </attribute> </optional> <optional> - <attribute name='busNr'> - <ref name='uint8'/> + <attribute name="busNr"> + <ref name="uint8"/> </attribute> </optional> <optional> - <attribute name='index'> - <ref name='uint8'/> + <attribute name="index"> + <ref name="uint8"/> </attribute> </optional> <optional> - <attribute name='hotplug'> + <attribute name="hotplug"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <element name='node'> - <ref name='unsignedInt'/> + <element name="node"> + <ref name="unsignedInt"/> </element> </optional> </element> @@ -2629,7 +2629,7 @@ </interleave> </group> <group> - <!-- type='mount' is default --> + <!-- type="mount" is default --> <optional> <attribute name="type"> <value>mount</value> @@ -2697,8 +2697,8 @@ <ref name="unsignedLong"/> </attribute> <optional> - <attribute name='units'> - <ref name='unit'/> + <attribute name="units"> + <ref name="unit"/> </attribute> </optional> <empty/> @@ -2731,7 +2731,7 @@ </attribute> </optional> <optional> - <element name='readonly'> + <element name="readonly"> <empty/> </element> </optional> @@ -2745,12 +2745,12 @@ <interleave> <optional> <element name="space_hard_limit"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> <optional> <element name="space_soft_limit"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> </interleave> @@ -2767,8 +2767,8 @@ </define> <define name="fsDriver"> <element name="driver"> - <!-- Annoying inconsistency. 'disk' uses 'name' - for this kind of info, and 'type' for the + <!-- Annoying inconsistency. "disk" uses "name" + for this kind of info, and "type" for the storage format. We need the latter too, so had to invent a new attribute name --> <choice> @@ -2794,7 +2794,7 @@ <value>immediate</value> </attribute> </optional> - <ref name='virtioOptions'/> + <ref name="virtioOptions"/> </group> <group> <attribute name="type"> @@ -2805,7 +2805,7 @@ <ref name="unsignedInt"/> </attribute> </optional> - <ref name='virtioOptions'/> + <ref name="virtioOptions"/> </group> <empty/> </choice> @@ -2936,7 +2936,7 @@ </attribute> <interleave> <element name="source"> - <ref name='interface-network-attributes'/> + <ref name="interface-network-attributes"/> <optional> <ref name="interface-bridge-attributes"/> </optional> @@ -2963,7 +2963,7 @@ </attribute> </optional> <optional> - <ref name='interface-network-attributes'/> + <ref name="interface-network-attributes"/> </optional> <empty/> </element> @@ -3227,7 +3227,7 @@ <element name="model"> <attribute name="type"> <data type="string"> - <param name='pattern'>[a-zA-Z0-9\-_]+</param> + <param name="pattern">[a-zA-Z0-9\-_]+</param> </data> </attribute> <empty/> @@ -3236,13 +3236,13 @@ <optional> <element name="backend"> <optional> - <attribute name='tap'> - <ref name='absFilePath'/> + <attribute name="tap"> + <ref name="absFilePath"/> </attribute> </optional> <optional> - <attribute name='vhost'> - <ref name='absFilePath'/> + <attribute name="vhost"> + <ref name="absFilePath"/> </attribute> </optional> </element> @@ -3269,18 +3269,18 @@ </attribute> </optional> <optional> - <attribute name='queues'> + <attribute name="queues"> <ref name="positiveInteger"/> </attribute> </optional> <optional> - <attribute name='rx_queue_size'> - <ref name='positiveInteger'/> + <attribute name="rx_queue_size"> + <ref name="positiveInteger"/> </attribute> </optional> <optional> - <attribute name='tx_queue_size'> - <ref name='positiveInteger'/> + <attribute name="tx_queue_size"> + <ref name="positiveInteger"/> </attribute> </optional> <optional> @@ -3302,68 +3302,68 @@ <ref name="virtioOptions"/> <interleave> <optional> - <element name='host'> + <element name="host"> <optional> - <attribute name='csum'> + <attribute name="csum"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='gso'> + <attribute name="gso"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='tso4'> + <attribute name="tso4"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='tso6'> + <attribute name="tso6"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='ecn'> + <attribute name="ecn"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='ufo'> + <attribute name="ufo"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='mrg_rxbuf'> + <attribute name="mrg_rxbuf"> <ref name="virOnOff"/> </attribute> </optional> </element> </optional> <optional> - <element name='guest'> + <element name="guest"> <optional> - <attribute name='csum'> + <attribute name="csum"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='tso4'> + <attribute name="tso4"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='tso6'> + <attribute name="tso6"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='ecn'> + <attribute name="ecn"> <ref name="virOnOff"/> </attribute> </optional> <optional> - <attribute name='ufo'> + <attribute name="ufo"> <ref name="virOnOff"/> </attribute> </optional> @@ -3530,7 +3530,7 @@ </attribute> </optional> <optional> - <attribute name='sharePolicy'> + <attribute name="sharePolicy"> <choice> <value>allow-exclusive</value> <value>force-shared</value> @@ -4141,8 +4141,8 @@ </attribute> </define> - <define name='qemucdevSerialTgtType'> - <attribute name='type'> + <define name="qemucdevSerialTgtType"> + <attribute name="type"> <choice> <value>isa-serial</value> <value>usb-serial</value> @@ -4154,9 +4154,9 @@ </attribute> </define> - <define name='qemucdevSerialTgtModel'> - <element name='model'> - <attribute name='name'> + <define name="qemucdevSerialTgtModel"> + <element name="model"> + <attribute name="name"> <choice> <value>isa-serial</value> <value>usb-serial</value> @@ -4293,7 +4293,7 @@ <ref name="reconnect"/> </optional> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> </element> </zeroOrMore> @@ -4543,7 +4543,7 @@ <optional> <element name="stats"> <attribute name="period"> - <ref name='positiveInteger'/> + <ref name="positiveInteger"/> </attribute> </element> </optional> @@ -4634,9 +4634,9 @@ <attribute name="mode"> <value>host-certificates</value> </attribute> - <ref name='certificate'/> - <ref name='certificate'/> - <ref name='certificate'/> + <ref name="certificate"/> + <ref name="certificate"/> + <ref name="certificate"/> <optional> <element name="database"> <ref name="absDirPath"/> @@ -5087,12 +5087,12 @@ </attribute> <interleave> <oneOrMore> - <element name='host'> - <attribute name='name'> + <element name="host"> + <attribute name="name"> <text/> </attribute> <optional> - <attribute name='port'> + <attribute name="port"> <ref name="PortNumber"/> </attribute> </optional> @@ -5100,7 +5100,7 @@ </element> </oneOrMore> <optional> - <ref name='diskAuth'/> + <ref name="diskAuth"/> </optional> <optional> <ref name="initiatorinfo"/> @@ -5790,7 +5790,7 @@ </optional> <optional> <element name="maxpagesize"> - <ref name='scaledInteger'/> + <ref name="scaledInteger"/> </element> </optional> </element> @@ -6091,7 +6091,7 @@ <value>random</value> </attribute> <choice> - <ref name='absFilePath'/> + <ref name="absFilePath"/> <empty/> </choice> </group> @@ -6169,26 +6169,26 @@ </element> </define> - <define name='diskMirror'> - <element name='mirror'> + <define name="diskMirror"> + <element name="mirror"> <choice> <group> <!-- old format, for block copy back-compat --> - <attribute name='file'> - <ref name='absFilePath'/> + <attribute name="file"> + <ref name="absFilePath"/> </attribute> <optional> - <attribute name='format'> - <ref name='storageFormat'/> + <attribute name="format"> + <ref name="storageFormat"/> </attribute> </optional> <optional> - <attribute name='job'> + <attribute name="job"> <value>copy</value> </attribute> </optional> <optional> <interleave> - <ref name='diskSourceFile'/> + <ref name="diskSourceFile"/> <optional> <ref name="diskFormat"/> </optional> @@ -6196,7 +6196,7 @@ </optional> </group> <group> <!-- preferred format --> - <attribute name='job'> + <attribute name="job"> <choice> <value>copy</value> <value>active-commit</value> @@ -6211,7 +6211,7 @@ </group> </choice> <optional> - <attribute name='ready'> + <attribute name="ready"> <choice> <value>yes</value> <value>abort</value> @@ -6231,26 +6231,26 @@ </element> </define> - <define name='diskAuthSecret'> - <element name='secret'> - <attribute name='type'> + <define name="diskAuthSecret"> + <element name="secret"> + <attribute name="type"> <choice> <value>ceph</value> <value>iscsi</value> </choice> </attribute> <choice> - <attribute name='uuid'> + <attribute name="uuid"> <ref name="UUID"/> </attribute> - <attribute name='usage'> - <ref name='genericName'/> + <attribute name="usage"> + <ref name="genericName"/> </attribute> </choice> </element> </define> - <define name='diskIoTune'> + <define name="diskIoTune"> <element name="iotune"> <interleave> <choice> @@ -6436,7 +6436,7 @@ <optional> <attribute name="value"> <data type="string"> - <param name='pattern'>[^,]{0,12}</param> + <param name="pattern">[^,]{0,12}</param> </data> </attribute> </optional> @@ -6518,7 +6518,7 @@ <optional> <attribute name="mode"> <data type="string"> - <param name='pattern'>(sync_pt|share_pt)</param> + <param name="pattern">(sync_pt|share_pt)</param> </data> </attribute> </optional> @@ -6755,16 +6755,16 @@ <interleave> <zeroOrMore> <element name="arg"> - <attribute name='value'/> + <attribute name="value"/> </element> </zeroOrMore> <zeroOrMore> <element name="env"> - <attribute name='name'> + <attribute name="name"> <ref name="filter-param-name"/> </attribute> <optional> - <attribute name='value'/> + <attribute name="value"/> </optional> <empty/> </element> @@ -6806,7 +6806,7 @@ <value>pid</value> </choice> </attribute> - <attribute name='value'/> + <attribute name="value"/> </element> <element name="shareipc"> <attribute name="type"> @@ -6815,7 +6815,7 @@ <value>pid</value> </choice> </attribute> - <attribute name='value'/> + <attribute name="value"/> </element> <element name="shareuts"> <attribute name="type"> @@ -6824,7 +6824,7 @@ <value>pid</value> </choice> </attribute> - <attribute name='value'/> + <attribute name="value"/> </element> </zeroOrMore> </element> @@ -6838,7 +6838,7 @@ <element name="commandline" ns="http://libvirt.org/schemas/domain/bhyve/1.0"> <zeroOrMore> <element name="arg"> - <attribute name='value'/> + <attribute name="value"/> </element> </zeroOrMore> </element> @@ -6852,7 +6852,7 @@ <element name="commandline" ns="http://libvirt.org/schemas/domain/xen/1.0"> <zeroOrMore> <element name="arg"> - <attribute name='value'/> + <attribute name="value"/> </element> </zeroOrMore> </element> @@ -6888,7 +6888,7 @@ <data type="long"> <param name="pattern">-?[0-9]+</param> <param name="maxInclusive">18446744073709551</param> - <param name='minInclusive'>-1</param> + <param name="minInclusive">-1</param> </data> </define> <define name="rebootTimeoutDelay"> @@ -7002,7 +7002,7 @@ <param name="pattern">(0x)?[0-9a-fA-F]{1,8}</param> </data> </define> - <define name='aliasName'> + <define name="aliasName"> <data type="string"> <param name="pattern">[a-zA-Z0-9_\-.]+</param> </data> @@ -7017,10 +7017,10 @@ <param name="pattern">[0-9]{1,2}</param> </data> </define> - <define name='alias'> - <element name='alias'> - <attribute name='name'> - <ref name='aliasName'/> + <define name="alias"> + <element name="alias"> + <attribute name="name"> + <ref name="aliasName"/> </attribute> </element> <empty/> diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng index c881da741d..e1fb4f7cea 100644 --- a/docs/schemas/domainsnapshot.rng +++ b/docs/schemas/domainsnapshot.rng @@ -2,38 +2,38 @@ <!-- A Relax NG schema for the libvirt domain snapshot properties XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> - <ref name='domainsnapshot'/> + <ref name="domainsnapshot"/> </start> - <include href='domaincommon.rng'/> + <include href="domaincommon.rng"/> - <define name='domainsnapshot'> - <element name='domainsnapshot'> + <define name="domainsnapshot"> + <element name="domainsnapshot"> <interleave> <optional> - <element name='name'> + <element name="name"> <text/> </element> </optional> <optional> - <element name='description'> + <element name="description"> <text/> </element> </optional> <optional> - <element name='state'> - <ref name='state'/> + <element name="state"> + <ref name="state"/> </element> </optional> <optional> - <element name='creationTime'> + <element name="creationTime"> <text/> </element> </optional> <optional> - <element name='memory'> + <element name="memory"> <choice> - <attribute name='snapshot'> + <attribute name="snapshot"> <choice> <value>no</value> <value>internal</value> @@ -41,12 +41,12 @@ </attribute> <group> <optional> - <attribute name='snapshot'> + <attribute name="snapshot"> <value>external</value> </attribute> </optional> - <attribute name='file'> - <ref name='absFilePath'/> + <attribute name="file"> + <ref name="absFilePath"/> </attribute> </group> </choice> @@ -54,14 +54,14 @@ </element> </optional> <optional> - <element name='disks'> + <element name="disks"> <zeroOrMore> - <ref name='disksnapshot'/> + <ref name="disksnapshot"/> </zeroOrMore> </element> </optional> <optional> - <element name='active'> + <element name="active"> <choice> <value>0</value> <value>1</value> @@ -70,8 +70,8 @@ </optional> <optional> <choice> - <element name='domain'> - <element name='uuid'> + <element name="domain"> + <element name="uuid"> <ref name="UUID"/> </element> </element> @@ -79,21 +79,21 @@ storagecommon/domaincommon defines do not conflict with any domain.rng overrides. --> <grammar> - <include href='domain.rng'/> + <include href="domain.rng"/> </grammar> </choice> </optional> <optional> - <element name='parent'> - <element name='name'> + <element name="parent"> + <element name="name"> <text/> </element> </element> </optional> <optional> - <element name='cookie'> + <element name="cookie"> <zeroOrMore> - <ref name='customElement'/> + <ref name="customElement"/> </zeroOrMore> </element> </optional> @@ -101,7 +101,7 @@ </element> </define> - <define name='state'> + <define name="state"> <choice> <value>running</value> <value>blocked</value> @@ -113,55 +113,55 @@ </choice> </define> - <define name='storageSourceExtra' combine='choice'> + <define name="storageSourceExtra" combine="choice"> <!-- overrides the no-op version in storagecommon.rng --> - <ref name='disksnapshotdriver'/> + <ref name="disksnapshotdriver"/> </define> - <define name='disksnapshot'> - <element name='disk'> - <attribute name='name'> + <define name="disksnapshot"> + <element name="disk"> + <attribute name="name"> <choice> - <ref name='diskTarget'/> - <ref name='absFilePath'/> + <ref name="diskTarget"/> + <ref name="absFilePath"/> </choice> </attribute> <choice> - <attribute name='snapshot'> + <attribute name="snapshot"> <value>no</value> </attribute> - <attribute name='snapshot'> + <attribute name="snapshot"> <value>internal</value> </attribute> <group> <optional> - <attribute name='snapshot'> + <attribute name="snapshot"> <value>external</value> </attribute> </optional> <choice> <group> <optional> - <attribute name='type'> + <attribute name="type"> <value>file</value> </attribute> </optional> <interleave> <optional> - <element name='source'> + <element name="source"> <optional> - <attribute name='file'> - <ref name='absFilePath'/> + <attribute name="file"> + <ref name="absFilePath"/> </attribute> </optional> <optional> - <ref name='storageStartupPolicy'/> + <ref name="storageStartupPolicy"/> </optional> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='diskSourceCommon'/> + <ref name="diskSourceCommon"/> </optional> <optional> <ref name="encryption"/> @@ -169,11 +169,11 @@ <empty/> </element> </optional> - <ref name='storageSourceExtra'/> + <ref name="storageSourceExtra"/> </interleave> </group> <group> - <attribute name='type'> + <attribute name="type"> <value>block</value> </attribute> <interleave> @@ -183,10 +183,10 @@ <ref name="absFilePath"/> </attribute> <zeroOrMore> - <ref name='devSeclabel'/> + <ref name="devSeclabel"/> </zeroOrMore> <optional> - <ref name='diskSourceCommon'/> + <ref name="diskSourceCommon"/> </optional> <optional> <ref name="encryption"/> @@ -194,22 +194,22 @@ <empty/> </element> </optional> - <ref name='storageSourceExtra'/> + <ref name="storageSourceExtra"/> </interleave> </group> - <ref name='diskSourceNetwork'/> + <ref name="diskSourceNetwork"/> </choice> </group> </choice> </element> </define> - <define name='disksnapshotdriver'> + <define name="disksnapshotdriver"> <optional> - <element name='driver'> + <element name="driver"> <optional> - <attribute name='type'> - <ref name='storageFormatBacking'/> + <attribute name="type"> + <ref name="storageFormatBacking"/> </attribute> </optional> <empty/> diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng index a4fddaaedc..8c11f0d5a7 100644 --- a/docs/schemas/interface.rng +++ b/docs/schemas/interface.rng @@ -17,7 +17,7 @@ </choice> </start> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> <!-- FIXME: How do we handle VLAN's ? Should they be their own interface or should we treat them as an option on the base interface ? For @@ -131,7 +131,7 @@ </attribute> </optional> <!-- Bridge forward delay - (see 'ip link set <dev> type bridge forward_delay') --> + (see "ip link set <dev> type bridge forward_delay") --> <optional v:since="2"> <attribute name="delay"><ref name="timeval"/></attribute> </optional> @@ -426,7 +426,7 @@ </data> </define> - <define name='vlan-id'> + <define name="vlan-id"> <data type="unsignedInt"> <param name="maxInclusive">4095</param> </data> diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 3a5eb3ced4..4317572208 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -6,8 +6,8 @@ <ref name="network"/> </start> - <include href='basictypes.rng'/> - <include href='networkcommon.rng'/> + <include href="basictypes.rng"/> + <include href="networkcommon.rng"/> <define name="network"> @@ -133,9 +133,9 @@ <choice> <group> <zeroOrMore> - <element name='interface'> - <attribute name='dev'> - <ref name='deviceName'/> + <element name="interface"> + <attribute name="dev"> + <ref name="deviceName"/> </attribute> <optional> <attribute name="connections"> @@ -147,8 +147,8 @@ </group> <group> <zeroOrMore> - <element name='address'> - <attribute name='type'> + <element name="address"> + <attribute name="type"> <value>pci</value> </attribute> <ref name="pciaddress"/> @@ -162,9 +162,9 @@ </group> </choice> <optional> - <element name='pf'> - <attribute name='dev'> - <ref name='deviceName'/> + <element name="pf"> + <attribute name="dev"> + <ref name="deviceName"/> </attribute> </element> </optional> @@ -180,7 +180,7 @@ </element> </optional> <optional> - <element name='nat'> + <element name="nat"> <optional> <attribute name="ipv6"> <ref name="virYesNo"/> @@ -188,22 +188,22 @@ </optional> <interleave> <optional> - <element name='address'> - <attribute name='start'> - <ref name='ipv4Addr'/> + <element name="address"> + <attribute name="start"> + <ref name="ipv4Addr"/> </attribute> - <attribute name='end'> - <ref name='ipv4Addr'/> + <attribute name="end"> + <ref name="ipv4Addr"/> </attribute> </element> </optional> <optional> - <element name='port'> - <attribute name='start'> - <ref name='port'/> + <element name="port"> + <attribute name="start"> + <ref name="port"/> </attribute> - <attribute name='end'> - <ref name='port'/> + <attribute name="end"> + <ref name="port"/> </attribute> </element> </optional> @@ -439,7 +439,7 @@ <element name="options" ns="http://libvirt.org/schemas/network/dnsmasq/1.0"> <zeroOrMore> <element name="option"> - <attribute name='value'/> + <attribute name="value"/> </element> </zeroOrMore> </element> diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng index ad3f590c91..6df6d43f54 100644 --- a/docs/schemas/networkcommon.rng +++ b/docs/schemas/networkcommon.rng @@ -173,7 +173,7 @@ </attribute> </optional> <optional> - <attribute name='burst'> + <attribute name="burst"> <ref name="BurstSize"/> </attribute> </optional> @@ -192,19 +192,19 @@ </data> </define> - <define name='unsignedShort'> - <data type='integer'> + <define name="unsignedShort"> + <data type="integer"> <param name="minInclusive">0</param> <param name="maxInclusive">65535</param> </data> </define> - <define name='protocol'> - <data type='string'> - <param name='pattern'>(tcp)|(udp)</param> + <define name="protocol"> + <data type="string"> + <param name="pattern">(tcp)|(udp)</param> </data> </define> - <define name='addr-family'> - <data type='string'> + <define name="addr-family"> + <data type="string"> <param name="pattern">(ipv4)|(ipv6)</param> </data> </define> @@ -237,17 +237,17 @@ </element> </define> - <define name='port'> - <data type='integer'> - <param name='minInclusive'>1</param> - <param name='maxInclusive'>65535</param> + <define name="port"> + <data type="integer"> + <param name="minInclusive">1</param> + <param name="maxInclusive">65535</param> </data> </define> <!-- The (static) route element specifies a network address and gateway address to access that network. Both the network address and the gateway address must be specified. --> - <define name='route'> + <define name="route"> <element name="route"> <optional> <attribute name="family"><ref name="addr-family"/></attribute> diff --git a/docs/schemas/networkport.rng b/docs/schemas/networkport.rng index 031c5241f0..1a12a32c3c 100644 --- a/docs/schemas/networkport.rng +++ b/docs/schemas/networkport.rng @@ -2,8 +2,8 @@ <!-- A Relax NG schema for the libvirt network port XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> - <include href='networkcommon.rng'/> + <include href="basictypes.rng"/> + <include href="networkcommon.rng"/> <start> <ref name="networkport"/> @@ -152,7 +152,7 @@ <empty/> </element> </optional> - <element name='address'> + <element name="address"> <ref name="pciaddress"/> </element> </define> diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index f7f517b548..166e278cf8 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -2,12 +2,12 @@ <!-- A Relax NG schema for the libvirt node device XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> <start> - <ref name='device'/> + <ref name="device"/> </start> - <define name='device'> + <define name="device"> <element name="device"> <!-- The name of the network, used to refer to it through the API and in virsh --> @@ -17,7 +17,7 @@ </optional> <optional> <element name="devnode"> - <attribute name='type'> + <attribute name="type"> <value>dev</value> </attribute> <text/> @@ -25,7 +25,7 @@ </optional> <zeroOrMore> <element name="devnode"> - <attribute name='type'> + <attribute name="type"> <value>link</value> </attribute> <text/> @@ -47,21 +47,21 @@ </element> </define> - <define name='parent'> - <element name='parent'> + <define name="parent"> + <element name="parent"> <choice> <group> - <attribute name='wwnn'> - <ref name='wwn'/> + <attribute name="wwnn"> + <ref name="wwn"/> </attribute> - <attribute name='wwpn'> - <ref name='wwn'/> + <attribute name="wwpn"> + <ref name="wwn"/> </attribute> <empty/> </group> <group> - <attribute name='fabric_wwn'> - <ref name='wwn'/> + <attribute name="fabric_wwn"> + <ref name="wwn"/> </attribute> <empty/> </group> @@ -70,7 +70,7 @@ </element> </define> - <define name='capability'> + <define name="capability"> <element name="capability"> <choice> <ref name="capsystem"/> @@ -90,73 +90,73 @@ </element> </define> - <define name='capsystem'> - <attribute name='type'> + <define name="capsystem"> + <attribute name="type"> <value>system</value> </attribute> <optional> - <element name='product'><text/></element> + <element name="product"><text/></element> </optional> - <element name='hardware'> + <element name="hardware"> <optional> - <element name='vendor'><text/></element> + <element name="vendor"><text/></element> </optional> <optional> - <element name='version'><text/></element> + <element name="version"><text/></element> </optional> <optional> - <element name='serial'><text/></element> + <element name="serial"><text/></element> </optional> - <element name='uuid'> - <ref name='UUID'/> + <element name="uuid"> + <ref name="UUID"/> </element> </element> - <element name='firmware'> + <element name="firmware"> <optional> - <element name='vendor'><text/></element> + <element name="vendor"><text/></element> </optional> <optional> - <element name='version'><text/></element> + <element name="version"><text/></element> </optional> <optional> - <element name='release_date'><text/></element> + <element name="release_date"><text/></element> </optional> </element> </define> - <define name='cappcidev'> - <attribute name='type'> + <define name="cappcidev"> + <attribute name="type"> <value>pci</value> </attribute> <optional> - <element name='class'> + <element name="class"> <data type="string"> <param name="pattern">0x[0-9a-fA-F]{6}</param> </data> </element> </optional> - <element name='domain'> - <ref name='unsignedLong'/> + <element name="domain"> + <ref name="unsignedLong"/> </element> - <element name='bus'> - <ref name='unsignedLong'/> + <element name="bus"> + <ref name="unsignedLong"/> </element> - <element name='slot'> - <ref name='unsignedLong'/> + <element name="slot"> + <ref name="unsignedLong"/> </element> - <element name='function'> - <ref name='unsignedLong'/> + <element name="function"> + <ref name="unsignedLong"/> </element> - <element name='product'> - <attribute name='id'> - <ref name='hexuint'/> + <element name="product"> + <attribute name="id"> + <ref name="hexuint"/> </attribute> <choice> @@ -165,9 +165,9 @@ </choice> </element> - <element name='vendor'> - <attribute name='id'> - <ref name='hexuint'/> + <element name="vendor"> + <attribute name="id"> + <ref name="hexuint"/> </attribute> <choice> @@ -177,35 +177,35 @@ </element> <optional> - <element name='capability'> - <attribute name='type'> + <element name="capability"> + <attribute name="type"> <value>phys_function</value> </attribute> <optional> - <ref name='address'/> + <ref name="address"/> </optional> </element> </optional> <optional> - <element name='capability'> - <attribute name='type'> + <element name="capability"> + <attribute name="type"> <value>virt_functions</value> </attribute> <optional> - <attribute name='maxCount'> - <ref name='unsignedInt'/> + <attribute name="maxCount"> + <ref name="unsignedInt"/> </attribute> </optional> <zeroOrMore> - <ref name='address'/> + <ref name="address"/> </zeroOrMore> </element> </optional> <optional> - <element name='capability'> - <attribute name='type'> + <element name="capability"> + <attribute name="type"> <choice> <value>pci-bridge</value> <value>cardbus-bridge</value> @@ -215,23 +215,23 @@ </optional> <optional> - <element name='capability'> - <attribute name='type'> + <element name="capability"> + <attribute name="type"> <value>mdev_types</value> </attribute> <oneOrMore> - <element name='type'> - <attribute name='id'> - <data type='string'/> + <element name="type"> + <attribute name="id"> + <data type="string"/> </attribute> <optional> - <element name='name'><text/></element> + <element name="name"><text/></element> </optional> - <element name='deviceAPI'> + <element name="deviceAPI"> <value>vfio-pci</value> </element> - <element name='availableInstances'> - <ref name='unsignedInt'/> + <element name="availableInstances"> + <ref name="unsignedInt"/> </element> </element> </oneOrMore> @@ -239,50 +239,50 @@ </optional> <optional> - <element name='iommuGroup'> - <attribute name='number'> - <ref name='unsignedInt'/> + <element name="iommuGroup"> + <attribute name="number"> + <ref name="unsignedInt"/> </attribute> <oneOrMore> - <ref name='address'/> + <ref name="address"/> </oneOrMore> </element> </optional> <optional> - <element name='numa'> + <element name="numa"> <optional> - <attribute name='node'> - <data type='int'/> + <attribute name="node"> + <data type="int"/> </attribute> </optional> </element> </optional> <optional> - <element name='pci-express'> + <element name="pci-express"> <zeroOrMore> - <element name='link'> - <attribute name='validity'> + <element name="link"> + <attribute name="validity"> <choice> <value>cap</value> <value>sta</value> </choice> </attribute> <optional> - <attribute name='port'> - <ref name='unsignedInt'/> + <attribute name="port"> + <ref name="unsignedInt"/> </attribute> </optional> <optional> - <attribute name='speed'> + <attribute name="speed"> <data type="string"> <param name="pattern">[0-9]+(.[0-9]+)?</param> </data> </attribute> </optional> - <attribute name='width'> - <ref name='unsignedInt'/> + <attribute name="width"> + <ref name="unsignedInt"/> </attribute> </element> </zeroOrMore> @@ -290,21 +290,21 @@ </optional> </define> - <define name='capusbdev'> - <attribute name='type'> + <define name="capusbdev"> + <attribute name="type"> <value>usb_device</value> </attribute> - <element name='bus'> - <ref name='unsignedLong'/> + <element name="bus"> + <ref name="unsignedLong"/> </element> - <element name='device'> - <ref name='unsignedLong'/> + <element name="device"> + <ref name="unsignedLong"/> </element> - <element name='product'> - <attribute name='id'> - <ref name='hexuint'/> + <element name="product"> + <attribute name="id"> + <ref name="hexuint"/> </attribute> <choice> @@ -313,9 +313,9 @@ </choice> </element> - <element name='vendor'> - <attribute name='id'> - <ref name='hexuint'/> + <element name="vendor"> + <attribute name="id"> + <ref name="hexuint"/> </attribute> <choice> @@ -325,294 +325,294 @@ </element> </define> - <define name='capusbinterface'> - <attribute name='type'> + <define name="capusbinterface"> + <attribute name="type"> <value>usb</value> </attribute> - <element name='number'> - <ref name='unsignedLong'/> + <element name="number"> + <ref name="unsignedLong"/> </element> - <element name='class'> - <ref name='unsignedLong'/> + <element name="class"> + <ref name="unsignedLong"/> </element> - <element name='subclass'> - <ref name='unsignedLong'/> + <element name="subclass"> + <ref name="unsignedLong"/> </element> - <element name='protocol'> - <ref name='unsignedLong'/> + <element name="protocol"> + <ref name="unsignedLong"/> </element> <optional> - <element name='description'> + <element name="description"> <text/> </element> </optional> </define> - <define name='capnet'> - <attribute name='type'> + <define name="capnet"> + <attribute name="type"> <value>net</value> </attribute> - <element name='interface'> + <element name="interface"> <text/> </element> <optional> - <element name='address'> - <ref name='mac'/> + <element name="address"> + <ref name="mac"/> </element> </optional> <ref name="link-speed-state"/> <zeroOrMore> - <element name='feature'> - <attribute name='name'> - <ref name='netfeaturename'/> + <element name="feature"> + <attribute name="name"> + <ref name="netfeaturename"/> </attribute> </element> </zeroOrMore> <zeroOrMore> - <ref name='subcapnet'/> + <ref name="subcapnet"/> </zeroOrMore> </define> - <define name='netfeaturename'> - <data type='string'> - <param name='pattern'>[a-zA-Z\-_]+</param> + <define name="netfeaturename"> + <data type="string"> + <param name="pattern">[a-zA-Z\-_]+</param> </data> </define> - <define name='subcapnet'> - <element name='capability'> + <define name="subcapnet"> + <element name="capability"> <choice> - <ref name='subcapnet80203'/> - <ref name='subcapnet80211'/> + <ref name="subcapnet80203"/> + <ref name="subcapnet80211"/> </choice> </element> </define> - <define name='subcapnet80203'> - <attribute name='type'> + <define name="subcapnet80203"> + <attribute name="type"> <value>80203</value> </attribute> </define> - <define name='subcapnet80211'> - <attribute name='type'> + <define name="subcapnet80211"> + <attribute name="type"> <value>80211</value> </attribute> </define> - <define name='capsfchost'> - <attribute name='type'> + <define name="capsfchost"> + <attribute name="type"> <value>fc_host</value> </attribute> - <element name='wwnn'> - <ref name='wwn'/> + <element name="wwnn"> + <ref name="wwn"/> </element> - <element name='wwpn'> - <ref name='wwn'/> + <element name="wwpn"> + <ref name="wwn"/> </element> <optional> - <element name='fabric_wwn'> - <ref name='wwn'/> + <element name="fabric_wwn"> + <ref name="wwn"/> </element> </optional> </define> - <define name='capsvports'> - <attribute name='type'> + <define name="capsvports"> + <attribute name="type"> <value>vports_ops</value> </attribute> - <element name='max_vports'> - <ref name='unsignedInt'/> + <element name="max_vports"> + <ref name="unsignedInt"/> </element> - <element name='vports'> - <ref name='unsignedInt'/> + <element name="vports"> + <ref name="unsignedInt"/> </element> </define> - <define name='capscsihost'> - <attribute name='type'> + <define name="capscsihost"> + <attribute name="type"> <value>scsi_host</value> </attribute> - <element name='host'> - <ref name='unsignedLong'/> + <element name="host"> + <ref name="unsignedLong"/> </element> <optional> - <element name='unique_id'> - <ref name='positiveInteger'/> + <element name="unique_id"> + <ref name="positiveInteger"/> </element> </optional> <optional> <zeroOrMore> - <element name='capability'> + <element name="capability"> <choice> - <ref name='capsfchost'/> - <ref name='capsvports'/> + <ref name="capsfchost"/> + <ref name="capsvports"/> </choice> </element> </zeroOrMore> </optional> </define> - <define name='capsfcrport'> - <attribute name='type'> + <define name="capsfcrport"> + <attribute name="type"> <value>fc_remote_port</value> </attribute> - <element name='rport'> + <element name="rport"> <text/> </element> - <element name='wwpn'> - <ref name='wwn'/> + <element name="wwpn"> + <ref name="wwn"/> </element> </define> - <define name='capscsitarget'> - <attribute name='type'> + <define name="capscsitarget"> + <attribute name="type"> <value>scsi_target</value> </attribute> - <element name='target'> + <element name="target"> <text/> </element> <optional> - <element name='capability'> - <ref name='capsfcrport'/> + <element name="capability"> + <ref name="capsfcrport"/> </element> </optional> </define> - <define name='capscsi'> - <attribute name='type'> + <define name="capscsi"> + <attribute name="type"> <value>scsi</value> </attribute> - <element name='host'> - <ref name='unsignedLong'/> + <element name="host"> + <ref name="unsignedLong"/> </element> - <element name='bus'> - <ref name='unsignedLong'/> + <element name="bus"> + <ref name="unsignedLong"/> </element> - <element name='target'> - <ref name='unsignedLong'/> + <element name="target"> + <ref name="unsignedLong"/> </element> - <element name='lun'> - <ref name='unsignedLong'/> + <element name="lun"> + <ref name="unsignedLong"/> </element> - <element name='type'> + <element name="type"> <text/> </element> </define> - <define name='capstorage'> - <attribute name='type'> + <define name="capstorage"> + <attribute name="type"> <value>storage</value> </attribute> - <element name='block'> - <ref name='path'/> + <element name="block"> + <ref name="path"/> </element> <optional> - <element name='bus'> + <element name="bus"> <text/> </element> </optional> <optional> - <element name='drive_type'> + <element name="drive_type"> <text/> </element> </optional> <optional> - <element name='model'> + <element name="model"> <text/> </element> </optional> <optional> - <element name='vendor'> + <element name="vendor"> <text/> </element> </optional> <optional> - <element name='serial'> + <element name="serial"> <text/> </element> </optional> <choice> - <ref name='capstorageremoveable'/> - <ref name='capstoragefixed'/> + <ref name="capstorageremoveable"/> + <ref name="capstoragefixed"/> </choice> <optional> - <element name='capability'> - <attribute name='type'> + <element name="capability"> + <attribute name="type"> <value>hotpluggable</value> </attribute> </element> </optional> </define> - <define name='capstorageremoveable'> - <element name='capability'> - <attribute name='type'> + <define name="capstorageremoveable"> + <element name="capability"> + <attribute name="type"> <value>removable</value> </attribute> - <element name='media_available'> + <element name="media_available"> <choice> <value>1</value> <value>0</value> </choice> </element> - <element name='media_size'> - <ref name='unsignedLong'/> + <element name="media_size"> + <ref name="unsignedLong"/> </element> <optional> - <element name='media_label'> + <element name="media_label"> <text/> </element> </optional> - <ref name='blockData'/> + <ref name="blockData"/> </element> </define> - <define name='capstoragefixed'> - <element name='size'> - <ref name='unsignedLong'/> + <define name="capstoragefixed"> + <element name="size"> + <ref name="unsignedLong"/> </element> - <ref name='blockData'/> + <ref name="blockData"/> </define> - <define name='blockData'> + <define name="blockData"> <optional> - <element name='logical_block_size'> - <ref name='unsignedLong'/> + <element name="logical_block_size"> + <ref name="unsignedLong"/> </element> - <element name='num_blocks'> - <ref name='unsignedLong'/> + <element name="num_blocks"> + <ref name="unsignedLong"/> </element> </optional> </define> - <define name='capdrm'> - <attribute name='type'> + <define name="capdrm"> + <attribute name="type"> <value>drm</value> </attribute> - <element name='type'> + <element name="type"> <choice> <value>primary</value> <value>control</value> @@ -621,19 +621,19 @@ </element> </define> - <define name='capmdev'> - <attribute name='type'> + <define name="capmdev"> + <attribute name="type"> <value>mdev</value> </attribute> - <element name='type'> - <attribute name='id'> - <data type='string'/> + <element name="type"> + <attribute name="id"> + <data type="string"/> </attribute> </element> <optional> - <element name='iommuGroup'> - <attribute name='number'> - <ref name='unsignedInt'/> + <element name="iommuGroup"> + <attribute name="number"> + <ref name="unsignedInt"/> </attribute> </element> </optional> @@ -645,53 +645,53 @@ </zeroOrMore> </define> - <define name='capccwdev'> - <attribute name='type'> + <define name="capccwdev"> + <attribute name="type"> <value>ccw</value> </attribute> - <element name='cssid'> - <ref name='ccwCssidRange'/> + <element name="cssid"> + <ref name="ccwCssidRange"/> </element> - <element name='ssid'> - <ref name='ccwSsidRange'/> + <element name="ssid"> + <ref name="ccwSsidRange"/> </element> - <element name='devno'> - <ref name='ccwDevnoRange'/> + <element name="devno"> + <ref name="ccwDevnoRange"/> </element> </define> - <define name='capcssdev'> - <attribute name='type'> + <define name="capcssdev"> + <attribute name="type"> <value>css</value> </attribute> - <element name='cssid'> - <ref name='ccwCssidRange'/> + <element name="cssid"> + <ref name="ccwCssidRange"/> </element> - <element name='ssid'> - <ref name='ccwSsidRange'/> + <element name="ssid"> + <ref name="ccwSsidRange"/> </element> - <element name='devno'> - <ref name='ccwDevnoRange'/> + <element name="devno"> + <ref name="ccwDevnoRange"/> </element> </define> - <define name='address'> - <element name='address'> - <attribute name='domain'><ref name='hexuint'/></attribute> - <attribute name='bus'><ref name='hexuint'/></attribute> - <attribute name='slot'><ref name='hexuint'/></attribute> - <attribute name='function'><ref name='hexuint'/></attribute> + <define name="address"> + <element name="address"> + <attribute name="domain"><ref name="hexuint"/></attribute> + <attribute name="bus"><ref name="hexuint"/></attribute> + <attribute name="slot"><ref name="hexuint"/></attribute> + <attribute name="function"><ref name="hexuint"/></attribute> </element> </define> - <define name='mac'> - <data type='string'> + <define name="mac"> + <data type="string"> <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param> </data> </define> - <define name='path'> - <data type='string'> + <define name="path"> + <data type="string"> <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param> </data> </define> diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng index f06ae9db76..75caf61b89 100644 --- a/docs/schemas/nwfilter.rng +++ b/docs/schemas/nwfilter.rng @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> - <include href='nwfilter_params.rng'/> + <include href="basictypes.rng"/> + <include href="nwfilter_params.rng"/> <start> <ref name="filter"/> </start> @@ -242,26 +242,26 @@ </optional> <optional> <attribute name="priority"> - <ref name='priority-type'/> + <ref name="priority-type"/> </attribute> </optional> </define> <define name="rule-node-attributes"> <attribute name="action"> - <ref name='action-type'/> + <ref name="action-type"/> </attribute> <attribute name="direction"> - <ref name='direction-type'/> + <ref name="direction-type"/> </attribute> <optional> <attribute name="priority"> - <ref name='priority-type'/> + <ref name="priority-type"/> </attribute> </optional> <optional> <attribute name="statematch"> - <ref name='statematch-type'/> + <ref name="statematch-type"/> </attribute> </optional> </define> @@ -923,7 +923,7 @@ </choice> </define> - <define name='action-type'> + <define name="action-type"> <choice> <value>drop</value> <value>accept</value> @@ -933,7 +933,7 @@ </choice> </define> - <define name='direction-type'> + <define name="direction-type"> <choice> <value>in</value> <value>out</value> @@ -941,35 +941,35 @@ </choice> </define> - <define name='priority-type'> + <define name="priority-type"> <data type="int"> <param name="minInclusive">-1000</param> <param name="maxInclusive">1000</param> </data> </define> - <define name='statematch-type'> + <define name="statematch-type"> <data type="string"> <param name="pattern">([Ff][Aa][Ll][Ss][Ee]|0)</param> </data> </define> - <define name='comment-type'> + <define name="comment-type"> <data type="string"/> </define> - <define name='stateflags-type'> + <define name="stateflags-type"> <data type="string"> <param name="pattern">((NEW|ESTABLISHED|RELATED|INVALID)(,(NEW|ESTABLISHED|RELATED|INVALID))*|NONE)</param> </data> </define> - <define name='tcpflags-type'> + <define name="tcpflags-type"> <data type="string"> <param name="pattern">((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE)/((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE)</param> </data> </define> - <define name='ipset-name-type'> + <define name="ipset-name-type"> <choice> <ref name="variable-name-type"/> <data type="string"> @@ -978,7 +978,7 @@ </choice> </define> - <define name='ipset-flags-type'> + <define name="ipset-flags-type"> <data type="string"> <param name="pattern">(src|dst)(,(src|dst)){0,5}</param> </data> diff --git a/docs/schemas/nwfilterbinding.rng b/docs/schemas/nwfilterbinding.rng index 9c8e5a83cf..a0a956eb01 100644 --- a/docs/schemas/nwfilterbinding.rng +++ b/docs/schemas/nwfilterbinding.rng @@ -1,8 +1,8 @@ <?xml version="1.0"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <!-- domain-related definitions used in multiple grammars --> - <include href='basictypes.rng'/> - <include href='nwfilter_params.rng'/> + <include href="basictypes.rng"/> + <include href="nwfilter_params.rng"/> <start> <ref name="filterbinding"/> diff --git a/docs/schemas/secret.rng b/docs/schemas/secret.rng index e0add8a5e9..1aafe03e61 100644 --- a/docs/schemas/secret.rng +++ b/docs/schemas/secret.rng @@ -2,42 +2,42 @@ <!-- A Relax NG schema for the libvirt secret properties XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> - <ref name='secret'/> + <ref name="secret"/> </start> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> - <define name='secret'> - <element name='secret'> + <define name="secret"> + <element name="secret"> <optional> - <attribute name='ephemeral'> + <attribute name="ephemeral"> <ref name="virYesNo"/> </attribute> </optional> <optional> - <attribute name='private'> + <attribute name="private"> <ref name="virYesNo"/> </attribute> </optional> <interleave> <optional> - <element name='uuid'> - <ref name='UUID'/> + <element name="uuid"> + <ref name="UUID"/> </element> </optional> <optional> - <element name='description'> + <element name="description"> <text/> </element> </optional> <optional> - <element name='usage'> + <element name="usage"> <choice> - <ref name='usagevolume'/> - <ref name='usageceph'/> - <ref name='usageiscsi'/> - <ref name='usagetls'/> - <ref name='usagevtpm'/> + <ref name="usagevolume"/> + <ref name="usageceph"/> + <ref name="usageiscsi"/> + <ref name="usagetls"/> + <ref name="usagevtpm"/> <!-- More choices later --> </choice> </element> @@ -46,48 +46,48 @@ </element> </define> - <define name='usagevolume'> - <attribute name='type'> + <define name="usagevolume"> + <attribute name="type"> <value>volume</value> </attribute> - <element name='volume'> - <ref name='absFilePath'/> + <element name="volume"> + <ref name="absFilePath"/> </element> </define> - <define name='usageceph'> - <attribute name='type'> + <define name="usageceph"> + <attribute name="type"> <value>ceph</value> </attribute> - <element name='name'> - <ref name='genericName'/> + <element name="name"> + <ref name="genericName"/> </element> </define> - <define name='usageiscsi'> - <attribute name='type'> + <define name="usageiscsi"> + <attribute name="type"> <value>iscsi</value> </attribute> - <element name='target'> - <ref name='genericName'/> + <element name="target"> + <ref name="genericName"/> </element> </define> - <define name='usagetls'> - <attribute name='type'> + <define name="usagetls"> + <attribute name="type"> <value>tls</value> </attribute> - <element name='name'> - <ref name='genericName'/> + <element name="name"> + <ref name="genericName"/> </element> </define> - <define name='usagevtpm'> - <attribute name='type'> + <define name="usagevtpm"> + <attribute name="type"> <value>vtpm</value> </attribute> - <element name='name'> - <ref name='genericName'/> + <element name="name"> + <ref name="genericName"/> </element> </define> diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index d837f92bc7..6597ebc824 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -14,9 +14,9 @@ </data> </define> - <define name='encryption'> - <element name='encryption'> - <attribute name='format'> + <define name="encryption"> + <element name="encryption"> + <attribute name="format"> <choice> <value>default</value> <value>qcow</value> @@ -24,23 +24,23 @@ </choice> </attribute> <interleave> - <ref name='secret'/> + <ref name="secret"/> <optional> - <element name='cipher'> - <ref name='keycipher'/> + <element name="cipher"> + <ref name="keycipher"/> </element> - <element name='ivgen'> - <ref name='keyivgen'/> + <element name="ivgen"> + <ref name="keyivgen"/> </element> </optional> </interleave> </element> </define> - <define name='initiatorinfo'> - <element name='initiator'> - <element name='iqn'> - <attribute name='name'> + <define name="initiatorinfo"> + <element name="initiator"> + <element name="iqn"> + <attribute name="name"> <text/> </attribute> <empty/> @@ -61,7 +61,7 @@ </element> </define> - <define name='unixSocketSource'> + <define name="unixSocketSource"> <element name="source"> <attribute name="type"> <value>unix</value> @@ -82,47 +82,47 @@ </element> </define> - <define name='reservations'> - <element name='reservations'> + <define name="reservations"> + <element name="reservations"> <optional> - <attribute name='managed'> - <ref name='virYesNo'/> + <attribute name="managed"> + <ref name="virYesNo"/> </attribute> </optional> <optional> - <ref name='unixSocketSource'/> + <ref name="unixSocketSource"/> </optional> </element> </define> - <define name='secret'> - <element name='secret'> - <attribute name='type'> + <define name="secret"> + <element name="secret"> + <attribute name="type"> <value>passphrase</value> </attribute> <choice> - <attribute name='uuid'> + <attribute name="uuid"> <ref name="UUID"/> </attribute> - <attribute name='usage'> + <attribute name="usage"> <text/> </attribute> </choice> </element> </define> - <define name='compat'> - <element name='compat'> - <data type='string'> - <param name='pattern'>[0-9]+\.[0-9]+</param> + <define name="compat"> + <element name="compat"> + <data type="string"> + <param name="pattern">[0-9]+\.[0-9]+</param> </data> </element> </define> - <define name='fileFormatFeatures'> - <element name='features'> + <define name="fileFormatFeatures"> + <element name="features"> <interleave> <optional> - <element name='lazy_refcounts'> + <element name="lazy_refcounts"> <empty/> </element> </optional> @@ -132,7 +132,7 @@ <!-- split the list of known storage formats into two, those where we know how to follow backing chains, and all others --> - <define name='storageFormatBacking'> + <define name="storageFormatBacking"> <choice> <value>cow</value> <value>qcow</value> @@ -141,7 +141,7 @@ <value>vmdk</value> </choice> </define> - <define name='storageFormat'> + <define name="storageFormat"> <choice> <value>raw</value> <value>dir</value> @@ -155,51 +155,51 @@ <value>vhd</value> <value>ploop</value> <value>luks</value> - <ref name='storageFormatBacking'/> + <ref name="storageFormatBacking"/> </choice> </define> - <define name='storageStartupPolicy'> - <!-- Use a combine='choice' override in client files that want to + <define name="storageStartupPolicy"> + <!-- Use a combine="choice" override in client files that want to add additional attributes to a <source> sub-element associated with a storage source --> <notAllowed/> </define> - <define name='storageSourceExtra'> - <!-- Use a combine='choice' override in client files that want to + <define name="storageSourceExtra"> + <!-- Use a combine="choice" override in client files that want to add additional elements as siblings of a <source> sub-element associated with a storage source --> <notAllowed/> </define> - <define name='permissions'> + <define name="permissions"> <optional> - <element name='permissions'> + <element name="permissions"> <interleave> <optional> - <element name='mode'> - <ref name='octalMode'/> + <element name="mode"> + <ref name="octalMode"/> </element> </optional> <optional> - <element name='owner'> + <element name="owner"> <choice> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> <value>-1</value> </choice> </element> </optional> <optional> - <element name='group'> + <element name="group"> <choice> - <ref name='unsignedInt'/> + <ref name="unsignedInt"/> <value>-1</value> </choice> </element> </optional> <optional> - <element name='label'> + <element name="label"> <text/> </element> </optional> @@ -208,35 +208,35 @@ </optional> </define> - <define name='keycipher'> - <attribute name='name'> + <define name="keycipher"> + <attribute name="name"> <text/> </attribute> - <attribute name='size'> + <attribute name="size"> <ref name="unsignedInt"/> </attribute> <optional> - <attribute name='mode'> + <attribute name="mode"> <text/> </attribute> - <attribute name='hash'> + <attribute name="hash"> <text/> </attribute> </optional> </define> - <define name='keyivgen'> - <attribute name='name'> + <define name="keyivgen"> + <attribute name="name"> <text/> </attribute> <optional> - <attribute name='hash'> + <attribute name="hash"> <text/> </attribute> </optional> </define> - <define name='refreshVolumeAllocation'> + <define name="refreshVolumeAllocation"> <choice> <value>default</value> <value>capacity</value> diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index f5cf6769c8..a87d22f6fc 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -2,240 +2,240 @@ <!-- A Relax NG schema for the libvirt storage pool XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> - <include href='storagecommon.rng'/> + <include href="basictypes.rng"/> + <include href="storagecommon.rng"/> <start> - <ref name='pool'/> + <ref name="pool"/> </start> - <define name='pool'> - <element name='pool'> + <define name="pool"> + <element name="pool"> <choice> - <ref name='pooldir'/> - <ref name='poolfs'/> - <ref name='poolnetfs'/> - <ref name='poollogical'/> - <ref name='pooldisk'/> - <ref name='pooliscsi'/> - <ref name='pooliscsidirect'/> - <ref name='poolscsi'/> - <ref name='poolmpath'/> - <ref name='poolrbd'/> - <ref name='poolsheepdog'/> - <ref name='poolgluster'/> - <ref name='poolzfs'/> - <ref name='poolvstorage'/> + <ref name="pooldir"/> + <ref name="poolfs"/> + <ref name="poolnetfs"/> + <ref name="poollogical"/> + <ref name="pooldisk"/> + <ref name="pooliscsi"/> + <ref name="pooliscsidirect"/> + <ref name="poolscsi"/> + <ref name="poolmpath"/> + <ref name="poolrbd"/> + <ref name="poolsheepdog"/> + <ref name="poolgluster"/> + <ref name="poolzfs"/> + <ref name="poolvstorage"/> </choice> </element> </define> - <define name='pooldir'> - <attribute name='type'> + <define name="pooldir"> + <attribute name="type"> <value>dir</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcedir'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcedir"/> + <ref name="target"/> </interleave> </define> - <define name='poolfs'> - <attribute name='type'> + <define name="poolfs"> + <attribute name="type"> <value>fs</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcefs'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcefs"/> + <ref name="target"/> </interleave> <optional> - <ref name='fs_mount_opts'/> + <ref name="fs_mount_opts"/> </optional> </define> - <define name='poolnetfs'> - <attribute name='type'> + <define name="poolnetfs"> + <attribute name="type"> <value>netfs</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcenetfs'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcenetfs"/> + <ref name="target"/> </interleave> <optional> - <ref name='fs_mount_opts'/> + <ref name="fs_mount_opts"/> </optional> </define> - <define name='poollogical'> - <attribute name='type'> + <define name="poollogical"> + <attribute name="type"> <value>logical</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcelogical'/> - <ref name='targetlogical'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcelogical"/> + <ref name="targetlogical"/> </interleave> </define> - <define name='pooldisk'> - <attribute name='type'> + <define name="pooldisk"> + <attribute name="type"> <value>disk</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcedisk'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcedisk"/> + <ref name="target"/> </interleave> </define> - <define name='pooliscsi'> - <attribute name='type'> + <define name="pooliscsi"> + <attribute name="type"> <value>iscsi</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourceiscsi'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourceiscsi"/> + <ref name="target"/> </interleave> </define> - <define name='pooliscsidirect'> - <attribute name='type'> + <define name="pooliscsidirect"> + <attribute name="type"> <value>iscsi-direct</value> </attribute> <interleave> - <ref name='commonmetadata'/> + <ref name="commonmetadata"/> <optional> - <ref name='sizing'/> + <ref name="sizing"/> </optional> - <ref name='features'/> - <ref name='sourceiscsidirect'/> + <ref name="features"/> + <ref name="sourceiscsidirect"/> </interleave> </define> - <define name='poolscsi'> - <attribute name='type'> + <define name="poolscsi"> + <attribute name="type"> <value>scsi</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcescsi'/> - <ref name='target'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcescsi"/> + <ref name="target"/> </interleave> </define> - <define name='poolmpath'> - <attribute name='type'> + <define name="poolmpath"> + <attribute name="type"> <value>mpath</value> </attribute> <interleave> - <ref name='commonmetadata'/> - <ref name='sizing'/> - <ref name='features'/> + <ref name="commonmetadata"/> + <ref name="sizing"/> + <ref name="features"/> <optional> - <ref name='sourcempath'/> + <ref name="sourcempath"/> </optional> - <ref name='target'/> + <ref name="target"/> </interleave> </define> - <define name='poolrbd'> - <attribute name='type'> + <define name="poolrbd"> + <attribute name="type"> <value>rbd</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcerbd'/> - <ref name='refresh'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcerbd"/> + <ref name="refresh"/> </interleave> <optional> - <ref name='rbd_config_opts'/> + <ref name="rbd_config_opts"/> </optional> </define> - <define name='poolsheepdog'> - <attribute name='type'> + <define name="poolsheepdog"> + <attribute name="type"> <value>sheepdog</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcesheepdog'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcesheepdog"/> </interleave> </define> - <define name='poolgluster'> - <attribute name='type'> + <define name="poolgluster"> + <attribute name="type"> <value>gluster</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcegluster'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcegluster"/> </interleave> </define> - <define name='poolzfs'> - <attribute name='type'> + <define name="poolzfs"> + <attribute name="type"> <value>zfs</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcezfs'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcezfs"/> <optional> - <ref name='target'/> + <ref name="target"/> </optional> </interleave> </define> - <define name='poolvstorage'> - <attribute name='type'> + <define name="poolvstorage"> + <attribute name="type"> <value>vstorage</value> </attribute> <interleave> - <ref name='commonMetadataNameOptional'/> - <ref name='sizing'/> - <ref name='features'/> - <ref name='sourcevstorage'/> - <ref name='target'/> + <ref name="commonMetadataNameOptional"/> + <ref name="sizing"/> + <ref name="features"/> + <ref name="sourcevstorage"/> + <ref name="target"/> </interleave> </define> - <define name='sourceinfovendor'> + <define name="sourceinfovendor"> <interleave> <optional> - <element name='vendor'> - <attribute name='name'> + <element name="vendor"> + <attribute name="name"> <text/> </attribute> </element> </optional> <optional> - <element name='product'> - <attribute name='name'> + <element name="product"> + <attribute name="name"> <text/> </attribute> </element> @@ -243,62 +243,62 @@ </interleave> </define> - <define name='commonMetadataNameOptional'> + <define name="commonMetadataNameOptional"> <interleave> <optional> - <element name='name'> - <ref name='poolName'/> + <element name="name"> + <ref name="poolName"/> </element> </optional> <optional> - <element name='uuid'> - <ref name='UUID'/> + <element name="uuid"> + <ref name="UUID"/> </element> </optional> </interleave> </define> - <define name='commonmetadata'> + <define name="commonmetadata"> <interleave> - <element name='name'> - <ref name='poolName'/> + <element name="name"> + <ref name="poolName"/> </element> <optional> - <element name='uuid'> - <ref name='UUID'/> + <element name="uuid"> + <ref name="UUID"/> </element> </optional> </interleave> </define> - <define name='sizing'> + <define name="sizing"> <interleave> <optional> - <element name='capacity'> - <ref name='scaledInteger'/> + <element name="capacity"> + <ref name="scaledInteger"/> </element> </optional> <optional> - <element name='allocation'> - <ref name='scaledInteger'/> + <element name="allocation"> + <ref name="scaledInteger"/> </element> </optional> <optional> - <element name='available'> - <ref name='scaledInteger'/> + <element name="available"> + <ref name="scaledInteger"/> </element> </optional> </interleave> </define> - <define name='features'> + <define name="features"> <optional> - <element name='features'> + <element name="features"> <interleave> <optional> - <element name='cow'> + <element name="cow"> <attribute name="state"> - <ref name='virYesNo'/> + <ref name="virYesNo"/> </attribute> </element> </optional> @@ -307,41 +307,41 @@ </optional> </define> - <define name='target'> - <element name='target'> + <define name="target"> + <element name="target"> <interleave> - <element name='path'> - <ref name='absFilePath'/> + <element name="path"> + <ref name="absFilePath"/> </element> - <ref name='permissions'/> + <ref name="permissions"/> </interleave> </element> </define> - <define name='targetlogical'> - <element name='target'> + <define name="targetlogical"> + <element name="target"> <interleave> <optional> - <element name='path'> - <ref name='absFilePath'/> + <element name="path"> + <ref name="absFilePath"/> </element> </optional> - <ref name='permissions'/> + <ref name="permissions"/> </interleave> </element> </define> - <define name='sourceinfohost'> + <define name="sourceinfohost"> <oneOrMore> - <element name='host'> - <attribute name='name'> + <element name="host"> + <attribute name="name"> <choice> <ref name="dnsName"/> <ref name="ipAddr"/> </choice> </attribute> <optional> - <attribute name='port'> + <attribute name="port"> <ref name="PortNumber"/> </attribute> </optional> @@ -350,18 +350,18 @@ </oneOrMore> </define> - <define name='sourceinfodev'> - <element name='device'> - <attribute name='path'> + <define name="sourceinfodev"> + <element name="device"> + <attribute name="path"> <choice> - <ref name='absFilePath'/> - <ref name='genericName'/> - <ref name='IscsiQualifiedName'/> + <ref name="absFilePath"/> + <ref name="genericName"/> + <ref name="IscsiQualifiedName"/> </choice> </attribute> <choice> <empty/> - <ref name='devextents'/> + <ref name="devextents"/> </choice> <optional> <attribute name="part_separator"> @@ -371,102 +371,102 @@ </element> </define> - <define name='sourceinfodeviscsidirect'> - <element name='device'> - <attribute name='path'> - <ref name='IscsiQualifiedName'/> + <define name="sourceinfodeviscsidirect"> + <element name="device"> + <attribute name="path"> + <ref name="IscsiQualifiedName"/> </attribute> </element> </define> - <define name='devextents'> + <define name="devextents"> <oneOrMore> - <element name='freeExtent'> - <attribute name='start'> - <ref name='unsignedLong'/> + <element name="freeExtent"> + <attribute name="start"> + <ref name="unsignedLong"/> </attribute> - <attribute name='end'> - <ref name='unsignedLong'/> + <attribute name="end"> + <ref name="unsignedLong"/> </attribute> </element> </oneOrMore> </define> - <define name='sourceinfodir'> - <element name='dir'> - <attribute name='path'> - <ref name='absDirPath'/> + <define name="sourceinfodir"> + <element name="dir"> + <attribute name="path"> + <ref name="absDirPath"/> </attribute> <empty/> </element> </define> - <define name='sourceinfonetrelativepath'> - <element name='dir'> - <attribute name='path'> - <ref name='dirPath'/> + <define name="sourceinfonetrelativepath"> + <element name="dir"> + <attribute name="path"> + <ref name="dirPath"/> </attribute> <empty/> </element> </define> - <define name='sourceinfoname'> - <element name='name'> + <define name="sourceinfoname"> + <element name="name"> <text/> </element> </define> - <define name='sourceinfoauth'> - <element name='auth'> - <attribute name='type'> + <define name="sourceinfoauth"> + <element name="auth"> + <attribute name="type"> <choice> <value>chap</value> <value>ceph</value> </choice> </attribute> - <attribute name='username'> + <attribute name="username"> <text/> </attribute> - <ref name='sourceinfoauthsecret'/> + <ref name="sourceinfoauthsecret"/> </element> </define> - <define name='sourceinfoauthsecret'> - <element name='secret'> + <define name="sourceinfoauthsecret"> + <element name="secret"> <choice> - <attribute name='uuid'> + <attribute name="uuid"> <text/> </attribute> - <attribute name='usage'> + <attribute name="usage"> <text/> </attribute> </choice> </element> </define> - <define name='sourcezfs'> - <element name='source'> + <define name="sourcezfs"> + <element name="source"> <interleave> - <ref name='sourceinfoname'/> + <ref name="sourceinfoname"/> <optional> - <ref name='sourceinfodev'/> + <ref name="sourceinfodev"/> </optional> </interleave> </element> </define> - <define name='sourcevstorage'> - <element name='source'> + <define name="sourcevstorage"> + <element name="source"> <interleave> - <ref name='sourceinfoname'/> + <ref name="sourceinfoname"/> </interleave> </element> </define> - <define name='sourcefmtfs'> + <define name="sourcefmtfs"> <optional> - <element name='format'> - <attribute name='type'> + <element name="format"> + <attribute name="type"> <choice> <value>auto</value> <value>ext2</value> @@ -489,10 +489,10 @@ </define> - <define name='sourcefmtnetfs'> + <define name="sourcefmtnetfs"> <optional> - <element name='format'> - <attribute name='type'> + <element name="format"> + <attribute name="type"> <choice> <value>auto</value> <value>nfs</value> @@ -503,10 +503,10 @@ </define> - <define name='sourcefmtdisk'> + <define name="sourcefmtdisk"> <optional> - <element name='format'> - <attribute name='type'> + <element name="format"> + <attribute name="type"> <choice> <value>unknown</value> <value>dos</value> @@ -520,79 +520,79 @@ </choice> </attribute> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </element> </optional> </define> - <define name='sourcefmtlogical'> + <define name="sourcefmtlogical"> <optional> - <element name='format'> - <attribute name='type'> + <element name="format"> + <attribute name="type"> <choice> - <value>unknown</value> <!-- back-compat requires keeping 'unknown' not 'auto' --> + <value>unknown</value> <!-- back-compat requires keeping "unknown" not "auto" --> <value>lvm2</value> </choice> </attribute> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </element> </optional> </define> - <define name='sourcedir'> + <define name="sourcedir"> <optional> - <element name='source'> + <element name="source"> <empty/> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </element> </optional> </define> - <define name='sourcefs'> - <element name='source'> + <define name="sourcefs"> + <element name="source"> <interleave> - <ref name='sourceinfodev'/> - <ref name='sourcefmtfs'/> + <ref name="sourceinfodev"/> + <ref name="sourcefmtfs"/> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </element> </define> - <define name='sourcenetfs'> - <element name='source'> + <define name="sourcenetfs"> + <element name="source"> <choice> <group> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfodir'/> - <ref name='sourcefmtnetfs'/> + <ref name="sourceinfohost"/> + <ref name="sourceinfodir"/> + <ref name="sourcefmtnetfs"/> <optional> - <element name='protocol'> - <attribute name='ver'> - <ref name='unsignedInt'/> + <element name="protocol"> + <attribute name="ver"> + <ref name="unsignedInt"/> </attribute> </element> </optional> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </group> <group> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfonetrelativepath'/> - <element name='format'> - <attribute name='type'> + <ref name="sourceinfohost"/> + <ref name="sourceinfonetrelativepath"/> + <element name="format"> + <attribute name="type"> <choice> <value>cifs</value> <value>glusterfs</value> @@ -600,7 +600,7 @@ </attribute> </element> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </group> @@ -608,139 +608,139 @@ </element> </define> - <define name='sourcelogical'> - <element name='source'> + <define name="sourcelogical"> + <element name="source"> <interleave> <oneOrMore> <optional> - <ref name='sourceinfoname'/> + <ref name="sourceinfoname"/> </optional> <optional> - <ref name='sourceinfodev'/> + <ref name="sourceinfodev"/> </optional> </oneOrMore> - <ref name='sourcefmtlogical'/> + <ref name="sourcefmtlogical"/> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </element> </define> - <define name='sourcedisk'> - <element name='source'> + <define name="sourcedisk"> + <element name="source"> <interleave> - <ref name='sourceinfodev'/> - <ref name='sourcefmtdisk'/> + <ref name="sourceinfodev"/> + <ref name="sourcefmtdisk"/> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </element> </define> - <define name='sourceiscsi'> - <element name='source'> + <define name="sourceiscsi"> + <element name="source"> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfodev'/> + <ref name="sourceinfohost"/> + <ref name="sourceinfodev"/> <optional> - <ref name='initiatorinfo'/> + <ref name="initiatorinfo"/> </optional> <optional> - <ref name='sourceinfoauth'/> + <ref name="sourceinfoauth"/> </optional> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </element> </define> - <define name='sourceiscsidirect'> - <element name='source'> + <define name="sourceiscsidirect"> + <element name="source"> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfodeviscsidirect'/> - <ref name='initiatorinfo'/> + <ref name="sourceinfohost"/> + <ref name="sourceinfodeviscsidirect"/> + <ref name="initiatorinfo"/> <optional> - <ref name='sourceinfoauth'/> + <ref name="sourceinfoauth"/> </optional> </interleave> </element> </define> - <define name='sourcescsi'> - <element name='source'> + <define name="sourcescsi"> + <element name="source"> <interleave> - <ref name='sourceinfoadapter'/> + <ref name="sourceinfoadapter"/> <optional> - <ref name='sourceinfovendor'/> + <ref name="sourceinfovendor"/> </optional> </interleave> </element> </define> - <define name='sourcempath'> - <element name='source'> + <define name="sourcempath"> + <element name="source"> <empty/> </element> </define> - <define name='sourcerbd'> - <element name='source'> + <define name="sourcerbd"> + <element name="source"> <interleave> - <ref name='sourceinfoname'/> - <ref name='sourceinfohost'/> + <ref name="sourceinfoname"/> + <ref name="sourceinfohost"/> <optional> - <ref name='sourceinfoauth'/> + <ref name="sourceinfoauth"/> </optional> </interleave> </element> </define> - <define name='sourcesheepdog'> - <element name='source'> + <define name="sourcesheepdog"> + <element name="source"> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfoname'/> + <ref name="sourceinfohost"/> + <ref name="sourceinfoname"/> </interleave> </element> </define> - <define name='sourcegluster'> - <element name='source'> + <define name="sourcegluster"> + <element name="source"> <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfoname'/> + <ref name="sourceinfohost"/> + <ref name="sourceinfoname"/> <optional> - <ref name='sourceinfodir'/> + <ref name="sourceinfodir"/> </optional> </interleave> </element> </define> - <define name='IscsiQualifiedName'> - <data type='string'> + <define name="IscsiQualifiedName"> + <data type="string"> <param name="pattern">iqn\.[0-9]{4}-(0[1-9]|1[0-2])\.[a-zA-Z0-9\.\-]+(:.+)?</param> </data> </define> - <define name='refresh'> + <define name="refresh"> <optional> - <element name='refresh'> + <element name="refresh"> <interleave> - <ref name='refreshVolume'/> + <ref name="refreshVolume"/> </interleave> </element> </optional> </define> - <define name='refreshVolume'> + <define name="refreshVolume"> <optional> - <element name='volume'> + <element name="volume"> <optional> - <attribute name='allocation'> + <attribute name="allocation"> <ref name="refreshVolumeAllocation"/> </attribute> </optional> @@ -757,7 +757,7 @@ <element name="mount_opts" ns="http://libvirt.org/schemas/storagepool/fs/1.0"> <zeroOrMore> <element name="option"> - <attribute name='name'> + <attribute name="name"> <text/> </attribute> </element> @@ -774,10 +774,10 @@ <element name="config_opts" ns="http://libvirt.org/schemas/storagepool/rbd/1.0"> <zeroOrMore> <element name="option"> - <attribute name='name'> + <attribute name="name"> <text/> </attribute> - <attribute name='value'> + <attribute name="value"> <text/> </attribute> </element> diff --git a/docs/schemas/storagepoolcaps.rng b/docs/schemas/storagepoolcaps.rng index e3bf1efcde..ec65fba7dc 100644 --- a/docs/schemas/storagepoolcaps.rng +++ b/docs/schemas/storagepoolcaps.rng @@ -1,85 +1,85 @@ <?xml version="1.0"?> <!-- A Relax NG schema for the libvirt storage pool capabilities XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> <start> - <ref name='storagepoolCapabilities'/> + <ref name="storagepoolCapabilities"/> </start> - <define name='storagepoolCapabilities'> - <element name='storagepoolCapabilities'> + <define name="storagepoolCapabilities"> + <element name="storagepoolCapabilities"> <zeroOrMore> - <ref name='poolCapsType'/> + <ref name="poolCapsType"/> </zeroOrMore> </element> </define> - <define name='poolCapsType'> - <element name='pool'> - <ref name='poolCapsTypes'/> - <ref name='poolCapsSupported'/> + <define name="poolCapsType"> + <element name="pool"> + <ref name="poolCapsTypes"/> + <ref name="poolCapsSupported"/> <optional> - <ref name='poolCapsPoolOptions'/> + <ref name="poolCapsPoolOptions"/> </optional> <optional> - <ref name='poolCapsVolOptions'/> + <ref name="poolCapsVolOptions"/> </optional> </element> </define> - <define name='poolCapsTypes'> - <attribute name='type'> + <define name="poolCapsTypes"> + <attribute name="type"> <text/> </attribute> </define> - <define name='poolCapsSupported'> - <attribute name='supported'> + <define name="poolCapsSupported"> + <attribute name="supported"> <ref name="virYesNo"/> </attribute> </define> - <define name='poolCapsPoolOptions'> - <element name='poolOptions'> + <define name="poolCapsPoolOptions"> + <element name="poolOptions"> <optional> - <ref name='poolDefaultFormat'/> + <ref name="poolDefaultFormat"/> </optional> <optional> - <ref name='poolCapsEnum'/> + <ref name="poolCapsEnum"/> </optional> </element> </define> - <define name='poolCapsVolOptions'> - <element name='volOptions'> - <ref name='poolDefaultFormat'/> - <ref name='poolCapsEnum'/> + <define name="poolCapsVolOptions"> + <element name="volOptions"> + <ref name="poolDefaultFormat"/> + <ref name="poolCapsEnum"/> </element> </define> - <define name='poolDefaultFormat'> - <element name='defaultFormat'> - <attribute name='type'> + <define name="poolDefaultFormat"> + <element name="defaultFormat"> + <attribute name="type"> <text/> </attribute> </element> </define> - <define name='poolCapsEnum'> + <define name="poolCapsEnum"> <zeroOrMore> - <element name='enum'> - <attribute name='name'> + <element name="enum"> + <attribute name="name"> <text/> </attribute> - <ref name='value'/> + <ref name="value"/> </element> </zeroOrMore> </define> - <define name='value'> + <define name="value"> <zeroOrMore> - <element name='value'> + <element name="value"> <text/> </element> </zeroOrMore> diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng index 382cd121ad..22ce5eaa8d 100644 --- a/docs/schemas/storagevol.rng +++ b/docs/schemas/storagevol.rng @@ -2,18 +2,18 @@ <!-- A Relax NG schema for the libvirt storage volume XML format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <include href='basictypes.rng'/> + <include href="basictypes.rng"/> <start> - <ref name='vol'/> + <ref name="vol"/> </start> - <include href='storagecommon.rng'/> + <include href="storagecommon.rng"/> - <define name='vol'> - <element name='volume'> + <define name="vol"> + <element name="volume"> <optional> - <attribute name='type'> + <attribute name="type"> <choice> <value>file</value> <value>block</value> @@ -24,68 +24,68 @@ </attribute> </optional> <interleave> - <element name='name'> - <ref name='volName'/> + <element name="name"> + <ref name="volName"/> </element> <optional> - <element name='key'> + <element name="key"> <text/> </element> </optional> <optional> - <ref name='source'/> + <ref name="source"/> </optional> - <ref name='sizing'/> - <ref name='target'/> + <ref name="sizing"/> + <ref name="target"/> <optional> - <ref name='backingStore'/> + <ref name="backingStore"/> </optional> </interleave> </element> </define> - <define name='sizing'> + <define name="sizing"> <interleave> <optional> - <element name='capacity'> - <ref name='scaledInteger'/> + <element name="capacity"> + <ref name="scaledInteger"/> </element> </optional> <optional> - <element name='allocation'> - <ref name='scaledInteger'/> + <element name="allocation"> + <ref name="scaledInteger"/> </element> </optional> <optional> - <element name='physical'> - <ref name='scaledInteger'/> + <element name="physical"> + <ref name="scaledInteger"/> </element> </optional> </interleave> </define> - <define name='timestamps'> + <define name="timestamps"> <optional> - <element name='timestamps'> + <element name="timestamps"> <interleave> <optional> - <element name='atime'> - <ref name='timestamp'/> + <element name="atime"> + <ref name="timestamp"/> </element> </optional> <optional> - <element name='btime'> - <ref name='timestamp'/> + <element name="btime"> + <ref name="timestamp"/> </element> </optional> <optional> - <element name='ctime'> - <ref name='timestamp'/> + <element name="ctime"> + <ref name="timestamp"/> </element> </optional> <optional> - <element name='mtime'> - <ref name='timestamp'/> + <element name="mtime"> + <ref name="timestamp"/> </element> </optional> </interleave> @@ -93,92 +93,92 @@ </optional> </define> - <define name='timestamp'> - <data type='string'> + <define name="timestamp"> + <data type="string"> <param name="pattern">[0-9]+(\.[0-9]{0,9})?</param> </data> </define> - <define name='target'> - <element name='target'> + <define name="target"> + <element name="target"> <interleave> <optional> - <element name='path'> + <element name="path"> <choice> - <data type='anyURI'/> - <ref name='absFilePath'/> + <data type="anyURI"/> + <ref name="absFilePath"/> </choice> </element> </optional> - <ref name='format'/> - <ref name='permissions'/> - <ref name='timestamps'/> + <ref name="format"/> + <ref name="permissions"/> + <ref name="timestamps"/> <optional> - <ref name='encryption'/> + <ref name="encryption"/> </optional> <optional> - <ref name='compat'/> + <ref name="compat"/> </optional> <optional> - <element name='nocow'> + <element name="nocow"> <empty/> </element> </optional> <optional> - <ref name='fileFormatFeatures'/> + <ref name="fileFormatFeatures"/> </optional> </interleave> </element> </define> - <define name='backingStore'> - <element name='backingStore'> + <define name="backingStore"> + <element name="backingStore"> <interleave> - <element name='path'> - <ref name='absFilePath'/> + <element name="path"> + <ref name="absFilePath"/> </element> - <ref name='format'/> - <ref name='permissions'/> - <ref name='timestamps'/> + <ref name="format"/> + <ref name="permissions"/> + <ref name="timestamps"/> </interleave> </element> </define> - <define name='source'> - <element name='source'> + <define name="source"> + <element name="source"> <zeroOrMore> - <ref name='sourcedev'/> + <ref name="sourcedev"/> </zeroOrMore> </element> </define> - <define name='sourcedev'> - <element name='device'> - <attribute name='path'> - <ref name='absFilePath'/> + <define name="sourcedev"> + <element name="device"> + <attribute name="path"> + <ref name="absFilePath"/> </attribute> <choice> <empty/> - <ref name='devextents'/> + <ref name="devextents"/> </choice> </element> </define> - <define name='devextents'> + <define name="devextents"> <oneOrMore> - <element name='extent'> - <attribute name='start'> - <ref name='unsignedLong'/> + <element name="extent"> + <attribute name="start"> + <ref name="unsignedLong"/> </attribute> - <attribute name='end'> - <ref name='unsignedLong'/> + <attribute name="end"> + <ref name="unsignedLong"/> </attribute> </element> </oneOrMore> </define> - <define name='formatdev'> + <define name="formatdev"> <choice> <value>none</value> <value>auto</value> @@ -198,14 +198,14 @@ </choice> </define> - <define name='formatfile'> + <define name="formatfile"> <choice> <value>unknown</value> - <ref name='storageFormat'/> + <ref name="storageFormat"/> </choice> </define> - <define name='formatdisk'> + <define name="formatdisk"> <choice> <value>none</value> <value>linux</value> @@ -218,14 +218,14 @@ </choice> </define> - <define name='format'> + <define name="format"> <optional> - <element name='format'> - <attribute name='type'> + <element name="format"> + <attribute name="type"> <choice> - <ref name='formatfile'/> - <ref name='formatdev'/> - <ref name='formatdisk'/> + <ref name="formatfile"/> + <ref name="formatdev"/> + <ref name="formatdisk"/> </choice> </attribute> </element> -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:24 +0200, Tim Wiederhake wrote:
Quotation marks were used ~ 7000 times, apostrophes ~ 3000 times.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
Note that libvirt's output XMLs exclusively use apostrophes so people will still be inclined to use them. Reviewed-by: Peter Krempa <pkrempa@redhat.com>

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/capability.rng | 82 +------------------------------------ docs/schemas/cputypes.rng | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 80 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 68bdb29695..91a046eb48 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -3,6 +3,7 @@ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <include href="basictypes.rng"/> + <include href="cputypes.rng"/> <start> <ref name="capabilities"/> </start> @@ -25,17 +26,7 @@ <ref name="UUID"/> </element> </optional> - <element name="cpu"> - <element name="arch"> - <ref name="archnames"/> - </element> - <optional> - <ref name="cpufeatures"/> - </optional> - <optional> - <ref name="cpuspec"/> - </optional> - </element> + <ref name="hostcpu"/> <optional> <ref name="power_management"/> </optional> @@ -81,64 +72,6 @@ </element> </define> - - <define name="cpufeatures"> - <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> - </define> - - <define name="cpuspec"> - <element name="model"> - <text/> - </element> - <optional> - <element name="vendor"> - <text/> - </element> - </optional> - <optional> - <element name="microcode"> - <attribute name="version"> - <ref name="positiveInteger"/> - </attribute> - </element> - </optional> - <element name="topology"> - <attribute name="sockets"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="cores"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="threads"> - <ref name="positiveInteger"/> - </attribute> - </element> - <zeroOrMore> - <element name="feature"> - <attribute name="name"> - <ref name="featureName"/> - </attribute> - <empty/> - </element> - </zeroOrMore> - <zeroOrMore> - <ref name="pagesHost"/> - </zeroOrMore> - </define> - <define name="power_management"> <element name="power_management"> <interleave> @@ -567,17 +500,6 @@ </attribute> </define> - <define name="featureName"> - <data type="string"> - <param name="pattern">[a-zA-Z0-9\-_]+</param> - </data> - </define> - - <define name="pagesHost"> - <element name="pages"> - <ref name="pagesElem"/> - </element> - </define> <define name="pagesNuma"> <element name="pages"> <ref name="pagesElem"/> diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng index e6e82b5fd2..a2d4dbe9d1 100644 --- a/docs/schemas/cputypes.rng +++ b/docs/schemas/cputypes.rng @@ -299,4 +299,78 @@ </element> </define> + <define name="hostcpu"> + <element name="cpu"> + <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> + <element name="vendor"> + <text/> + </element> + </optional> + <optional> + <element name="microcode"> + <attribute name="version"> + <ref name="positiveInteger"/> + </attribute> + </element> + </optional> + <element name="topology"> + <attribute name="sockets"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="cores"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="threads"> + <ref name="positiveInteger"/> + </attribute> + </element> + <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> + </optional> + </element> + </define> + </grammar> -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:25 +0200, Tim Wiederhake wrote: The commit message doesn't mention that it's not a plain move, but rather the schema from various definitions is condensed into one big definition, which is also moved to a different file.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/capability.rng | 82 +------------------------------------ docs/schemas/cputypes.rng | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 80 deletions(-)
After you provide a commit message: Peter Krempa <pkrempa@redhat.com>

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cputypes.rng | 39 +++++++++++++++++++++++++++++++ docs/schemas/domaincommon.rng | 43 +---------------------------------- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng index a2d4dbe9d1..88f6904343 100644 --- a/docs/schemas/cputypes.rng +++ b/docs/schemas/cputypes.rng @@ -373,4 +373,43 @@ </element> </define> + <define name="guestcpu"> + <element name="cpu"> + <optional> + <ref name="cpuMode"/> + </optional> + <optional> + <ref name="cpuMatch"/> + </optional> + <optional> + <ref name="cpuCheck"/> + </optional> + <optional> + <attribute name="migratable"> + <ref name="virOnOff"/> + </attribute> + </optional> + <interleave> + <optional> + <ref name="cpuModel"/> + </optional> + <optional> + <ref name="cpuVendor"/> + </optional> + <optional> + <ref name="cpuTopology"/> + </optional> + <zeroOrMore> + <ref name="cpuFeature"/> + </zeroOrMore> + <optional> + <ref name="cpuNuma"/> + </optional> + <optional> + <ref name="cpuCache"/> + </optional> + </interleave> + </element> + </define> + </grammar> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index dedaf17b85..0c7a3a1385 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -44,7 +44,7 @@ <ref name="metadata"/> </optional> <optional> - <ref name="cpu"/> + <ref name="guestcpu"/> </optional> <zeroOrMore> <ref name="sysinfo"/> @@ -5530,47 +5530,6 @@ </element> </optional> </define> - <!-- - CPU specification - --> - <define name="cpu"> - <element name="cpu"> - <optional> - <ref name="cpuMode"/> - </optional> - <optional> - <ref name="cpuMatch"/> - </optional> - <optional> - <ref name="cpuCheck"/> - </optional> - <optional> - <attribute name="migratable"> - <ref name="virOnOff"/> - </attribute> - </optional> - <interleave> - <optional> - <ref name="cpuModel"/> - </optional> - <optional> - <ref name="cpuVendor"/> - </optional> - <optional> - <ref name="cpuTopology"/> - </optional> - <zeroOrMore> - <ref name="cpuFeature"/> - </zeroOrMore> - <optional> - <ref name="cpuNuma"/> - </optional> - <optional> - <ref name="cpuCache"/> - </optional> - </interleave> - </element> - </define> <!-- System information specification: -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:26 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cputypes.rng | 39 +++++++++++++++++++++++++++++++ docs/schemas/domaincommon.rng | 43 +---------------------------------- 2 files changed, 40 insertions(+), 42 deletions(-)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cpu.rng | 12 ++++++++++++ docs/schemas/meson.build | 1 + 2 files changed, 13 insertions(+) create mode 100644 docs/schemas/cpu.rng diff --git a/docs/schemas/cpu.rng b/docs/schemas/cpu.rng new file mode 100644 index 0000000000..d1eb67430d --- /dev/null +++ b/docs/schemas/cpu.rng @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <include href="basictypes.rng"/> + <include href="cputypes.rng"/> + + <start> + <choice> + <ref name="guestcpu"/> + <ref name="hostcpu"/> + </choice> + </start> +</grammar> diff --git a/docs/schemas/meson.build b/docs/schemas/meson.build index 7fc7ff0503..bb6a48787f 100644 --- a/docs/schemas/meson.build +++ b/docs/schemas/meson.build @@ -1,6 +1,7 @@ docs_schema_files = [ 'basictypes.rng', 'capability.rng', + 'cpu.rng', 'cputypes.rng', 'domainbackup.rng', 'domaincaps.rng', -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:27 +0200, Tim Wiederhake wrote: This doesn't mention what it will be used for ...
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cpu.rng | 12 ++++++++++++ docs/schemas/meson.build | 1 + 2 files changed, 13 insertions(+) create mode 100644 docs/schemas/cpu.rng
diff --git a/docs/schemas/cpu.rng b/docs/schemas/cpu.rng new file mode 100644 index 0000000000..d1eb67430d --- /dev/null +++ b/docs/schemas/cpu.rng @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <include href="basictypes.rng"/> + <include href="cputypes.rng"/>
... and it isn't obvious from the impl.
+ + <start> + <choice> + <ref name="guestcpu"/> + <ref name="hostcpu"/> + </choice> + </start> +</grammar>
You can use: Reviewed-by: Peter Krempa <pkrempa@redhat.com> after you properly justify the changes since they are not self-explanatory.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/util/virxml.c | 15 +++++++++++++++ src/util/virxml.h | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/src/util/virxml.c b/src/util/virxml.c index 5315d4ff6f..2ec526456f 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1320,6 +1320,21 @@ virXMLValidateAgainstSchema(const char *schemafile, } +int +virXMLValidateNodeAgainstSchema(const char *schemafile, + xmlDocPtr doc, + xmlNodePtr node) +{ + xmlNodePtr root; + int ret; + + root = xmlDocSetRootElement(doc, node); + ret = virXMLValidateAgainstSchema(schemafile, doc); + xmlDocSetRootElement(doc, root); + return ret; +} + + void virXMLValidatorFree(virXMLValidatorPtr validator) { diff --git a/src/util/virxml.h b/src/util/virxml.h index 0301f15308..fd0d30fcec 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -212,6 +212,12 @@ virXMLValidatorValidate(virXMLValidatorPtr validator, int virXMLValidateAgainstSchema(const char *schemafile, xmlDocPtr xml); + +int +virXMLValidateNodeAgainstSchema(const char *schemafile, + xmlDocPtr doc, + xmlNodePtr node); + void virXMLValidatorFree(virXMLValidatorPtr validator); -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:28 +0200, Tim Wiederhake wrote: No commit message ...
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/util/virxml.c | 15 +++++++++++++++ src/util/virxml.h | 6 ++++++ 2 files changed, 21 insertions(+)
diff --git a/src/util/virxml.c b/src/util/virxml.c index 5315d4ff6f..2ec526456f 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1320,6 +1320,21 @@ virXMLValidateAgainstSchema(const char *schemafile, }
... or function documentation explaining what this does.
+int +virXMLValidateNodeAgainstSchema(const char *schemafile, + xmlDocPtr doc, + xmlNodePtr node) +{ + xmlNodePtr root; + int ret; + + root = xmlDocSetRootElement(doc, node); + ret = virXMLValidateAgainstSchema(schemafile, doc); + xmlDocSetRootElement(doc, root); + return ret; +}
Once you add a comment for the function: Reviewed-by: Peter Krempa <pkrempa@redhat.com>

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- src/bhyve/bhyve_driver.c | 2 +- src/conf/cpu_conf.c | 28 ++++++++++++++++++++++++---- src/conf/cpu_conf.h | 6 ++++-- src/conf/domain_conf.c | 3 ++- src/cpu/cpu.c | 5 +++-- src/cpu/cpu.h | 3 ++- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_domain.c | 5 +++-- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_migration_cookie.c | 3 ++- tests/cputest.c | 5 +++-- 11 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index daa20bad40..fc57ccd504 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1465,7 +1465,7 @@ bhyveConnectCompareCPU(virConnectPtr conn, } } else { ret = virCPUCompareXML(caps->host.arch, caps->host.cpu, - xmlDesc, failIncompatible); + xmlDesc, failIncompatible, false); } cleanup: diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dea950ce68..40d8da4a8e 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -20,9 +20,11 @@ #include <config.h> +#include "configmake.h" #include "virerror.h" #include "viralloc.h" #include "virbuffer.h" +#include "virfile.h" #include "cpu_conf.h" #include "domain_conf.h" #include "virstring.h" @@ -281,7 +283,8 @@ virCPUDefCopy(const virCPUDef *cpu) int virCPUDefParseXMLString(const char *xml, virCPUType type, - virCPUDefPtr *cpu) + virCPUDefPtr *cpu, + bool validateXML) { xmlDocPtr doc = NULL; xmlXPathContextPtr ctxt = NULL; @@ -295,7 +298,7 @@ virCPUDefParseXMLString(const char *xml, if (!(doc = virXMLParseStringCtxt(xml, _("(CPU_definition)"), &ctxt))) goto cleanup; - if (virCPUDefParseXML(ctxt, NULL, type, cpu) < 0) + if (virCPUDefParseXML(ctxt, NULL, type, cpu, validateXML) < 0) goto cleanup; ret = 0; @@ -323,7 +326,8 @@ int virCPUDefParseXML(xmlXPathContextPtr ctxt, const char *xpath, virCPUType type, - virCPUDefPtr *cpu) + virCPUDefPtr *cpu, + bool validateXML) { g_autoptr(virCPUDef) def = NULL; g_autofree xmlNodePtr *nodes = NULL; @@ -348,6 +352,22 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, return -1; } + if (validateXML) { + g_autofree char *schemafile = NULL; + + if (!(schemafile = virFileFindResource("cpu.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"))) + return -1; + + if (virXMLValidateNodeAgainstSchema(schemafile, ctxt->doc, + ctxt->node) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'cpu' element is not valid")); + return -1; + } + } + def = virCPUDefNew(); if (type == VIR_CPU_TYPE_AUTO) { @@ -1146,7 +1166,7 @@ virCPUDefListParse(const char **xmlCPUs, if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt))) goto error; - if (virCPUDefParseXML(ctxt, NULL, cpuType, &cpus[i]) < 0) + if (virCPUDefParseXML(ctxt, NULL, cpuType, &cpus[i], false) < 0) goto error; xmlXPathFreeContext(ctxt); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 24c51e3a63..3ef14b7932 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -192,13 +192,15 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu); int virCPUDefParseXMLString(const char *xml, virCPUType type, - virCPUDefPtr *cpu); + virCPUDefPtr *cpu, + bool validateXML); int virCPUDefParseXML(xmlXPathContextPtr ctxt, const char *xpath, virCPUType mode, - virCPUDefPtr *cpu); + virCPUDefPtr *cpu, + bool validateXML); bool virCPUDefIsEqual(virCPUDefPtr src, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4d296f7bcb..2ae5329938 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21583,7 +21583,8 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); - if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu) < 0) + if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu, + false) < 0) goto error; if (virDomainNumaDefParseXML(def->numa, ctxt) < 0) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 188c5d86b5..bf94811960 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -109,14 +109,15 @@ virCPUCompareResult virCPUCompareXML(virArch arch, virCPUDefPtr host, const char *xml, - bool failIncompatible) + bool failIncompatible, + bool validateXML) { g_autoptr(virCPUDef) cpu = NULL; VIR_DEBUG("arch=%s, host=%p, xml=%s", virArchToString(arch), host, NULLSTR(xml)); - if (virCPUDefParseXMLString(xml, VIR_CPU_TYPE_AUTO, &cpu) < 0) + if (virCPUDefParseXMLString(xml, VIR_CPU_TYPE_AUTO, &cpu, validateXML) < 0) return VIR_CPU_COMPARE_ERROR; return virCPUCompare(arch, host, cpu, failIncompatible); diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index ba8fdd07ba..cc2d132275 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -153,7 +153,8 @@ virCPUCompareResult virCPUCompareXML(virArch arch, virCPUDefPtr host, const char *xml, - bool failIncompatible); + bool failIncompatible, + bool validateXML); virCPUCompareResult virCPUCompare(virArch arch, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 161a6882f3..72864c2dc9 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6541,7 +6541,7 @@ libxlConnectCompareCPU(virConnectPtr conn, cfg = libxlDriverConfigGet(driver); ret = virCPUCompareXML(cfg->caps->host.arch, cfg->caps->host.cpu, - xmlDesc, failIncompatible); + xmlDesc, failIncompatible, false); virObjectUnref(cfg); return ret; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ac443c5ddc..887a88936d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3135,7 +3135,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, qemuDomainSetPrivatePathsOld(driver, vm); - if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU) < 0) + if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU, + false) < 0) goto error; priv->chardevStdioLogd = virXPathBoolean("boolean(./chardevStdioLogd)", @@ -10003,7 +10004,7 @@ qemuDomainSaveCookieParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, return -1; if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, - &cookie->cpu) < 0) + &cookie->cpu, false) < 0) return -1; cookie->slirpHelper = virXPathBoolean("boolean(./slirpHelper)", ctxt) > 0; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ae715c01d7..a7961ad3f0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12240,7 +12240,7 @@ qemuConnectCompareCPU(virConnectPtr conn, return VIR_CPU_COMPARE_ERROR; return virCPUCompareXML(driver->hostarch, cpu, - xmlDesc, failIncompatible); + xmlDesc, failIncompatible, false); } @@ -12330,10 +12330,10 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, } if (ARCH_IS_X86(arch)) { - ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible); + ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, false); } else if (ARCH_IS_S390(arch) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON)) { - if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu) < 0) + if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu, false) < 0) goto cleanup; ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 3ea46e1527..aef0b042e5 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1342,7 +1342,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, goto error; if (flags & QEMU_MIGRATION_COOKIE_CPU && - virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &mig->cpu) < 0) + virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &mig->cpu, + false) < 0) goto error; if (flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT && diff --git a/tests/cputest.c b/tests/cputest.c index 83d63bf495..b40fd7f7f2 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -81,7 +81,7 @@ cpuTestLoadXML(virArch arch, const char *name) if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) goto cleanup; - virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu); + virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, false); cleanup: xmlXPathFreeContext(ctxt); @@ -118,7 +118,8 @@ cpuTestLoadMultiXML(virArch arch, for (i = 0; i < n; i++) { ctxt->node = nodes[i]; - if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_HOST, &cpus[i]) < 0) + if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_HOST, &cpus[i], + false) < 0) goto cleanup_cpus; } -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:29 +0200, Tim Wiederhake wrote: The summary of the commit is misleading. This patch doesn't do any validation but rather wires in the validation code to various places without enabling it.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dea950ce68..40d8da4a8e 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -20,9 +20,11 @@
#include <config.h>
+#include "configmake.h"
This is suspicious. Why did you add this line?
#include "virerror.h" #include "viralloc.h" #include "virbuffer.h" +#include "virfile.h" #include "cpu_conf.h" #include "domain_conf.h" #include "virstring.h"
[...]
@@ -348,6 +352,22 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, return -1; }
+ if (validateXML) { + g_autofree char *schemafile = NULL; + + if (!(schemafile = virFileFindResource("cpu.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"))) + return -1; + + if (virXMLValidateNodeAgainstSchema(schemafile, ctxt->doc, + ctxt->node) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'cpu' element is not valid"));
virXMLValidateNodeAgainstSchema calls virXMLValidateAgainstSchema which calls virXMLValidatorValidate which already reports an error.
+ return -1; + } + } + def = virCPUDefNew();
if (type == VIR_CPU_TYPE_AUTO) {

On Tue, 2020-09-29 at 11:12 +0200, Peter Krempa wrote:
(...)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dea950ce68..40d8da4a8e 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -20,9 +20,11 @@
#include <config.h>
+#include "configmake.h"
This is suspicious. Why did you add this line?
PKGDATADIR is defined there and used in the call to virFileFindResource in virCPUDefParseXML to locate the schema. Tim

On Wed, Sep 30, 2020 at 13:54:41 +0200, Tim Wiederhake wrote:
On Tue, 2020-09-29 at 11:12 +0200, Peter Krempa wrote:
(...)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dea950ce68..40d8da4a8e 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -20,9 +20,11 @@
#include <config.h>
+#include "configmake.h"
This is suspicious. Why did you add this line?
PKGDATADIR is defined there and used in the call to virFileFindResource in virCPUDefParseXML to locate the schema.
Ah, right, please do mention that in the commit message as it seems to be an unrelated change.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c | 7 +++++-- src/libxl/libxl_driver.c | 7 +++++-- src/qemu/qemu_driver.c | 18 +++++++++++++----- tools/virsh-host.c | 14 ++++++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 6972834175..9e7840b9c2 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -754,6 +754,7 @@ typedef enum { typedef enum { VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = (1 << 0), /* treat incompatible CPUs as failure */ + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML = (1 << 1), /* validate xml files */ } virConnectCompareCPUFlags; int virConnectCompareCPU(virConnectPtr conn, diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index fc57ccd504..7dce3f8648 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1442,14 +1442,17 @@ bhyveConnectCompareCPU(virConnectPtr conn, int ret = VIR_CPU_COMPARE_ERROR; virCapsPtr caps = NULL; bool failIncompatible; + bool validateXML; - virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR); if (virConnectCompareCPUEnsureACL(conn) < 0) goto cleanup; failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); if (!(caps = bhyveDriverGetCapabilities(driver))) goto cleanup; @@ -1465,7 +1468,7 @@ bhyveConnectCompareCPU(virConnectPtr conn, } } else { ret = virCPUCompareXML(caps->host.arch, caps->host.cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML); } cleanup: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 72864c2dc9..6d1f2edd54 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6529,19 +6529,22 @@ libxlConnectCompareCPU(virConnectPtr conn, libxlDriverConfigPtr cfg; int ret = VIR_CPU_COMPARE_ERROR; bool failIncompatible; + bool validateXML; - virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR); if (virConnectCompareCPUEnsureACL(conn) < 0) return ret; failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); cfg = libxlDriverConfigGet(driver); ret = virCPUCompareXML(cfg->caps->host.arch, cfg->caps->host.cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML); virObjectUnref(cfg); return ret; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7961ad3f0..a0c0a4c777 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12227,20 +12227,23 @@ qemuConnectCompareCPU(virConnectPtr conn, virQEMUDriverPtr driver = conn->privateData; g_autoptr(virCPUDef) cpu = NULL; bool failIncompatible; + bool validateXML; - virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR); if (virConnectCompareCPUEnsureACL(conn) < 0) return VIR_CPU_COMPARE_ERROR; failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); if (!(cpu = virQEMUDriverGetHostCPU(driver))) return VIR_CPU_COMPARE_ERROR; return virCPUCompareXML(driver->hostarch, cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML); } @@ -12295,18 +12298,21 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUCaps) qemuCaps = NULL; bool failIncompatible; + bool validateXML; virCPUDefPtr hvCPU; virCPUDefPtr cpu = NULL; virArch arch; virDomainVirtType virttype; - virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR); if (virConnectCompareHypervisorCPUEnsureACL(conn) < 0) goto cleanup; failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); qemuCaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache, emulator, @@ -12330,10 +12336,12 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, } if (ARCH_IS_X86(arch)) { - ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, false); + ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, + validateXML); } else if (ARCH_IS_S390(arch) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON)) { - if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu, false) < 0) + if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu, + validateXML) < 0) goto cleanup; ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 722c47958b..80edfae16c 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1214,6 +1214,10 @@ static const vshCmdOptDef opts_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} }; @@ -1230,6 +1234,9 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE; + if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false; @@ -1636,6 +1643,10 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} }; @@ -1657,6 +1668,9 @@ cmdHypervisorCPUCompare(vshControl *ctl, if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE; + if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0 || vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 || vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 || -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:30 +0200, Tim Wiederhake wrote: Again the summary is misleading and empty commit message doesn't help. This patch also adds a flag to the public API which is an important change rather than just modifying virsh. The summary should mention the public API change rather than the virsh bit.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c | 7 +++++-- src/libxl/libxl_driver.c | 7 +++++-- src/qemu/qemu_driver.c | 18 +++++++++++++----- tools/virsh-host.c | 14 ++++++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-)
[...]
diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 722c47958b..80edfae16c 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1214,6 +1214,10 @@ static const vshCmdOptDef opts_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
Missing addition to virsh man page [...]
@@ -1636,6 +1643,10 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
Missing addition to virsh man page

On a Tuesday in 2020, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:30 +0200, Tim Wiederhake wrote:
Again the summary is misleading and empty commit message doesn't help.
This patch also adds a flag to the public API which is an important change rather than just modifying virsh.
The virsh changes should be separated from the API changes. Jano
The summary should mention the public API change rather than the virsh bit.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c | 7 +++++-- src/libxl/libxl_driver.c | 7 +++++-- src/qemu/qemu_driver.c | 18 +++++++++++++----- tools/virsh-host.c | 14 ++++++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-)
[...]
diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 722c47958b..80edfae16c 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1214,6 +1214,10 @@ static const vshCmdOptDef opts_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
Missing addition to virsh man page
[...]
@@ -1636,6 +1643,10 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
Missing addition to virsh man page

On a Monday in 2020, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- include/libvirt/libvirt-host.h | 1 + src/bhyve/bhyve_driver.c | 7 +++++-- src/libxl/libxl_driver.c | 7 +++++-- src/qemu/qemu_driver.c | 18 +++++++++++++----- tools/virsh-host.c | 14 ++++++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 6972834175..9e7840b9c2 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -754,6 +754,7 @@ typedef enum { typedef enum { VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = (1 << 0), /* treat incompatible CPUs as failure */ + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML = (1 << 1), /* validate xml files */
It does not strictly have to be a file. We use: Validate the XML document against schema elsewhere Jano
} virConnectCompareCPUFlags;
int virConnectCompareCPU(virConnectPtr conn, diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index fc57ccd504..7dce3f8648 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1442,14 +1442,17 @@ bhyveConnectCompareCPU(virConnectPtr conn, int ret = VIR_CPU_COMPARE_ERROR; virCapsPtr caps = NULL; bool failIncompatible; + bool validateXML;
- virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR);
if (virConnectCompareCPUEnsureACL(conn) < 0) goto cleanup;
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
if (!(caps = bhyveDriverGetCapabilities(driver))) goto cleanup; @@ -1465,7 +1468,7 @@ bhyveConnectCompareCPU(virConnectPtr conn, } } else { ret = virCPUCompareXML(caps->host.arch, caps->host.cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML); }
cleanup: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 72864c2dc9..6d1f2edd54 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6529,19 +6529,22 @@ libxlConnectCompareCPU(virConnectPtr conn, libxlDriverConfigPtr cfg; int ret = VIR_CPU_COMPARE_ERROR; bool failIncompatible; + bool validateXML;
- virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR);
if (virConnectCompareCPUEnsureACL(conn) < 0) return ret;
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
cfg = libxlDriverConfigGet(driver);
ret = virCPUCompareXML(cfg->caps->host.arch, cfg->caps->host.cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML);
virObjectUnref(cfg); return ret; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7961ad3f0..a0c0a4c777 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12227,20 +12227,23 @@ qemuConnectCompareCPU(virConnectPtr conn, virQEMUDriverPtr driver = conn->privateData; g_autoptr(virCPUDef) cpu = NULL; bool failIncompatible; + bool validateXML;
- virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR);
if (virConnectCompareCPUEnsureACL(conn) < 0) return VIR_CPU_COMPARE_ERROR;
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
if (!(cpu = virQEMUDriverGetHostCPU(driver))) return VIR_CPU_COMPARE_ERROR;
return virCPUCompareXML(driver->hostarch, cpu, - xmlDesc, failIncompatible, false); + xmlDesc, failIncompatible, validateXML); }
@@ -12295,18 +12298,21 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUCaps) qemuCaps = NULL; bool failIncompatible; + bool validateXML; virCPUDefPtr hvCPU; virCPUDefPtr cpu = NULL; virArch arch; virDomainVirtType virttype;
- virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, + virCheckFlags(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | + VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, VIR_CPU_COMPARE_ERROR);
if (virConnectCompareHypervisorCPUEnsureACL(conn) < 0) goto cleanup;
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE); + validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
qemuCaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache, emulator, @@ -12330,10 +12336,12 @@ qemuConnectCompareHypervisorCPU(virConnectPtr conn, }
if (ARCH_IS_X86(arch)) { - ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, false); + ret = virCPUCompareXML(arch, hvCPU, xmlCPU, failIncompatible, + validateXML); } else if (ARCH_IS_S390(arch) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON)) { - if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu, false) < 0) + if (virCPUDefParseXMLString(xmlCPU, VIR_CPU_TYPE_AUTO, &cpu, + validateXML) < 0) goto cleanup;
ret = qemuConnectCPUModelComparison(qemuCaps, cfg->libDir, diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 722c47958b..80edfae16c 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1214,6 +1214,10 @@ static const vshCmdOptDef opts_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
@@ -1230,6 +1234,9 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE;
+ if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false;
@@ -1636,6 +1643,10 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("enable XML file validation") + }, {.name = NULL} };
@@ -1657,6 +1668,9 @@ cmdHypervisorCPUCompare(vshControl *ctl, if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE;
+ if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0 || vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 || vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 || -- 2.26.2

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- tests/cputest.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index b40fd7f7f2..30a125c3da 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -68,7 +68,7 @@ static virQEMUDriver driver; static virCPUDefPtr -cpuTestLoadXML(virArch arch, const char *name) +cpuTestLoadXML(virArch arch, const char *name, bool validate) { char *xml = NULL; xmlDocPtr doc = NULL; @@ -81,7 +81,7 @@ cpuTestLoadXML(virArch arch, const char *name) if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) goto cleanup; - virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, false); + virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, validate); cleanup: xmlXPathFreeContext(ctxt); @@ -203,12 +203,20 @@ cpuTestCompare(const void *arg) virCPUDefPtr host = NULL; virCPUDefPtr cpu = NULL; virCPUCompareResult result; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); - if (!(host = cpuTestLoadXML(data->arch, data->host)) || - !(cpu = cpuTestLoadXML(data->arch, data->name))) - goto cleanup; + host = cpuTestLoadXML(data->arch, data->host, validate); + cpu = cpuTestLoadXML(data->arch, data->name, validate); + + if (!host || !cpu) { + if (validate) + result = VIR_CPU_COMPARE_ERROR; + else + goto cleanup; + } else { + result = virCPUCompare(host->arch, host, cpu, false); + } - result = virCPUCompare(host->arch, host, cpu, false); if (data->result == VIR_CPU_COMPARE_ERROR) virResetLastError(); @@ -240,9 +248,10 @@ cpuTestGuestCPU(const void *arg) virCPUCompareResult cmpResult; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; char *result = NULL; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); - if (!(host = cpuTestLoadXML(data->arch, data->host)) || - !(cpu = cpuTestLoadXML(data->arch, data->name))) + if (!(host = cpuTestLoadXML(data->arch, data->host, validate)) || + !(cpu = cpuTestLoadXML(data->arch, data->name, validate))) goto cleanup; if (virCPUConvertLegacy(host->arch, cpu) < 0) @@ -381,9 +390,10 @@ cpuTestUpdate(const void *arg) virCPUDefPtr migHost = NULL; virCPUDefPtr cpu = NULL; char *result = NULL; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); - if (!(host = cpuTestLoadXML(data->arch, data->host)) || - !(cpu = cpuTestLoadXML(data->arch, data->name))) + if (!(host = cpuTestLoadXML(data->arch, data->host, validate)) || + !(cpu = cpuTestLoadXML(data->arch, data->name, validate))) goto cleanup; if (!(migHost = virCPUCopyMigratable(data->arch, host))) @@ -413,8 +423,9 @@ cpuTestHasFeature(const void *arg) virCPUDefPtr host = NULL; virCPUDataPtr hostData = NULL; int result; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); - if (!(host = cpuTestLoadXML(data->arch, data->host))) + if (!(host = cpuTestLoadXML(data->arch, data->host, validate))) goto cleanup; if (cpuEncode(host->arch, host, NULL, &hostData, @@ -794,9 +805,10 @@ cpuTestUpdateLive(const void *arg) virDomainCapsCPUModelsPtr hvModels = NULL; virDomainCapsCPUModelsPtr models = NULL; int ret = -1; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); cpuFile = g_strdup_printf("cpuid-%s-guest", data->host); - if (!(cpu = cpuTestLoadXML(data->arch, cpuFile))) + if (!(cpu = cpuTestLoadXML(data->arch, cpuFile, validate))) goto cleanup; enabledFile = g_strdup_printf("%s/cputestdata/%s-cpuid-%s-enabled.xml", @@ -812,7 +824,7 @@ cpuTestUpdateLive(const void *arg) goto cleanup; expectedFile = g_strdup_printf("cpuid-%s-json", data->host); - if (!(expected = cpuTestLoadXML(data->arch, expectedFile))) + if (!(expected = cpuTestLoadXML(data->arch, expectedFile, validate))) goto cleanup; /* In case the host CPU signature does not exactly match any CPU model from @@ -1018,10 +1030,13 @@ mymain(void) VIR_FREE(testLabel); \ } while (0) -#define DO_TEST_COMPARE(arch, host, cpu, result) \ +#define DO_TEST_COMPARE_FLAGS(arch, host, cpu, result, flags) \ DO_TEST(arch, cpuTestCompare, \ host "/" cpu " (" #result ")", \ - host, cpu, NULL, 0, result) + host, cpu, NULL, flags, result) + +#define DO_TEST_COMPARE(arch, host, cpu, result) \ + DO_TEST_COMPARE_FLAGS(arch, host, cpu, result, 0) #define DO_TEST_UPDATE_ONLY(arch, host, cpu) \ DO_TEST(arch, cpuTestUpdate, \ -- 2.26.2

On Mon, Sep 21, 2020 at 15:07:31 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- tests/cputest.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c index b40fd7f7f2..30a125c3da 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -68,7 +68,7 @@ static virQEMUDriver driver;
static virCPUDefPtr -cpuTestLoadXML(virArch arch, const char *name) +cpuTestLoadXML(virArch arch, const char *name, bool validate) { char *xml = NULL; xmlDocPtr doc = NULL; @@ -81,7 +81,7 @@ cpuTestLoadXML(virArch arch, const char *name) if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) goto cleanup;
- virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, false); + virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, validate);
Is there any reason why we can't just always pass 'true' here?
cleanup: xmlXPathFreeContext(ctxt); @@ -203,12 +203,20 @@ cpuTestCompare(const void *arg) virCPUDefPtr host = NULL; virCPUDefPtr cpu = NULL; virCPUCompareResult result; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
- if (!(host = cpuTestLoadXML(data->arch, data->host)) || - !(cpu = cpuTestLoadXML(data->arch, data->name))) - goto cleanup; + host = cpuTestLoadXML(data->arch, data->host, validate); + cpu = cpuTestLoadXML(data->arch, data->name, validate); + + if (!host || !cpu) { + if (validate) + result = VIR_CPU_COMPARE_ERROR; + else + goto cleanup; + } else { + result = virCPUCompare(host->arch, host, cpu, false); + }
Same here, we should always validate the XML files. Also reporting a validation failure as a COMPARE_ERROR seems wrong IMO.

On Tue, 2020-09-29 at 11:21 +0200, Peter Krempa wrote:
(...) On Mon, Sep 21, 2020 at 15:07:31 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- tests/cputest.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c index b40fd7f7f2..30a125c3da 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -203,12 +203,20 @@ cpuTestCompare(const void *arg) virCPUDefPtr host = NULL; virCPUDefPtr cpu = NULL; virCPUCompareResult result; + bool validate = !!(data->flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
- if (!(host = cpuTestLoadXML(data->arch, data->host)) || - !(cpu = cpuTestLoadXML(data->arch, data->name))) - goto cleanup; + host = cpuTestLoadXML(data->arch, data->host, validate); + cpu = cpuTestLoadXML(data->arch, data->name, validate); + + if (!host || !cpu) { + if (validate) + result = VIR_CPU_COMPARE_ERROR; + else + goto cleanup; + } else { + result = virCPUCompare(host->arch, host, cpu, false); + }
(...) Also reporting a validation failure as a COMPARE_ERROR seems wrong IMO.
The enum virCPUCompareResult in libvirt-host.h defines the values VIR_CPU_COMPARE_{ERROR,INCOMPATIBLE,IDENTICAL,SUPERSET}. I believe VIR_CPU_COMPARE_ERROR to be correct here, but have rewritten this part for v3. Tim

Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- tests/cputest.c | 4 ++++ tests/cputestdata/x86_64-bogus-attribute.xml | 2 ++ tests/cputestdata/x86_64-bogus-element.xml | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml create mode 100644 tests/cputestdata/x86_64-bogus-element.xml diff --git a/tests/cputest.c b/tests/cputest.c index 30a125c3da..2d00040497 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1106,6 +1106,10 @@ mymain(void) } \ } while (0) + /* invalid xml */ + DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-element", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); + DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-attribute", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); + /* host to host comparison */ DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host", VIR_CPU_COMPARE_IDENTICAL); DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE); diff --git a/tests/cputestdata/x86_64-bogus-attribute.xml b/tests/cputestdata/x86_64-bogus-attribute.xml new file mode 100644 index 0000000000..073ee793e6 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-attribute.xml @@ -0,0 +1,2 @@ +<cpu nonExistantAttribute=""> +</cpu> diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu> -- 2.26.2

On Mon, 2020-09-21 at 15:07 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- tests/cputest.c | 4 ++++ tests/cputestdata/x86_64-bogus-attribute.xml | 2 ++ tests/cputestdata/x86_64-bogus-element.xml | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml create mode 100644 tests/cputestdata/x86_64-bogus-element.xml
diff --git a/tests/cputest.c b/tests/cputest.c index 30a125c3da..2d00040497 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1106,6 +1106,10 @@ mymain(void) } \ } while (0)
+ /* invalid xml */ + DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-element", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); + DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus- attribute", VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML); + /* host to host comparison */ DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host", VIR_CPU_COMPARE_IDENTICAL); DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE); diff --git a/tests/cputestdata/x86_64-bogus-attribute.xml b/tests/cputestdata/x86_64-bogus-attribute.xml new file mode 100644 index 0000000000..073ee793e6 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-attribute.xml @@ -0,0 +1,2 @@ +<cpu nonExistantAttribute="">
nickpick: the proper spelling is "existent"
+</cpu> diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/>
again.
+</cpu>

On Mon, 2020-09-28 at 11:20 -0500, Jonathon Jongsma wrote:
(...)
+<cpu nonExistantAttribute="">
nickpick: the proper spelling is "existent"
(...)
+ <nonExistantElement/>
again.
Thanks, fixed locally. I will wait for review on the other patches before resending. Tim

On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.

On Tue, 2020-09-29 at 11:22 +0200, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.
This was my approach to adding negative tests to the "virsh [hypervisor-]cpu-compare --validate" feature to make sure that schema violations are actually caught. If this is not the correct place to do so, I would be grateful for a pointer in the right direction. Tim

On Wed, Sep 30, 2020 at 13:54:58 +0200, Tim Wiederhake wrote:
On Tue, 2020-09-29 at 11:22 +0200, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.
This was my approach to adding negative tests to the "virsh [hypervisor-]cpu-compare --validate" feature to make sure that schema violations are actually caught. If this is not the correct place to do so, I would be grateful for a pointer in the right direction.
I'd find way more useful to actually test that all the XMLs we use in the tests are validated, which does not seem to happen in this series. This series adds schema validation only for a very synthetic negative case which IMO doesn't make sense. Additionally we do have 'virschematest', which is meant to validate all XML documents in the tests. Based on the fact that you've added a invalid XML example but it's name doesn't end in '-invalid.xml', which is the marker for the 'virschematest' worker to do negative validation, means that the cpu files are not validated. Rather than adding a synthetic case, wire up virschematest which will make sure that we don't have bogus XMLs in the test suite.

On Wed, 2020-09-30 at 14:11 +0200, Peter Krempa wrote:
On Wed, Sep 30, 2020 at 13:54:58 +0200, Tim Wiederhake wrote:
On Tue, 2020-09-29 at 11:22 +0200, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.
This was my approach to adding negative tests to the "virsh [hypervisor-]cpu-compare --validate" feature to make sure that schema violations are actually caught. If this is not the correct place to do so, I would be grateful for a pointer in the right direction.
I'd find way more useful to actually test that all the XMLs we use in the tests are validated, which does not seem to happen in this series.
This series adds schema validation only for a very synthetic negative case which IMO doesn't make sense.
Additionally we do have 'virschematest', which is meant to validate all XML documents in the tests. Based on the fact that you've added a invalid XML example but it's name doesn't end in '-invalid.xml', which is the marker for the 'virschematest' worker to do negative validation, means that the cpu files are not validated.
Rather than adding a synthetic case, wire up virschematest which will make sure that we don't have bogus XMLs in the test suite.
Thanks, I was unaware of this test. One problem I see is that tests/cputestdata contains xml files with different root elements: $ for i in tests/cputestdata/*.xml ; do xpath -q -e "name(/*)" $i ; done | sort | uniq -c 273 cpu 157 cpudata 16 cpuTest Adding 'DO_TEST_DIR("cpu.rng", "cputestdata");' to virschematest.c therefore fails for 157 + 16 files. I do not believe that we would want to individually list 273 files in virschematest.c and reworking the directory structure appears undesirable. Do you have any suggestions on how to go forward on this? Thanks, Tim

On a Monday in 2020, Tim Wiederhake wrote:
On Wed, 2020-09-30 at 14:11 +0200, Peter Krempa wrote:
On Wed, Sep 30, 2020 at 13:54:58 +0200, Tim Wiederhake wrote:
On Tue, 2020-09-29 at 11:22 +0200, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.
This was my approach to adding negative tests to the "virsh [hypervisor-]cpu-compare --validate" feature to make sure that schema violations are actually caught. If this is not the correct place to do so, I would be grateful for a pointer in the right direction.
I'd find way more useful to actually test that all the XMLs we use in the tests are validated, which does not seem to happen in this series.
This series adds schema validation only for a very synthetic negative case which IMO doesn't make sense.
Additionally we do have 'virschematest', which is meant to validate all XML documents in the tests. Based on the fact that you've added a invalid XML example but it's name doesn't end in '-invalid.xml', which is the marker for the 'virschematest' worker to do negative validation, means that the cpu files are not validated.
Rather than adding a synthetic case, wire up virschematest which will make sure that we don't have bogus XMLs in the test suite.
Thanks, I was unaware of this test. One problem I see is that tests/cputestdata contains xml files with different root elements:
$ for i in tests/cputestdata/*.xml ; do xpath -q -e "name(/*)" $i ; done | sort | uniq -c 273 cpu 157 cpudata 16 cpuTest
Adding 'DO_TEST_DIR("cpu.rng", "cputestdata");' to virschematest.c therefore fails for 157 + 16 files. I do not believe that we would want to individually list 273 files in virschematest.c and reworking the directory structure appears undesirable.
If by undesirable you mean you don't want to touch it with a 3.048 m pole, I understand. But it's not trivial to figure out from cputest.c or the filenames which files belong to which tests, so separating them to different directories might help readability. The 'cpudata' files should have -cpuid- in their name, so separating them to a separate directory shouldn't be so difficult. And <cpuTest> is used as a wrapper for multiple <cpu> nodes for baseline tests. Jano
Do you have any suggestions on how to go forward on this?
Thanks, Tim

On Mon, Oct 05, 2020 at 13:41:52 +0200, Ján Tomko wrote:
On a Monday in 2020, Tim Wiederhake wrote:
On Wed, 2020-09-30 at 14:11 +0200, Peter Krempa wrote:
On Wed, Sep 30, 2020 at 13:54:58 +0200, Tim Wiederhake wrote:
On Tue, 2020-09-29 at 11:22 +0200, Peter Krempa wrote:
On Mon, Sep 21, 2020 at 15:07:32 +0200, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> ---
[...]
diff --git a/tests/cputestdata/x86_64-bogus-element.xml b/tests/cputestdata/x86_64-bogus-element.xml new file mode 100644 index 0000000000..79f98bad18 --- /dev/null +++ b/tests/cputestdata/x86_64-bogus-element.xml @@ -0,0 +1,3 @@ +<cpu> + <nonExistantElement/> +</cpu>
I'm not persuaded that there's value in such test.
This was my approach to adding negative tests to the "virsh [hypervisor-]cpu-compare --validate" feature to make sure that schema violations are actually caught. If this is not the correct place to do so, I would be grateful for a pointer in the right direction.
I'd find way more useful to actually test that all the XMLs we use in the tests are validated, which does not seem to happen in this series.
This series adds schema validation only for a very synthetic negative case which IMO doesn't make sense.
Additionally we do have 'virschematest', which is meant to validate all XML documents in the tests. Based on the fact that you've added a invalid XML example but it's name doesn't end in '-invalid.xml', which is the marker for the 'virschematest' worker to do negative validation, means that the cpu files are not validated.
Rather than adding a synthetic case, wire up virschematest which will make sure that we don't have bogus XMLs in the test suite.
Thanks, I was unaware of this test. One problem I see is that tests/cputestdata contains xml files with different root elements:
$ for i in tests/cputestdata/*.xml ; do xpath -q -e "name(/*)" $i ; done | sort | uniq -c 273 cpu 157 cpudata 16 cpuTest
Adding 'DO_TEST_DIR("cpu.rng", "cputestdata");' to virschematest.c therefore fails for 157 + 16 files. I do not believe that we would want to individually list 273 files in virschematest.c and reworking the directory structure appears undesirable.
If by undesirable you mean you don't want to touch it with a 3.048 m pole, I understand.
But it's not trivial to figure out from cputest.c or the filenames which files belong to which tests, so separating them to different directories might help readability.
The 'cpudata' files should have -cpuid- in their name, so separating them to a separate directory shouldn't be so difficult.
And <cpuTest> is used as a wrapper for multiple <cpu> nodes for baseline tests.
Alternatively we can add a special schema file for tests which will declare <cpuTest> as a 'oneOrMore' of <cpu> elements, and will also describe <cpudata>. Or both. Specifically the special schema will be helpful to validate the concatenated files for baselining as they really aren't really validated otherwise if we want to do it via virschematest. Since the new version of your patches is validating all files and not just the negative cases it deals with my complaint just fine. I just didn't see a point in validating negative cases only without actually trying if we even pass on some files. Whether it's worth pursuing the change to virschematest is up to you.
participants (4)
-
Jonathon Jongsma
-
Ján Tomko
-
Peter Krempa
-
Tim Wiederhake