Commit Graph

6355 Commits

Author SHA1 Message Date
Serge Hallyn
2e02bbdb03 Merge pull request #1761 from brauner/2017-08-10/further_lxc_2.1_preparations
further lxc 2.1 preparations
2017-08-29 14:57:18 -05:00
Christian Brauner
5965257b6e Merge pull request #1767 from xnox/upstart-ssh
templates/ubuntu: conditionally move upstart ssh job, as it is now op…
2017-08-29 16:52:35 +02:00
Dimitri John Ledkov
4a1bd8d661
templates/ubuntu: conditionally move upstart ssh job, as it is now optional.
Mimic the code from the debian template.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
2017-08-29 15:21:38 +01:00
Christian Brauner
811ef48211
network: non-functional changes
This moves all of the network handling code into network.{c,h}. This makes what
is going on much clearer. Also it's easier to find relevant code if it is all
in one place.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-29 00:30:01 +02:00
Christian Brauner
890928153e
conf: increase lxc-user-nic buffer
This will allow us log more detailed failures.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-29 00:30:01 +02:00
Christian Brauner
8b8e00a24d
lxc-user-nic: check db before trying to delete
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-29 00:30:01 +02:00
Christian Brauner
af25697056 lxc-user-nic: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-29 00:29:59 +02:00
Christian Brauner
a055595ca6 network: delete ovs for unprivileged networks
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-29 00:29:36 +02:00
Stéphane Graber
b7ab9e866f Merge pull request #1763 from brauner/2017-08-28/lxc_2.1_upgrade_script
lxc-update-config: handle legacy networks
2017-08-28 12:00:07 -04:00
Christian Brauner
37694da4b5
lxc-update-config: handle legacy networks
Older instances of liblxc allowed to specify networks like this:

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxdbr0
lxc.network.name= eth0

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxdbr0
lxc.network.name = eth1

Each occurrence of "lxc.network.type" indicated the definition of a new
network. This syntax is not allowed in newer liblxc instances. Instead, network
must carry an index. So in new liblxc these two networks would be translated to:

lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = lxdbr0
lxc.net.0.name= eth0

lxc.net.1.type = veth
lxc.net.1.flags = up
lxc.net.1.link = lxdbr0
lxc.net.1.name = eth1

The update script did not handle this case correctly. It should now.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-28 16:37:18 +02:00
Christian Brauner
7a582518b3
network: log ifindex
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:43 +02:00
Christian Brauner
0cffb6769d
network: send ifindex for unpriv networks
We use the ifindex as an indicator that liblxc created the network so let's
record it for the unprivileged case as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:41 +02:00
Christian Brauner
c92dfebd9e
lxc-user-nic: rework renaming net devices
This should make things a little less convoluted.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:38 +02:00
Christian Brauner
25aead3fdd
conf: adapt to lxc-user-nic usage
- lxc-user-nic gains the subcommands {create,delete}
- dup2() STDERR_FILENO as well so that we can show helpful messages in our logs
  on failure
- initialize output buffer so that we don't print garbage

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:37 +02:00
Christian Brauner
f703d9904a
tests: adapt lxc-user-nic tests to new syntax
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:35 +02:00
Christian Brauner
900e5f94af
lxc-user-nic: add new {create,delete} subcommands
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:33 +02:00
Christian Brauner
8285dcfb50
lxc-user-nic: fix memleak
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>
2017-08-27 17:51:31 +02:00
Christian Brauner
d04e77c34a
lxc-user-nic: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:29 +02:00
Christian Brauner
92c590ae1e
cgfsng: try to delete parent cgroups
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>
2017-08-27 17:51:28 +02:00
Christian Brauner
7d531e9ba4
cgfsng: add container name to lxc.cgroup.dir value
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>
2017-08-27 17:51:26 +02:00
Christian Brauner
a17f8b3f46
cgfsng: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:25 +02:00
Christian Brauner
01b2d1f174
conf: do not deref null pointer
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:23 +02:00
Christian Brauner
89d09707b0
conf: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-27 17:51:19 +02:00
Stéphane Graber
04ba27e0dc Merge pull request #1757 from brauner/2017-08-10/further_lxc_2.1_preparations
further lxc 2.1 preparations
2017-08-25 02:04:18 -04:00
Christian Brauner
6f4f193704
attach: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 07:38:26 +02:00
Christian Brauner
ea0eb48b3c
arguments: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 07:17:20 +02:00
Christian Brauner
77b0073a8c
af_unix: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 07:11:26 +02:00
Christian Brauner
736da9d08d
rtnl: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 07:07:43 +02:00
Christian Brauner
9c538d8a6d
conf: do not check union on wrong net type
This will obviously not work.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:54 +02:00
Christian Brauner
f5c0d3f2cc
conf: refactor network deletion
I'm ashamed at how aweful my previous code was.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:54 +02:00
Christian Brauner
581c75e7f4
openvswitch: delete ports intelligently
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>
2017-08-25 06:35:54 +02:00
Christian Brauner
1efc10652c
conf: log lxc-user-nic output
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:54 +02:00
Christian Brauner
a41162aaaa
conf: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:53 +02:00
Christian Brauner
e771c51d9f
lxc-user-nic: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:53 +02:00
Christian Brauner
ebc73a6772
network: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:53 +02:00
Christian Brauner
cb0dc11bac
network: log cleanup thread pid for openswitch
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:53 +02:00
Christian Brauner
dae8c253db
tests: add tests for lxc.cgroup.dir
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-25 06:35:50 +02:00
Christian Brauner
43654d3475 confile: add "lxc.cgroup.dir"
"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>
2017-08-25 06:35:49 +02:00
Serge Hallyn
0298e6bf0f Merge pull request #1758 from carnil/master
Use deb.debian.org as the default Debian mirror
2017-08-24 11:46:34 -05:00
Salvatore Bonaccorso
d312bb74c2 Use deb.debian.org as the default Debian mirror
The httpredir.debian.org service has been discontinued in favour of
deb.debian.org and httpredir.debian.org now redirects to deb.debian.org.

https://lists.debian.org/debian-mirrors/2017/02/msg00000.html
https://wiki.debian.org/DebianGeoMirror#httpredir.debian.org_.2F_http.debian.net

Cf. https://bugs.debian.org/872719

Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
2017-08-24 14:48:03 +02:00
Christian Brauner
104cd54327
cgroups: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-24 12:45:53 +02:00
Christian Brauner
4742cd9a30
conf: non-functional fixup
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>
2017-08-24 12:45:52 +02:00
Christian Brauner
1a0e70ace8
tree-wide: non-functional changes
- replace all "//" with "/* */"

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-24 12:45:47 +02:00
Serge Hallyn
b3c723c446 Merge pull request #1756 from brauner/2017-08-10/further_lxc_2.1_preparations
further lxc 2.1 preparations
2017-08-22 14:42:31 -05:00
Christian Brauner
d6259d368b
tools: add additional cgroup checks
- 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>
2017-08-22 14:24:42 +02:00
Christian Brauner
25a908b818
confile: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-22 12:43:18 +02:00
Christian Brauner
d5aba46091
confile: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-22 12:19:26 +02:00
Christian Brauner
71acf5d0f4
confile: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-22 12:19:26 +02:00
Christian Brauner
861d1adaae
confile: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-08-22 12:05:55 +02:00
Stéphane Graber
ed07dfa9ee Merge pull request #1755 from brauner/2017-08-10/further_lxc_2.1_preparations
templates: remove legacy key from busybox
2017-08-21 18:36:56 -04:00