From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> --- 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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list