On Mon, Apr 14, 2014 at 16:54:15 -0600, Eric Blake wrote:
This patch is my first experience playing with nested grammars,
as documented in
http://relaxng.org/tutorial-20011203.html#IDA3PZR.
I plan on doing more overrides in order to make the RelaxNG
grammar mirror the C code refactoring into a common
virStorageSource, but where different clients of that source do
not support the same subset of functionality. By starting with
something fairly easy to validate, I can make sure my later
patches will be possible.
This patch adds a use of the no-op <ref
name='sourceStartupPolicy'/> to the disksnapshot definition, so
that the snapshot version of a type='file' <source> more closely
resembles the version in domaincommon. A future patch will merge
the two files into using a common define, but this patch is
sufficient for testing that adding <source
startupPolicy='optional'/> in any of the
tests/domainsnapshotxml2xmlin/*.xml files still gets rejected
unless it occurs within the <domain> subelement, because the
definition of startupPolicy is empty outside of domain.rng.
To prove this, I suggest adding new XML in domainsnapshotxml2xmlin that
would use startupPolicy in the forbidden way.
ACK with the following test squashed in.
Jirka
diff --git c/tests/domainsnapshotxml2xmlin/disk-invalid.xml
i/tests/domainsnapshotxml2xmlin/disk-invalid.xml
new file mode 100644
index 0000000..6d2bea4
--- /dev/null
+++ i/tests/domainsnapshotxml2xmlin/disk-invalid.xml
@@ -0,0 +1,10 @@
+<domainsnapshot>
+ <name>asdf</name>
+ <description>adsf</description>
+ <disks>
+ <disk name='vda' snapshot='external'>
+ <source file='/tmp/foo' startupPolicy='optional'/>
+ <driver/>
+ </disk>
+ </disks>
+</domainsnapshot>