[PATCH 2/3] enable percentage limit of RAM filesystem in lxc container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]