From fa981fc945e7995aef0e828cfbce3cfda87bfe04 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Tue, 24 Jan 2012 04:26:18 +0200 Subject: [PATCH] Allow custom metadata in domain configuration XML Applications can now insert custom nodes and hierarchies into domain configuration XML. Although currently not enforced, applications are required to use their own namespaces on every custom node they insert, with only one top-level element per namespace. --- AUTHORS | 1 + docs/formatdomain.html.in | 20 ++++++++++ docs/schemas/domaincommon.rng | 26 +++++++++++++ src/conf/domain_conf.c | 38 +++++++++++++++++++ src/conf/domain_conf.h | 3 ++ tests/domainsnapshotxml2xmlout/metadata.xml | 38 +++++++++++++++++++ tests/domainsnapshotxml2xmltest.c | 1 + .../qemuxml2argv-metadata.args | 4 ++ .../qemuxml2argv-metadata.xml | 30 +++++++++++++++ .../qemuxml2xmlout-metadata.xml | 29 ++++++++++++++ tests/qemuxml2xmltest.c | 2 + 11 files changed, 192 insertions(+) create mode 100644 tests/domainsnapshotxml2xmlout/metadata.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-metadata.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-metadata.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml diff --git a/AUTHORS b/AUTHORS index 783c48a16e..f383c660ab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -217,6 +217,7 @@ Patches have also been contributed by: Deepak C Shetty Martin Kletzander Laszlo Ersek + Zeeshan Ali (Khattak) [....send patches to get your name here....] diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6667bed6b5..6b025e8564 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3556,6 +3556,26 @@ qemu-kvm -net nic,model=? /dev/null sub-element label are supported.

+

Custom metadata

+ +
+  ...
+  <metadata>
+    <app1:foo xmlns:app1="http://app1.org/app1/">..</app1:foo>
+    <app2:bar xmlns:app2="http://app1.org/app2/">..</app2:bar>
+  </metadata>
+  ...
+ +
+
metadata
+
The metadata node can be used by applications to + store custom metadata in the form of XML nodes/trees. Applications + must use custom namespaces on their XML nodes/trees, with only + one top-level element per namespace (if the application needs + structure, they should have sub-elements to their namespace + element). Since 0.9.10
+
+

Example configs

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 2041dfbbc2..4fa968dc43 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -25,6 +25,9 @@ + + + @@ -2942,6 +2945,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + fooish + barish + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml new file mode 100644 index 0000000000..a6888ee3ae --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +

+ + + + + + fooish + barish + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 293c2a7d5f..df317fd538 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -210,6 +210,8 @@ mymain(void) DO_TEST_DIFFERENT("graphics-listen-network2"); DO_TEST_DIFFERENT("graphics-spice-timeout"); + DO_TEST_DIFFERENT("metadata"); + virCapabilitiesFree(driver.caps); return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);