From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 2bdf957..408499a 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1447,9 +1447,17 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
VIR_DEBUG("usage=%lld sec=%s", fs->usage, sec_mount_options);
- if (virAsprintf(&data,
- "size=%lld%s", fs->usage, sec_mount_options) < 0)
- goto cleanup;
+ if (fs->usage_percentage) {
+ VIR_DEBUG("use percentage limit for tmpfs");
+ if (virAsprintf(&data,
+ "size=%lld%%%s", fs->usage, sec_mount_options) <
0)
+ goto cleanup;
+ } else {
+ VIR_DEBUG("use size limit for tmpfs");
+ if (virAsprintf(&data,
+ "size=%lld%s", fs->usage, sec_mount_options) <
0)
+ goto cleanup;
+ }
if (virFileMakePath(fs->dst) < 0) {
virReportSystemError(errno,
--
1.8.2.1