[libvirt] [PATCH] schema: pool: netfs: Don't enforce slash in glusterfs pool source

Gluster volumes don't start with a leading slash. Our schema for netfs gluster pools enforces it though. Luckily mount.glusterfs skips it. Allow a slashless volume name for glusterfs netfs mounts in the schema. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999 --- docs/schemas/basictypes.rng | 6 +++ docs/schemas/storagepool.rng | 44 +++++++++++++++++----- .../pool-netfs-gluster-without-slash.xml | 12 ++++++ 3 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 5fe3a97..9c9419f 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -231,6 +231,12 @@ </data> </define> + <define name="dirPath"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param> + </data> + </define> + <define name="absFilePath"> <data type="string"> <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,]+</param> diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index 8d7a94d..b2d1473 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -327,6 +327,15 @@ </element> </define> + <define name='sourceinfonetfsgluster'> + <element name='dir'> + <attribute name='path'> + <ref name='dirPath'/> + </attribute> + <empty/> + </element> + </define> + <define name='sourceinfoname'> <element name='name'> <text/> @@ -394,7 +403,6 @@ <value>auto</value> <value>nfs</value> <value>cifs</value> - <value>glusterfs</value> </choice> </attribute> </element> @@ -468,14 +476,32 @@ <define name='sourcenetfs'> <element name='source'> - <interleave> - <ref name='sourceinfohost'/> - <ref name='sourceinfodir'/> - <ref name='sourcefmtnetfs'/> - <optional> - <ref name='sourceinfovendor'/> - </optional> - </interleave> + <choice> + <group> + <interleave> + <ref name='sourceinfohost'/> + <ref name='sourceinfodir'/> + <ref name='sourcefmtnetfs'/> + <optional> + <ref name='sourceinfovendor'/> + </optional> + </interleave> + </group> + <group> + <interleave> + <ref name='sourceinfohost'/> + <ref name='sourceinfonetfsgluster'/> + <element name='format'> + <attribute name='type'> + <value>glusterfs</value> + </attribute> + </element> + <optional> + <ref name='sourceinfovendor'/> + </optional> + </interleave> + </group> + </choice> </element> </define> diff --git a/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml b/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml new file mode 100644 index 0000000..69a2c6d --- /dev/null +++ b/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml @@ -0,0 +1,12 @@ +<pool type='netfs'> + <source> + <host name='example.com'/> + <format type='glusterfs'/> + <dir path='volume'/> + </source> + <name>netfs-gluster</name> + <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid> + <target> + <path>/mnt/gluster</path> + </target> +</pool> -- 2.0.0

On 07/11/14 12:11, Peter Krempa wrote:
Gluster volumes don't start with a leading slash. Our schema for netfs gluster pools enforces it though. Luckily mount.glusterfs skips it. Allow a slashless volume name for glusterfs netfs mounts in the schema.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999 --- docs/schemas/basictypes.rng | 6 +++ docs/schemas/storagepool.rng | 44 +++++++++++++++++----- .../pool-netfs-gluster-without-slash.xml | 12 ++++++ 3 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
Ping. Anybody willing to review? :) Peter

On 07/11/2014 04:11 AM, Peter Krempa wrote:
Gluster volumes don't start with a leading slash. Our schema for netfs gluster pools enforces it though. Luckily mount.glusterfs skips it. Allow a slashless volume name for glusterfs netfs mounts in the schema.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999 --- docs/schemas/basictypes.rng | 6 +++ docs/schemas/storagepool.rng | 44 +++++++++++++++++----- .../pool-netfs-gluster-without-slash.xml | 12 ++++++ 3 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 5fe3a97..9c9419f 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -231,6 +231,12 @@ </data> </define>
+ <define name="dirPath"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param>
This allows the empty string...
+ </data> + </define> + <define name="absFilePath"> <data type="string"> <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,]+</param>
...while this required a leading slash and at least one other character. I think you want + instead of * in the first pattern. ACK with that fixed. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 07/21/14 18:19, Eric Blake wrote:
On 07/11/2014 04:11 AM, Peter Krempa wrote:
Gluster volumes don't start with a leading slash. Our schema for netfs gluster pools enforces it though. Luckily mount.glusterfs skips it. Allow a slashless volume name for glusterfs netfs mounts in the schema.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999 --- docs/schemas/basictypes.rng | 6 +++ docs/schemas/storagepool.rng | 44 +++++++++++++++++----- .../pool-netfs-gluster-without-slash.xml | 12 ++++++ 3 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 5fe3a97..9c9419f 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -231,6 +231,12 @@ </data> </define>
+ <define name="dirPath"> + <data type="string"> + <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param>
This allows the empty string...
+ </data> + </define> + <define name="absFilePath"> <data type="string"> <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,]+</param>
...while this required a leading slash and at least one other character. I think you want + instead of * in the first pattern.
Yeah, I forgot to tweak the repeating operator when copying the pattern.
ACK with that fixed.
Fixed && pushed; Thanks. Peter
participants (2)
-
Eric Blake
-
Peter Krempa