Commit 1f845c39 by Dwight Engen Committed by Stéphane Graber

fix cgpath test

Commit 1ea59ad2 sets memory.use_hierarchy, which means that this test cannot use memory.swappiness as its dummy cgroup item to set/unset since writing to it with use_hierarchy set gets -EINVAL. Change test to use memory.soft_limit_in_bytes instead. Signed-off-by: 's avatarDwight Engen <dwight.engen@oracle.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 50266dc6
......@@ -74,8 +74,8 @@ static int test_running_container(const char *lxcpath,
goto err3;
}
/* test get/set value using memory.swappiness file */
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
/* test get/set value using memory.soft_limit_in_bytes file */
ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_get failed");
......@@ -83,39 +83,30 @@ static int test_running_container(const char *lxcpath,
}
strcpy(value_save, value);
ret = lxc_cgroup_set("memory.swappiness", "100", c->name, c->config_path);
ret = lxc_cgroup_set("memory.soft_limit_in_bytes", "512M", c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_set_bypath failed");
TSTERR("lxc_cgroup_set failed %d %d", ret, errno);
getchar();
goto err3;
}
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_get failed");
goto err3;
}
if (strcmp(value, "100\n")) {
if (strcmp(value, "536870912\n")) {
TSTERR("lxc_cgroup_set_bypath failed to set value >%s<", value);
goto err3;
}
/* restore original value */
ret = lxc_cgroup_set("memory.swappiness", value_save,
ret = lxc_cgroup_set("memory.soft_limit_in_bytes", value_save,
c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_set failed");
goto err3;
}
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_get failed");
goto err3;
}
if (strcmp(value, value_save)) {
TSTERR("lxc_cgroup_set failed to set value >%s<", value);
goto err3;
}
cgabspath = lxc_cgroup_path_get("freezer", c->name, c->config_path);
if (!cgabspath) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment