Commit 422afdd2 by Michel Normand Committed by Daniel Lezcano

lxc /cgroup/name/ not removed at container end

this is a side effect of my previous patch that removed the LXCPATH/name/nsgroup file. 9f44c578Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent b9f94fc1
...@@ -120,24 +120,25 @@ int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler) ...@@ -120,24 +120,25 @@ int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler)
return ret; return ret;
} }
#warning keep lxc_unlink_nsgroup fct to be able to destroy old created container.
int lxc_unlink_nsgroup(const char *name) int lxc_unlink_nsgroup(const char *name)
{ {
char nsgroup[MAXPATHLEN]; char nsgroup[MAXPATHLEN];
char path[MAXPATHLEN]; char cgroup[MAXPATHLEN];
ssize_t len; int ret;
snprintf(nsgroup, MAXPATHLEN, LXCPATH "/%s/nsgroup", name); if (get_cgroup_mount(MTAB, cgroup)) {
ERROR("cgroup is not mounted");
len = readlink(nsgroup, path, MAXPATHLEN-1); return -1;
if (len > 0) {
path[len] = '\0';
rmdir(path);
} }
DEBUG("unlinking '%s'", nsgroup); snprintf(nsgroup, MAXPATHLEN, "%s/%s", cgroup, name);
ret = rmdir(nsgroup);
if (ret)
SYSERROR("failed to remove cgroup '%s'", nsgroup);
else
DEBUG("'%s' unlinked", nsgroup);
return unlink(nsgroup); return ret;
} }
int lxc_cgroup_path_get(char **path, const char *name) int lxc_cgroup_path_get(char **path, const char *name)
......
...@@ -86,9 +86,12 @@ int lxc_destroy(const char *name) ...@@ -86,9 +86,12 @@ int lxc_destroy(const char *name)
goto out_lock; goto out_lock;
} }
#warning keep access to LXCPATH/<name> to destroy old created container
snprintf(path, MAXPATHLEN, LXCPATH "/%s/init", name); snprintf(path, MAXPATHLEN, LXCPATH "/%s/init", name);
unlink(path); unlink(path);
lxc_unlink_nsgroup(name);
snprintf(path, MAXPATHLEN, LXCPATH "/%s/nsgroup", name);
unlink(path);
if (lxc_unconfigure(name)) { if (lxc_unconfigure(name)) {
ERROR("failed to cleanup %s", name); ERROR("failed to cleanup %s", name);
......
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