diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index cce179d12b29585a404f25518801e19a40e0ad04..3eb5591cdb957c54b4c3ebe8b0ee605cf89c0682 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2185,7 +2185,8 @@
An in-memory filesystem, using memory from the host OS.
The source element has a single attribute usage
- which gives the memory usage limit in kibibytes. Only used
+ which gives the memory usage limit in KiB, unless units
+ are specified by the units
attribute. Only used
by LXC driver.
(since 0.9.13)
type='bind'
@@ -2251,7 +2252,8 @@
name
attribute must be used with
type='template'
, and the dir
attribute must
be used with type='mount'
. The usage
attribute
- is used with type='ram'
to set the memory limit in KB.
+ is used with type='ram'
to set the memory limit in KiB,
+ unless units are specified by the units
attribute.
target
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6978dc74d31a07e2028bf9aaae5caea118e499e1..b99f23e6ac816ea728af479e22016cae3e854add 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1699,7 +1699,7 @@
-
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8de6a85839b072c8ad8499203f65f1b4957e2559..dd41980495d48dd8f2b654afc63f7ede7fda4192 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5873,7 +5873,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
char *accessmode = NULL;
char *wrpolicy = NULL;
char *usage = NULL;
- char *unit = NULL;
+ char *units = NULL;
ctxt->node = node;
@@ -5929,7 +5929,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
source = virXMLPropString(cur, "name");
else if (def->type == VIR_DOMAIN_FS_TYPE_RAM) {
usage = virXMLPropString(cur, "usage");
- unit = virXMLPropString(cur, "unit");
+ units = virXMLPropString(cur, "units");
}
} else if (!target &&
xmlStrEqual(cur->name, BAD_CAST "target")) {
@@ -5999,8 +5999,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
usage);
goto error;
}
- if (unit &&
- virScaleInteger(&def->usage, unit,
+ if (virScaleInteger(&def->usage, units,
1024, ULLONG_MAX) < 0)
goto error;
}
@@ -6022,7 +6021,7 @@ cleanup:
VIR_FREE(accessmode);
VIR_FREE(wrpolicy);
VIR_FREE(usage);
- VIR_FREE(unit);
+ VIR_FREE(units);
VIR_FREE(format);
return def;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 56739b7bf49c9503fdae74e5fcedf6f3d25789a8..ec4fd4baa870e5df561c629e11bd9638baad7842 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -884,7 +884,7 @@ struct _virDomainFSDef {
int accessmode; /* enum virDomainFSAccessMode */
int wrpolicy; /* enum virDomainFSWrpolicy */
int format; /* enum virStorageFileFormat */
- unsigned long long usage;
+ unsigned long long usage; /* in bytes */
char *src;
char *dst;
bool readonly;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 8abaea0f325d1b3545250a97361ca7567a08c845..fca7a203a95e339e73f81ed5aa918942d42e32ac 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1347,7 +1347,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
char *data = NULL;
if (virAsprintf(&data,
- "size=%lldk%s", fs->usage, sec_mount_options) < 0)
+ "size=%lld%s", fs->usage, sec_mount_options) < 0)
goto cleanup;
if (virFileMakePath(fs->dst) < 0) {
diff --git a/tests/domainschematest b/tests/domainschematest
index 0e360caae903fff533235c986741d45db8b7bbd3..9ebf0b9a58043aca2b9d908c3643175ecaf2bdc1 100755
--- a/tests/domainschematest
+++ b/tests/domainschematest
@@ -7,7 +7,7 @@
DIRS=""
DIRS="$DIRS domainschemadata qemuxml2argvdata sexpr2xmldata"
DIRS="$DIRS xmconfigdata xml2sexprdata qemuxml2xmloutdata "
-DIRS="$DIRS lxcxml2xmldata"
+DIRS="$DIRS lxcxml2xmldata lxcxml2xmloutdata"
SCHEMA="domain.rng"
check_schema "$DIRS" "$SCHEMA"
diff --git a/tests/lxcxml2xmldata/lxc-filesystem-ram.xml b/tests/lxcxml2xmldata/lxc-filesystem-ram.xml
new file mode 100644
index 0000000000000000000000000000000000000000..002fde6ad1539eda326cba0141d41dc2718f650f
--- /dev/null
+++ b/tests/lxcxml2xmldata/lxc-filesystem-ram.xml
@@ -0,0 +1,33 @@
+
+ demo
+ 8369f1ac-7e46-e869-4ca5-759d51478066
+ 500000
+ 500000
+ 1
+
+ exe
+ /bin/sh
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/libexec/libvirt_lxc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml b/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d2369a25d1ca9d8eacc2e0969a3da34838294d0d
--- /dev/null
+++ b/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml
@@ -0,0 +1,33 @@
+
+ demo
+ 8369f1ac-7e46-e869-4ca5-759d51478066
+ 500000
+ 500000
+ 1
+
+ exe
+ /bin/sh
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/libexec/libvirt_lxc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index ca05d291f755d4e79595995f7dffad1eb7e40ce3..f8b5959e2162f7133a22183464e126f7a09d8729 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -131,6 +131,7 @@ mymain(void)
DO_TEST("systemd");
DO_TEST("hostdev");
DO_TEST("disk-formats");
+ DO_TEST_DIFFERENT("filesystem-ram");
virObjectUnref(caps);
virObjectUnref(xmlopt);