get_new_nicname() calls lxc_mkifname() which allocates memory and returns it to
the caller. The way get_new_nicname() and get_nic_if_avail() were implemented
they hid that fact by returning a boolean. That doesn't make sense. Let's
rather have them return a pointer to the allocated nic name which the caller
needs to free.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Say we have
lxc.uts.name = c1
lxc.cgroup.dir = lxd/a/b/c
the path for the container's cgroup would be
lxd/a/b/c/c1
When the container is shutdown we should not just try to delete "c1" we should
also try to delete "c", "b", "a", and "lxd". This is to ensure that we don't
leave empty cgroups around thereby increasing the chance that we run into
trouble with cgroup limits. The algorithm for this isn't too costly since we
can simply stop walking upwards at the first rmdir() failure.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Say we have
lxc.uts.name = c1
lxc.cgroup.dir = lxd
the actual path should be
lxd/c1
Right now it would just be
lxd
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
So far, when creating veth devices attached to openvswitch bridges we used to
fork() off a thread on container startup. This thread was kept around until the
container shut down. I have no good explanation why we did it that why but it's
certainly not necessary. Instead, let's fork() off the thread on container
shutdown to delete the veth.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
"lxc.cgroup.dir" can be used to set the name of the directory the container's
cgroup will be created in. For example, setting
lxc.uts.name = c1
lxc.cgroup.dir = lxd
would make liblxc create the cgroup
lxd/c1
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Surfaced while building lxc-2.0.8 on e2k architecture with lcc,
looks like its -Wall is more pedantic than gcc's:
lcc: "conf.c", line 1514: error: unrecognized character escape sequence
[-Werror]
DEBUG("created directory for console and tty devices at \%s\"", path);
^
in expansion of macro "DEBUG" at line 1514
Another byte is a leading whitespace fix while at that.
Signed-off-by: Michael Shigorin <mike@altlinux.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
- list all cgroup v1 mountpoints
- list all cgroup v2 mountpoints
- report "missing" when no mountpoint for the systemd controller was found
- report "missing" when no mountpoint for the freezer controller was found
Closes https://github.com/lxc/lxd/issues/3687.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
- handle lxc.net.<idx> keys without any subkey
- allow caller to pass NULL if caller doesn't need to retrieve deindexed key
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>