<name>fv0</name>
<uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid>
<description>Some human readable description</description>
+ <metadata>
+ <app1:foo xmlns:app1="http://app1.org/app1/">..</app1:foo>
+ <app2:bar xmlns:app2="http://app1.org/app2/">..</app2:bar>
+ </metadata>
...</pre>
<dl>
<dt><code>description</code></dt>
<dd>The content of the <code>description</code> element provides a
- human readable description of the virtual machine. This data is not
- used by libvirt in any way, it can contain any information the user
- wants. <span class="since">Since 0.7.2</span></dd>
+ human readable description of the virtual machine. This data is not
+ used by libvirt in any way, it can contain any information the user
+ wants. <span class="since">Since 0.7.2</span></dd>
+
+ <dt><code>metadata</code></dt>
+ <dd>The <code>metadata</code> 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). <span class="since">Since 0.9.10</span></dd>
</dl>
<h3><a name="elementsOS">Operating system booting</a></h3>
sub-element <code>label</code> are supported.
</p>
- <h3><a name="customMetadata">Custom metadata</a></h3>
-
-<pre>
- ...
- <metadata>
- <app1:foo xmlns:app1="http://app1.org/app1/">..</app1:foo>
- <app2:bar xmlns:app2="http://app1.org/app2/">..</app2:bar>
- </metadata>
- ...</pre>
-
- <dl>
- <dt><code>metadata</code></dt>
- <dd>The <code>metadata</code> 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). <span class="since">Since 0.9.10</span></dd>
- </dl>
-
<h2><a name="examples">Example configs</a></h2>
<p>
virBufferEscapeString(buf, " <description>%s</description>\n",
def->description);
+ if (def->metadata) {
+ xmlBufferPtr xmlbuf;
+ int oldIndentTreeOutput = xmlIndentTreeOutput;
+
+ /* Indentation on output requires that we previously set
+ * xmlKeepBlanksDefault to 0 when parsing; also, libxml does 2
+ * spaces per level of indentation of intermediate elements,
+ * but no leading indentation before the starting element.
+ * Thankfully, libxml maps what looks like globals into
+ * thread-local uses, so we are thread-safe. */
+ xmlIndentTreeOutput = 1;
+ xmlbuf = xmlBufferCreate();
+ if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata,
+ virBufferGetIndent(buf, false) / 2 + 1, 1) < 0) {
+ xmlBufferFree(xmlbuf);
+ xmlIndentTreeOutput = oldIndentTreeOutput;
+ goto cleanup;
+ }
+ virBufferAsprintf(buf, " %s\n", (char *) xmlBufferContent(xmlbuf));
+ xmlBufferFree(xmlbuf);
+ xmlIndentTreeOutput = oldIndentTreeOutput;
+ }
+
virBufferAsprintf(buf, " <memory>%lu</memory>\n", def->mem.max_balloon);
virBufferAsprintf(buf, " <currentMemory>%lu</currentMemory>\n",
def->mem.cur_balloon);
goto cleanup;
}
- /* Custom metadata comes at the end */
- if (def->metadata) {
- xmlBufferPtr xmlbuf;
- int oldIndentTreeOutput = xmlIndentTreeOutput;
-
- /* Indentation on output requires that we previously set
- * xmlKeepBlanksDefault to 0 when parsing; also, libxml does 2
- * spaces per level of indentation of intermediate elements,
- * but no leading indentation before the starting element.
- * Thankfully, libxml maps what looks like globals into
- * thread-local uses, so we are thread-safe. */
- xmlIndentTreeOutput = 1;
- xmlbuf = xmlBufferCreate();
- if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata,
- virBufferGetIndent(buf, false) / 2 + 1, 1) < 0) {
- xmlBufferFree(xmlbuf);
- xmlIndentTreeOutput = oldIndentTreeOutput;
- goto cleanup;
- }
- virBufferAsprintf(buf, " %s\n", (char *) xmlBufferContent(xmlbuf));
- xmlBufferFree(xmlbuf);
- xmlIndentTreeOutput = oldIndentTreeOutput;
- }
-
virBufferAddLit(buf, "</domain>\n");
if (virBufferError(buf))
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <metadata>
+ <app1:foo xmlns:app1="http://foo.org/">fooish</app1:foo>
+ <app2:bar xmlns:app2="http://bar.com/" maman="baz">barish</app2:bar>
+ </metadata>
<memory>219100</memory>
<currentMemory>219100</currentMemory>
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
- <metadata>
- <app1:foo xmlns:app1="http://foo.org/">fooish</app1:foo>
- <app2:bar xmlns:app2="http://bar.com/" maman="baz">barish</app2:bar>
- </metadata>
</domain>
</domainsnapshot>
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <metadata>
+ <app1:foo xmlns:app1="http://foo.org/">fooish</app1:foo>
+ <app2:bar xmlns:app2="http://bar.com/" maman="baz">barish</app2:bar>
+ </metadata>
<memory>219100</memory>
<currentMemory>219100</currentMemory>
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
<controller type='ide' index='0'/>
<memballoon model='virtio'/>
</devices>
- <metadata>
- <app1:foo xmlns:app1="http://foo.org/">fooish</app1:foo>
- <app2:bar xmlns:app2="http://bar.com/" maman="baz">barish</app2:bar>
- </metadata>
</domain>