mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00: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:
parent
9d162096ca
commit
8fc469b3d5
@ -6,6 +6,16 @@
|
||||
</start>
|
||||
|
||||
<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
|
||||
-->
|
||||
@ -14,6 +24,9 @@
|
||||
<ref name="hvs"/>
|
||||
<ref name="ids"/>
|
||||
<interleave>
|
||||
<optional>
|
||||
<ref name="description"/>
|
||||
</optional>
|
||||
<ref name="os"/>
|
||||
<ref name="clock"/>
|
||||
<ref name="resources"/>
|
||||
|
@ -506,6 +506,7 @@ void virDomainDefFree(virDomainDefPtr def)
|
||||
VIR_FREE(def->name);
|
||||
VIR_FREE(def->cpumask);
|
||||
VIR_FREE(def->emulator);
|
||||
VIR_FREE(def->description);
|
||||
|
||||
virSecurityLabelDefFree(def);
|
||||
|
||||
@ -2534,6 +2535,9 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
/* Extract documentation if present */
|
||||
def->description = virXPathString(conn, "string(./description[1])", ctxt);
|
||||
|
||||
/* Extract domain memory */
|
||||
if (virXPathULong(conn, "string(./memory[1])", ctxt, &def->maxmem) < 0) {
|
||||
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
@ -4197,6 +4201,10 @@ char *virDomainDefFormat(virConnectPtr conn,
|
||||
virUUIDFormat(uuid, 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, " <currentMemory>%lu</currentMemory>\n",
|
||||
def->memory);
|
||||
|
@ -533,6 +533,7 @@ struct _virDomainDef {
|
||||
int id;
|
||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||
char *name;
|
||||
char *description;
|
||||
|
||||
unsigned long memory;
|
||||
unsigned long maxmem;
|
||||
|
Loading…
x
Reference in New Issue
Block a user