From 8fc469b3d56e456a0fb055a210ae729833bcded0 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 30 Sep 2009 16:07:24 +0200 Subject: [PATCH] 523639 Allows a tag for domains * docs/schemas/domain.rng: allow one tag in the top level of the 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 --- docs/schemas/domain.rng | 13 +++++++++++++ src/conf/domain_conf.c | 8 ++++++++ src/conf/domain_conf.h | 1 + 3 files changed, 22 insertions(+) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 70e98a708d..b1987e11fa 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -6,6 +6,16 @@ + + + + + + + + @@ -14,6 +24,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5e37d96a54..868e865225 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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, " %s\n", uuidstr); + if (def->description) + virBufferEscapeString(&buf, " %s\n", + def->description); + virBufferVSprintf(&buf, " %lu\n", def->maxmem); virBufferVSprintf(&buf, " %lu\n", def->memory); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7c918a7b03..4b3646ee8c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -533,6 +533,7 @@ struct _virDomainDef { int id; unsigned char uuid[VIR_UUID_BUFLEN]; char *name; + char *description; unsigned long memory; unsigned long maxmem; -- GitLab