Hi Eric, On Fri, Jan 20, 2012 at 11:55 PM, Eric Blake <eblake@xxxxxxxxxx> wrote: > On 01/20/2012 01:15 PM, Zeeshan Ali (Khattak) wrote: >> From 6895c107970ea6daf3d0e7f8be9a1a4e97b2278b Mon Sep 17 00:00:00 2001 >> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> >> Date: Fri, 20 Jan 2012 21:50:35 +0200 >> Subject: [PATCH] Allow custom metadata in domain configuration XML >> >> Applications can now insert custom nodes and hierarchies into domain >> cofiguration XML. Although currently not enforced, application are >> required to use their own namespaces on every custom node they insert. > > Looks like an interesting idea, as it gives applications more structure > than what they would get by overloading the free-form <description>. Thanks but four people contributed to this idea so I can't take much credit. > Hmm, you didn't update docs/schemas/domaincommon.rng. Didn't know there is one. :) > But how do you > write a schema that accepts a <metadata> element with arbitrary > contents? </me searches the web...> > > http://www.oasis-open.org/committees/relax-ng/tutorial.html#IDAFLZR That might be an issue, I'll look into it. >> @@ -11833,6 +11841,19 @@ virDomainDefFormatInternal(virDomainDefPtr def, >> goto cleanup; >> } >> >> + /* Custom metadata comes at the end */ >> + if (def->metadata) { >> + xmlBufferPtr xmlbuf; >> + >> + xmlbuf = xmlBufferCreate(); >> + if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, 2, 0) < 0) { > > Is this the right level of indentation if buf itself already has > indentation (such as when <domain> is nested inside <domainsnapshot>? > You may need to use virBufferGetIndent() and use that to alter the > fourth argument to xmlNodeDump accordingly. K. > Unless anyone else objects to this XML addition, I think it is probably > okay; but I have a couple caveats: > > 1. you need to add tests that prove we can parse/regenerate user XML > (that is, qemuxml2xmltest.c needs a new test case, and I'd also like to > see one of the snapshot xml tests covering this to ensure indentation > was taken care of) Will do! > 2. we probably need an API to allow the user to change this XML on the > fly for a running domain. Do we? I'm not sure about that. At least we (in Boxes context) dont' need it and I'm lazy. :) -- Regards, Zeeshan Ali (Khattak) FSF member#5124 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list