Add the share option in the XML parser and in the memdev domain
structure.
Signed-off-by: Michele Paolino <m.paolino(a)virtualopensystems.com>
---
src/conf/domain_conf.c | 16 ++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 3 +++
3 files changed, 20 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 465a223..e73b6f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9250,6 +9250,13 @@ virDomainMemDevDefParseXML(xmlNodePtr node,
goto error;
}
+ if ((tmp = virXMLPropString(node, "share")) != NULL) {
+ if (STREQ(tmp, "on"))
+ def->share = true;
+ VIR_FREE(tmp);
+ }
+
if ((tmp = virXMLPropString(node, "merge")) != NULL) {
if (STREQ(tmp, "yes"))
def->merge = true;
@@ -9297,6 +9304,13 @@ virDomainMemDevDefParseXML(xmlNodePtr node,
goto error;
}
+ if (def->type == VIR_DOMAIN_MEMDEV_RAM && def->share) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("The share argument should be not specified when "
+ "memory device type is 'ram'"));
+ goto error;
+ }
+
def->hostnodes = virXPathString("string(./source/@host-nodes)", ctxt);
policy = virXPathString("string(./source/@policy)", ctxt);
@@ -16434,6 +16448,8 @@ virDomainMemDevDefFormat(virBufferPtr buf,
}
virBufferAsprintf(buf, "<memdev type='%s'", type);
+ if (def->type == VIR_DOMAIN_MEMDEV_FILE && def->share)
+ virBufferAddLit(buf, " share='on'");
if (def->merge)
virBufferAddLit(buf, " merge='yes'");
if (def->dump)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 06e6781..eb5bad7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1508,6 +1508,7 @@ struct _virDomainMemDevDef {
unsigned long long capacity; /* bytes */
+ bool share;
bool merge;
bool dump;
bool prealloc;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index db6717f..25e5b3c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4631,6 +4631,9 @@ qemuBuildMemObjectStr(virDomainMemDevDefPtr dev,
if (dev->type == VIR_DOMAIN_MEMDEV_FILE && dev->mempath)
virBufferAsprintf(&buf, ",mem-path=%s", dev->mempath);
+ if (dev->type == VIR_DOMAIN_MEMDEV_FILE && dev->share)
+ virBufferAsprintf(&buf, ",share=on");
+
if (dev->hostnodes)
virBufferAsprintf(&buf, ",host-nodes=%s", dev->hostnodes);
--
1.9.3