From 522225684907af09ce4213a365cc98b5881e3eae Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 28 Jan 2015 18:14:22 +0100 Subject: [PATCH] schemas: Allow all generic elements and attributes for all interfaces There are some interface types (notably 'server' and 'client') which instead of allowing the default set of elements and attributes (like the rest do), try to enumerate only the elements they know of. This way it's, however, easy to miss something. For instance, the
element was not mentioned at all. This resulted in a strange behavior: when such interface was added into XML, the address was automatically generated by parsing code. Later, the formatted XML hasn't passed the RNG schema. This became more visible once we've turned on the XML validation on domain XML changes: appending an empty line at the end of formatted XML (to trick virsh think the XML had changed) made libvirt to refuse the very same XML it formatted. Instead of trying to find each element and attribute we are missing in the schema, lets just allow all the elements and attributes like we're doing that for the rest of types. It's no harm if the schema is wider than our parser allows. Signed-off-by: Michal Privoznik --- docs/schemas/domaincommon.rng | 28 +--- .../qemuxml2argv-interface-server.xml | 157 ++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 3 files changed, 160 insertions(+), 26 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-interface-server.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9d6c1ee2b..d467dce6d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2173,14 +2173,7 @@ - - - - - - - - + @@ -2199,24 +2192,7 @@ - - - - - - - - - - - - - [a-zA-Z0-9\-_]+ - - - - - + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-interface-server.xml b/tests/qemuxml2argvdata/qemuxml2argv-interface-server.xml new file mode 100644 index 000000000..9edf77376 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-interface-server.xml @@ -0,0 +1,157 @@ + + gentoo + a75aca4b-a02f-2bcb-4a91-c93cd848c34b + 4194304 + 4194304 + + + + + + 4 + + hvm + + + + + + + + + + Haswell + Intel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + + +
+ + + + + + + + +
+ + + + + + + +
+ + +
+ + + +
+ + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
+ +