diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d58a5e15e2d27c7099e0063d0f293537dd3dc90f..99152b6377516b98d19f79e287f9b38b6d3e032c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -32,6 +32,7 @@ <domain type='xen' id='3'> <name>fv0</name> <uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid> + <title>A short description - title - of the domain</title> <description>Some human readable description</description> <metadata> <app1:foo xmlns:app1="http://app1.org/app1/">..</app1:foo> @@ -58,6 +59,11 @@ specification. Since 0.0.1, sysinfo since 0.8.7 +
title
+
The optional element title provides space for a + short description of the domain. The title should not contain + any newlines. Since 0.9.10.
+
description
The content of the description element provides a human readable description of the virtual machine. This data is not @@ -72,7 +78,7 @@ (if the application needs structure, they should have sub-elements to their namespace element). Since 0.9.10
- +

Operating system booting

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 2423154b98fd12f2f7762c3da2883a917a233a1a..1576233706efd1d385d1b0724858dc277c7fb73f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6,7 +6,7 @@ @@ -14,6 +14,16 @@ + + + + + [^ +]+ + + + + @@ -22,6 +32,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35cb7a454d748e27b3751324d7cf0c9471d0492d..072fcc76197c41465e51b8f37fd04dc1d6587e7b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1481,6 +1481,7 @@ void virDomainDefFree(virDomainDefPtr def) VIR_FREE(def->cpumask); VIR_FREE(def->emulator); VIR_FREE(def->description); + VIR_FREE(def->title); virBlkioDeviceWeightArrayClear(def->blkio.devices, def->blkio.ndevices); @@ -7158,6 +7159,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, VIR_FREE(tmp); } + /* Extract short description of domain (title) */ + def->title = virXPathString("string(./title[1])", ctxt); + if (def->title && strchr(def->title, '\n')) { + virDomainReportError(VIR_ERR_XML_ERROR, "%s", + _("Domain title can't contain newlines")); + goto error; + } + /* Extract documentation if present */ def->description = virXPathString("string(./description[1])", ctxt); @@ -11487,6 +11496,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, virUUIDFormat(uuid, uuidstr); virBufferAsprintf(buf, " %s\n", uuidstr); + virBufferEscapeString(buf, " %s\n", def->title); + virBufferEscapeString(buf, " %s\n", def->description); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 503684f408c6cf643eefe5b602bf34ee5af47e68..acb936e69cddd277c95ccfbfff39be64e7e7de11 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1425,6 +1425,7 @@ struct _virDomainDef { int id; unsigned char uuid[VIR_UUID_BUFLEN]; char *name; + char *title; char *description; struct { diff --git a/tests/domainschemadata/qemu-simple-description-title.xml b/tests/domainschemadata/qemu-simple-description-title.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8a9cac4521e2cc1ba0c056f05b81c322024611b --- /dev/null +++ b/tests/domainschemadata/qemu-simple-description-title.xml @@ -0,0 +1,27 @@ + + qemu-demo + 603cc28c-9841-864e-0949-8cc7d3bae9f8 + 65536 + 65536 + A short description of this domain + + A longer explanation that this domain is a test domain + for validating domain schemas. + + 1 + + hvm + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-kvm + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml index 2f13d46a005fb9ccc39100fb61bbbaeb6da9d133..51eb59a5e6c5f633548535432bffe5c040484b24 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal.xml @@ -1,6 +1,11 @@ QEMUGuest1 c7a5fdbd-edaf-9455-926a-d65c16db1809 + A description of the test machine. + + A test of qemu's minimal configuration. + This test also tests the description and title elements. + 219100 219100 1