Re: [libvirt] [PATCHv2 1/4] xml: Add element to allow short description of domains</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=libvir-list@redhat.com&q=from:%22Eric+Blake%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Eric Blake</span></span></a></span> <span class="date"><a href="/search?l=libvir-list@redhat.com&q=date:20120130" rel="nofollow">Mon, 30 Jan 2012 15:47:56 -0800</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre>On 01/30/2012 08:09 AM, Peter Krempa wrote: > This patch adds a new element <title> to the domain XML. This attribute > can hold a short title defined by the user to ease the identification of > domains. The title contain newlines and should be reasonably short.</pre><pre> s/title contain/title may not contain/ > +++ b/docs/formatdomain.html.in > @@ -37,6 +37,7 @@ > &lt;app1:foo xmlns:app1="<a rel="nofollow" href="http://app1.org/app1/"&gt;..&lt;/app1:foo&gt">http://app1.org/app1/"&gt;..&lt;/app1:foo&gt</a>; > &lt;app2:bar xmlns:app2="<a rel="nofollow" href="http://app1.org/app2/"&gt;..&lt;/app2:bar&gt">http://app1.org/app2/"&gt;..&lt;/app2:bar&gt</a>; > &lt;/metadata&gt; > + &lt;title&gt;A short description - title - of the domain&lt;/title&gt; > ...</pre> > > <dl> > @@ -72,6 +73,11 @@ > (if the application needs structure, they should have > sub-elements to their namespace > element). <span class="since">Since 0.9.10</span></dd> > + > + <dt><code>title</code></dt> > + <dd>The optional element <code>title</code> provides space for a > + shorter description, capped at 40 bytes and with no newline, Drop the 'capped at 40 bytes' > @@ -29,6 +37,9 @@ > <ref name="metadata"/> > </optional> > <optional> > + <ref name="title"/> > + </optional> Personally, I'd stick title before description, rather than after metadata (you want the most important stuff to come first, and as a title is intended to convey more information than name and in less space than description, that argues it should be first, not buried behind several lines of XML). > @@ -11455,6 +11464,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, > xmlIndentTreeOutput = oldIndentTreeOutput; > } > > + virBufferEscapeString(buf, " <title>%s</title>\n", def->title); Likewise, on output, I'd format <title> before <description>. > +++ b/src/conf/domain_conf.h > @@ -1422,6 +1422,7 @@ struct _virDomainDef { > int id; > unsigned char uuid[VIR_UUID_BUFLEN]; > char *name; > + char *title; > char *description; Here's a case where you already did it the way I'm talking about :) > +++ b/tests/domainschemadata/qemu-simple-description-title.xml > @@ -0,0 +1,27 @@ > +<domain type='qemu'> > + <name>qemu-demo</name> > + <uuid>603cc28c-9841-864e-0949-8cc7d3bae9f8</uuid> > + <memory>65536</memory> > + <currentMemory>65536</currentMemory> > + <title>A short description of this domain</title> > + <description> > + A longer explanation that this domain is a test domain > + for validating domain schemas. > + </description> Hmm, you aren't testing this in any path that reformats the parsed input, or you would have caught the ordering issue. Actually, we haven't stuck very many files in domainschemadata; most of the time we have called a file in qemuxml2argvdata good enough (since the domainschema test really does test both directories for well-formedness; but domainscehmadata is input only, while the qemuxml2argvdata directory also does further testing on the XML such as command line conversion and re-formatting the output). > diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml > b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml > index 2f13d46..6cb0b31 100644 > --- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml > +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml > @@ -1,6 +1,11 @@ > <domain type='qemu'> > <name>QEMUGuest1</name> > <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> > + <description> > + A test of qemu&apos;s minimal configuration. > + This test also tests the description and title elements. > + </description> > + <title>A description of the test machine.</title> If you go with my ordering, this test needs a bit of a tweak. ACK with the nits fixed. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library <a rel="nofollow" href="http://libvirt.org">http://libvirt.org</a> </pre> <p><strong><a href="msg51338/signature.asc" ><img src="../attachment.png" alt="Attachment:" width=27 height=28></a> <a href="msg51338/signature.asc" >signature.asc</a></strong><br> <em>Description:</em> OpenPGP digital signature</p> <pre>-- libvir-list mailing list libvir-list@redhat.com <a rel="nofollow" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a></pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg51286.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="index.html#51338">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="maillist.html#51338">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg51287.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email"><span class="subject"><a href="msg51285.html">[libvirt] [PATCHv2 0/4] API for modification of domain metada...</a></span> <span class="sender italic">Peter Krempa</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg51286.html">[libvirt] [PATCHv2 1/4] xml: Add element <title> t...</a></span> <span class="sender italic">Peter Krempa</span></li> <li><ul> <li class="icons-email tSliceCur"><span class="subject">Re: [libvirt] [PATCHv2 1/4] xml: Add element <tit...</span> <span class="sender italic">Eric Blake</span></li> </ul></li> <li class="icons-email"><span class="subject"><a href="msg51287.html">[libvirt] [PATCHv2 2/4] API: Add api to set and get doma...</a></span> <span class="sender italic">Peter Krempa</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg51339.html">Re: [libvirt] [PATCHv2 2/4] API: Add api to set and ...</a></span> <span class="sender italic">Eric Blake</span></li> </ul></li> <li class="icons-email"><span class="subject"><a href="msg51288.html">[libvirt] [PATCHv2 3/4] virsh: Add support for modifying...</a></span> <span class="sender italic">Peter Krempa</span></li> <li class="icons-email"><span class="subject"><a href="msg51289.html">[libvirt] [PATCHv2 4/4] qemu: Add support for virDomainG...</a></span> <span class="sender italic">Peter Krempa</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="Re: [libvirt] [PATCHv2 1/4] xml: Add element <title> to allow short description of domains"> <input type="hidden" name="msgid" value="4F272A44.1080806@redhat.com"> <input type="hidden" name="relpath" value="libvir-list@redhat.com/msg51338.html"> <input type="submit" value=" Eric Blake "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="libvir-list@redhat.com"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search libvir-list"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/libvir-list@redhat.com/">libvir-list - all messages</a></li> <li class="icons-about"><a href="/libvir-list@redhat.com/info.html">libvir-list - about the list</a></li> <li class="icons-expand"><a href="/search?l=libvir-list@redhat.com&q=subject:%22Re%5C%3A+%5C%5Blibvirt%5C%5D+%5C%5BPATCHv2+1%5C%2F4%5C%5D+xml%5C%3A+Add+element+%3Ctitle%3E+to+allow+short+description+of+domains%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg51286.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg51287.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">4F272A44.1080806@redhat.com</li> </ul> </div> </body> </html> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9c4c6ed10e44ee28',t:'MTc2OTU2MDc2OA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script>