summaryrefslogtreecommitdiffstats
path: root/tests/libcg_ba.cpp
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-17 16:06:20 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-05-17 16:06:20 +0000
commitc74b7e334e27928cbfeee489adcc7c25d2efb369 (patch)
treecff552e79ff35f7c2388c5815a054a3abe8e76cd /tests/libcg_ba.cpp
parent283955a35cef907323348a74ba9e58e342e2d56d (diff)
downloadlibcg-c74b7e334e27928cbfeee489adcc7c25d2efb369.tar.gz
libcg-c74b7e334e27928cbfeee489adcc7c25d2efb369.tar.xz
libcg-c74b7e334e27928cbfeee489adcc7c25d2efb369.zip
Multiple mount point support. Patches built on top of Dhaval'a patches.
Works for me on my testing. NOTE: The testing is insufficient as we only test cg_control_create_cgroup() and not delete_cgroup() or attach_task(). Sudhir's new test cases should really help Several coding style fixes and changes, enhancements to make the code work. NOTE: Since this is development release -DDEBUG is back in the makefile. Once this is committed, I'll bump up the version to 0.05 if no one objects. Test report ----------- debug log from the library matched cpuacct:cpuacct Found cgroup option rw,relatime,cpuacct, count 0 matched cpu:cpu Found cgroup option rw,relatime,cpu, count 1 tuid 0, tgid 0, cuid 1000, cgid 1000 path is /tmp/container_cpu/database/ path is /tmp/container_cpuacct/database/ NOTE: The database directory was created as expected on both mount points /tmp/container_cpu and /tmp/container_cpuacct balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpuacct/ total 424 drwxrwxrwt 5 root root 0 2008-05-17 21:27 . drwxrwxrwt 32 root root 425984 2008-05-17 21:26 .. drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1 drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2 -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpuacct.usage drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database -rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release -rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable -rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent -rwxrwxrwx 1 root root 0 2008-05-17 17:09 tasks balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpu total 424 drwxrwxrwt 5 root root 0 2008-05-17 21:27 . drwxrwxrwt 32 root root 425984 2008-05-17 21:26 .. drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1 drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2 -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.rt_runtime_us -rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.shares drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database -rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release -rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable -rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent -rwxrwxrwx 1 root root 0 2008-05-17 21:10 tasks Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@30 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests/libcg_ba.cpp')
-rw-r--r--tests/libcg_ba.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/libcg_ba.cpp b/tests/libcg_ba.cpp
index b8df520..967b1ff 100644
--- a/tests/libcg_ba.cpp
+++ b/tests/libcg_ba.cpp
@@ -22,6 +22,8 @@ using namespace std;
#include <sys/types.h>
#include <pwd.h>
#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
namespace cgtest {
@@ -91,6 +93,20 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid,
calloc(1, sizeof(struct control_value));
strcpy(ccg->controller[0]->values[0]->name,"cpu.shares");
strcpy(ccg->controller[0]->values[0]->value, "100");
+
+ ccg->controller[1] = (struct controller *)
+ calloc(1, sizeof(struct controller));
+ strcpy(ccg->controller[1]->name, "memory");
+ ccg->controller[1]->values[0] = (struct control_value *)
+ calloc(1, sizeof(struct control_value));
+ strcpy(ccg->controller[1]->values[0]->name,"memory.limit_in_bytes");
+ strcpy(ccg->controller[1]->values[0]->value, "102400");
+
+ strcpy(ccg->controller[2]->name, "cpuacct");
+ ccg->controller[2]->values[0] = (struct control_value *)
+ calloc(1, sizeof(struct control_value));
+ strcpy(ccg->controller[2]->values[0]->name,"cpuacct.usage");
+ strcpy(ccg->controller[2]->values[0]->value, "0");
ccg->tasks_uid = tuid;
ccg->tasks_gid = tgid;
ccg->control_uid = cuid;