[PATCH 0/3] schemas: Allow <filesystem/> to have interleaved children

Tested with the following change: diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml index f6bb663e97..875e2316a0 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -27,13 +27,13 @@ <controller type='usb' index='0' model='none'/> <controller type='pci' index='0' model='pci-root'/> <filesystem type='mount' accessmode='passthrough'> - <driver type='virtiofs' queue='1024'/> + <target dir='mount_tag'/> + <source dir='/path'/> <binary path='/usr/libexec/virtiofsd' xattr='on'> <cache mode='always'/> <lock posix='off' flock='off'/> </binary> - <source dir='/path'/> - <target dir='mount_tag'/> + <driver type='virtiofs' queue='1024'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </filesystem> <input type='mouse' bus='ps2'/> Michal Prívozník (3): schemas: Allow fsDriver to be interleaved schemas: Allow interleaving of fsBinary children schemas: Allow direct children of <filesystem/> to be interleaved docs/schemas/domaincommon.rng | 400 +++++++++++++++++----------------- 1 file changed, 202 insertions(+), 198 deletions(-) -- 2.26.2

Our <filesystem/> element can have <driver/> child element. But with the way our schema is written it can't be interleaved and has to go first. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/domaincommon.rng | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 86816e9b1d..49654624a9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2628,10 +2628,10 @@ <attribute name="type"> <value>file</value> </attribute> - <optional> - <ref name="fsDriver"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> <element name="source"> <attribute name="file"> <ref name="absFilePath"/> @@ -2644,10 +2644,10 @@ <attribute name="type"> <value>block</value> </attribute> - <optional> - <ref name="fsDriver"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> <element name="source"> <attribute name="dev"> <ref name="absFilePath"/> @@ -2663,13 +2663,13 @@ <value>mount</value> </attribute> </optional> - <optional> - <ref name="fsDriver"/> - </optional> - <optional> - <ref name="fsBinary"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <optional> + <ref name="fsBinary"/> + </optional> <element name="source"> <attribute name="dir"> <ref name="absDirPath"/> @@ -2684,10 +2684,10 @@ <value>bind</value> </attribute> </optional> - <optional> - <ref name="fsDriver"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> <element name="source"> <attribute name="dir"> <ref name="absDirPath"/> @@ -2700,10 +2700,10 @@ <attribute name="type"> <value>template</value> </attribute> - <optional> - <ref name="fsDriver"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> <element name="source"> <attribute name="name"> <ref name="genericName"/> @@ -2716,10 +2716,10 @@ <attribute name="type"> <value>ram</value> </attribute> - <optional> - <ref name="fsDriver"/> - </optional> <interleave> + <optional> + <ref name="fsDriver"/> + </optional> <element name="source"> <attribute name="usage"> <ref name="unsignedLong"/> -- 2.26.2

The <binary/> element of <filesystem/> can have children elements (<cache/> and <lock/>). Allow them to be interleaved. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/domaincommon.rng | 54 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 49654624a9..9f3b65b546 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2861,32 +2861,34 @@ <ref name="virOnOff"/> </attribute> </optional> - <optional> - <element name="cache"> - <optional> - <attribute name="mode"> - <choice> - <value>none</value> - <value>always</value> - </choice> - </attribute> - </optional> - </element> - </optional> - <optional> - <element name="lock"> - <optional> - <attribute name="posix"> - <ref name="virOnOff"/> - </attribute> - </optional> - <optional> - <attribute name="flock"> - <ref name="virOnOff"/> - </attribute> - </optional> - </element> - </optional> + <interleave> + <optional> + <element name="cache"> + <optional> + <attribute name="mode"> + <choice> + <value>none</value> + <value>always</value> + </choice> + </attribute> + </optional> + </element> + </optional> + <optional> + <element name="lock"> + <optional> + <attribute name="posix"> + <ref name="virOnOff"/> + </attribute> + </optional> + <optional> + <attribute name="flock"> + <ref name="virOnOff"/> + </attribute> + </optional> + </element> + </optional> + </interleave> </element> </define> -- 2.26.2

Now that individual child elements allow their children to be interleaved, let's allow direct children of <filesystem/> to be interleaved too. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/domaincommon.rng | 346 +++++++++++++++++----------------- 1 file changed, 174 insertions(+), 172 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9f3b65b546..24b4994670 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2623,184 +2623,186 @@ </define> <define name="filesystem"> <element name="filesystem"> - <choice> - <group> - <attribute name="type"> - <value>file</value> - </attribute> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <element name="source"> - <attribute name="file"> - <ref name="absFilePath"/> - </attribute> - <empty/> - </element> - </interleave> - </group> - <group> - <attribute name="type"> - <value>block</value> - </attribute> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <element name="source"> - <attribute name="dev"> - <ref name="absFilePath"/> - </attribute> - <empty/> - </element> - </interleave> - </group> - <group> - <!-- type="mount" is default --> - <optional> - <attribute name="type"> - <value>mount</value> - </attribute> - </optional> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <optional> - <ref name="fsBinary"/> - </optional> - <element name="source"> - <attribute name="dir"> - <ref name="absDirPath"/> - </attribute> - <empty/> - </element> - </interleave> - </group> - <group> - <optional> - <attribute name="type"> - <value>bind</value> - </attribute> - </optional> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <element name="source"> - <attribute name="dir"> - <ref name="absDirPath"/> - </attribute> - <empty/> - </element> - </interleave> - </group> - <group> - <attribute name="type"> - <value>template</value> - </attribute> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <element name="source"> - <attribute name="name"> - <ref name="genericName"/> - </attribute> - <empty/> - </element> - </interleave> - </group> - <group> - <attribute name="type"> - <value>ram</value> - </attribute> - <interleave> - <optional> - <ref name="fsDriver"/> - </optional> - <element name="source"> - <attribute name="usage"> - <ref name="unsignedLong"/> - </attribute> - <optional> - <attribute name="units"> - <ref name="unit"/> - </attribute> - </optional> - <empty/> - </element> - </interleave> - </group> - </choice> <interleave> - <element name="target"> - <attribute name="dir"/> - <empty/> - </element> - <optional> - <attribute name="accessmode"> - <choice> - <value>passthrough</value> - <value>mapped</value> - <value>squash</value> - </choice> - </attribute> - </optional> - <optional> - <attribute name="multidevs"> - <choice> - <value>default</value> - <value>remap</value> - <value>forbid</value> - <value>warn</value> - </choice> - </attribute> - </optional> - <optional> - <attribute name="fmode"> - <ref name="createMode"/> - </attribute> - </optional> - <optional> - <attribute name="dmode"> - <ref name="createMode"/> - </attribute> - </optional> - <optional> - <element name="readonly"> + <choice> + <group> + <attribute name="type"> + <value>file</value> + </attribute> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <element name="source"> + <attribute name="file"> + <ref name="absFilePath"/> + </attribute> + <empty/> + </element> + </interleave> + </group> + <group> + <attribute name="type"> + <value>block</value> + </attribute> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <element name="source"> + <attribute name="dev"> + <ref name="absFilePath"/> + </attribute> + <empty/> + </element> + </interleave> + </group> + <group> + <!-- type="mount" is default --> + <optional> + <attribute name="type"> + <value>mount</value> + </attribute> + </optional> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <optional> + <ref name="fsBinary"/> + </optional> + <element name="source"> + <attribute name="dir"> + <ref name="absDirPath"/> + </attribute> + <empty/> + </element> + </interleave> + </group> + <group> + <optional> + <attribute name="type"> + <value>bind</value> + </attribute> + </optional> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <element name="source"> + <attribute name="dir"> + <ref name="absDirPath"/> + </attribute> + <empty/> + </element> + </interleave> + </group> + <group> + <attribute name="type"> + <value>template</value> + </attribute> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <element name="source"> + <attribute name="name"> + <ref name="genericName"/> + </attribute> + <empty/> + </element> + </interleave> + </group> + <group> + <attribute name="type"> + <value>ram</value> + </attribute> + <interleave> + <optional> + <ref name="fsDriver"/> + </optional> + <element name="source"> + <attribute name="usage"> + <ref name="unsignedLong"/> + </attribute> + <optional> + <attribute name="units"> + <ref name="unit"/> + </attribute> + </optional> + <empty/> + </element> + </interleave> + </group> + </choice> + <interleave> + <element name="target"> + <attribute name="dir"/> <empty/> </element> - </optional> - <optional> - <ref name="alias"/> - </optional> - <optional> - <ref name="address"/> - </optional> - </interleave> - <interleave> - <optional> - <element name="space_hard_limit"> - <ref name="scaledInteger"/> - </element> - </optional> + <optional> + <attribute name="accessmode"> + <choice> + <value>passthrough</value> + <value>mapped</value> + <value>squash</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="multidevs"> + <choice> + <value>default</value> + <value>remap</value> + <value>forbid</value> + <value>warn</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="fmode"> + <ref name="createMode"/> + </attribute> + </optional> + <optional> + <attribute name="dmode"> + <ref name="createMode"/> + </attribute> + </optional> + <optional> + <element name="readonly"> + <empty/> + </element> + </optional> + <optional> + <ref name="alias"/> + </optional> + <optional> + <ref name="address"/> + </optional> + </interleave> + <interleave> + <optional> + <element name="space_hard_limit"> + <ref name="scaledInteger"/> + </element> + </optional> + <optional> + <element name="space_soft_limit"> + <ref name="scaledInteger"/> + </element> + </optional> + </interleave> <optional> - <element name="space_soft_limit"> - <ref name="scaledInteger"/> - </element> + <attribute name="model"> + <choice> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </choice> + </attribute> </optional> </interleave> - <optional> - <attribute name="model"> - <choice> - <value>virtio</value> - <value>virtio-transitional</value> - <value>virtio-non-transitional</value> - </choice> - </attribute> - </optional> </element> </define> <define name="fsDriver"> -- 2.26.2

On a Wednesday in 2021, Michal Privoznik wrote:
Tested with the following change:
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml index f6bb663e97..875e2316a0 100644 --- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml +++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml @@ -27,13 +27,13 @@ <controller type='usb' index='0' model='none'/> <controller type='pci' index='0' model='pci-root'/> <filesystem type='mount' accessmode='passthrough'> - <driver type='virtiofs' queue='1024'/> + <target dir='mount_tag'/> + <source dir='/path'/> <binary path='/usr/libexec/virtiofsd' xattr='on'> <cache mode='always'/> <lock posix='off' flock='off'/> </binary> - <source dir='/path'/> - <target dir='mount_tag'/> + <driver type='virtiofs' queue='1024'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </filesystem> <input type='mouse' bus='ps2'/>
Michal Prívozník (3): schemas: Allow fsDriver to be interleaved schemas: Allow interleaving of fsBinary children schemas: Allow direct children of <filesystem/> to be interleaved
docs/schemas/domaincommon.rng | 400 +++++++++++++++++----------------- 1 file changed, 202 insertions(+), 198 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Michal Privoznik