mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
523639 Allows a <description> tag for domains
* docs/schemas/domain.rng: allow one <description> tag in the top level of the <domain> to store user information as text * src/conf/domain_conf.c src/conf/domain_conf.h: extend the structure to store this text, grab it at parse time and save it back when present after <uuid>
This commit is contained in:
@@ -6,6 +6,16 @@
|
|||||||
</start>
|
</start>
|
||||||
|
|
||||||
<include href='storageencryption.rng'/>
|
<include href='storageencryption.rng'/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
description element, maybe placed anywhere under the root
|
||||||
|
-->
|
||||||
|
<define name="description">
|
||||||
|
<element name="description">
|
||||||
|
<text/>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
We handle only document defining a domain
|
We handle only document defining a domain
|
||||||
-->
|
-->
|
||||||
@@ -14,6 +24,9 @@
|
|||||||
<ref name="hvs"/>
|
<ref name="hvs"/>
|
||||||
<ref name="ids"/>
|
<ref name="ids"/>
|
||||||
<interleave>
|
<interleave>
|
||||||
|
<optional>
|
||||||
|
<ref name="description"/>
|
||||||
|
</optional>
|
||||||
<ref name="os"/>
|
<ref name="os"/>
|
||||||
<ref name="clock"/>
|
<ref name="clock"/>
|
||||||
<ref name="resources"/>
|
<ref name="resources"/>
|
||||||
|
|||||||
@@ -506,6 +506,7 @@ void virDomainDefFree(virDomainDefPtr def)
|
|||||||
VIR_FREE(def->name);
|
VIR_FREE(def->name);
|
||||||
VIR_FREE(def->cpumask);
|
VIR_FREE(def->cpumask);
|
||||||
VIR_FREE(def->emulator);
|
VIR_FREE(def->emulator);
|
||||||
|
VIR_FREE(def->description);
|
||||||
|
|
||||||
virSecurityLabelDefFree(def);
|
virSecurityLabelDefFree(def);
|
||||||
|
|
||||||
@@ -2534,6 +2535,9 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
|
|||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Extract documentation if present */
|
||||||
|
def->description = virXPathString(conn, "string(./description[1])", ctxt);
|
||||||
|
|
||||||
/* Extract domain memory */
|
/* Extract domain memory */
|
||||||
if (virXPathULong(conn, "string(./memory[1])", ctxt, &def->maxmem) < 0) {
|
if (virXPathULong(conn, "string(./memory[1])", ctxt, &def->maxmem) < 0) {
|
||||||
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
@@ -4197,6 +4201,10 @@ char *virDomainDefFormat(virConnectPtr conn,
|
|||||||
virUUIDFormat(uuid, uuidstr);
|
virUUIDFormat(uuid, uuidstr);
|
||||||
virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr);
|
virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr);
|
||||||
|
|
||||||
|
if (def->description)
|
||||||
|
virBufferEscapeString(&buf, " <description>%s</description>\n",
|
||||||
|
def->description);
|
||||||
|
|
||||||
virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->maxmem);
|
virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->maxmem);
|
||||||
virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n",
|
virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n",
|
||||||
def->memory);
|
def->memory);
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ struct _virDomainDef {
|
|||||||
int id;
|
int id;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
char *name;
|
char *name;
|
||||||
|
char *description;
|
||||||
|
|
||||||
unsigned long memory;
|
unsigned long memory;
|
||||||
unsigned long maxmem;
|
unsigned long maxmem;
|
||||||
|
|||||||
Reference in New Issue
Block a user