[PATCH v2 07/11] Adding memtunables to libvirt-lxc command

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

 



From: Nikunj A. Dadhania <nikunj@xxxxxxxxxxxxxxxxxx>

libvirt-lxc now configures the hardlimit, softlimit and swaplimit, if
specified in the domain xml file or picks up the defaults.

Signed-off-by: Nikunj A. Dadhania <nikunj@xxxxxxxxxxxxxxxxxx>
---
 src/lxc/lxc_controller.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 82ecce0..dee99b7 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -109,6 +109,28 @@ static int lxcSetContainerResources(virDomainDefPtr def)
                              def->name);
         goto cleanup;
     }
+    
+    rc = virCgroupSetMemoryHardLimit(cgroup, def->mem.hard_limit);
+    if (rc != 0) {
+        virReportSystemError(-rc,
+                             _("Unable to set memory hard limit for domain %s"),
+                             def->name);
+        goto cleanup;
+    }
+    rc = virCgroupSetMemorySoftLimit(cgroup, def->mem.soft_limit);
+    if (rc != 0) {
+        virReportSystemError(-rc,
+                             _("Unable to set memory soft limit for domain %s"),
+                             def->name);
+        goto cleanup;
+    }
+    rc = virCgroupSetSwapHardLimit(cgroup, def->mem.swap_hard_limit);
+    if (rc != 0) {
+        virReportSystemError(-rc,
+                             _("Unable to set swap hard limit for domain %s"),
+                             def->name);
+        goto cleanup;
+    }
 
     rc = virCgroupDenyAllDevices(cgroup);
     if (rc != 0) {

--
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]