Browse Source

lxc: bump to 1.1.1

Signed-off-by: Mario Halambek <mario.halambek@sartura.hr>
Mario Halambek 10 years ago
parent
commit
268dd7c603

+ 2
- 2
utils/lxc/Makefile View File

@@ -8,7 +8,7 @@
8 8
 include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=lxc
11
-PKG_VERSION:=1.1.0
11
+PKG_VERSION:=1.1.1
12 12
 PKG_RELEASE:=1
13 13
 
14 14
 PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0
@@ -16,7 +16,7 @@ PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
16 16
 
17 17
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 18
 PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/lxc/
19
-PKG_MD5SUM:=ab1cbabf859abc15165050c854979c5c
19
+PKG_MD5SUM:=d80cb08f0edf36f0887e32c96aec8c13
20 20
 
21 21
 PKG_BUILD_DEPENDS:=lua
22 22
 PKG_BUILD_PARALLEL:=1

+ 43
- 0
utils/lxc/patches/030-lxc-download.patch View File

@@ -0,0 +1,43 @@
1
+--- a/templates/lxc-download.in
2
++++ b/templates/lxc-download.in
3
+@@ -39,7 +39,7 @@ DOWNLOAD_LIST_IMAGES="false"
4
+ DOWNLOAD_MODE="system"
5
+ DOWNLOAD_READY_GPG="false"
6
+ DOWNLOAD_RELEASE=
7
+-DOWNLOAD_SERVER="images.linuxcontainers.org"
8
++DOWNLOAD_SERVER="virtualwrt.org/containers/"
9
+ DOWNLOAD_SHOW_GPG_WARNING="true"
10
+ DOWNLOAD_SHOW_HTTP_WARNING="true"
11
+ DOWNLOAD_TARGET="system"
12
+@@ -257,14 +257,6 @@ for bin in tar xz wget; do
13
+     fi
14
+ done
15
+ 
16
+-# Check for GPG
17
+-if [ "$DOWNLOAD_VALIDATE" = "true" ]; then
18
+-    if ! type gpg >/dev/null 2>&1; then
19
+-        echo "ERROR: Missing recommended tool: gpg" 1>&2
20
+-        echo "You can workaround this by using --no-validate." 1>&2
21
+-        exit 1
22
+-    fi
23
+-fi
24
+ 
25
+ # Check that we have all variables we need
26
+ if [ -z "$LXC_NAME" ] || [ -z "$LXC_PATH" ] || [ -z "$LXC_ROOTFS" ]; then
27
+@@ -456,16 +448,9 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ];
28
+         echo "Downloading the rootfs"
29
+         download_file $DOWNLOAD_URL/rootfs.tar.xz \
30
+             ${DOWNLOAD_TEMP}/rootfs.tar.xz normal
31
+-        download_sig  $DOWNLOAD_URL/rootfs.tar.xz.asc \
32
+-             ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc normal
33
+-        gpg_validate ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc
34
+-
35
+         echo "Downloading the metadata"
36
+         download_file $DOWNLOAD_URL/meta.tar.xz \
37
+             ${DOWNLOAD_TEMP}/meta.tar.xz normal
38
+-        download_sig  $DOWNLOAD_URL/meta.tar.xz.asc \
39
+-            ${DOWNLOAD_TEMP}/meta.tar.xz.asc normal
40
+-        gpg_validate ${DOWNLOAD_TEMP}/meta.tar.xz.asc
41
+ 
42
+         if [ -d $LXC_CACHE_PATH ]; then
43
+             rm -Rf $LXC_CACHE_PATH

+ 0
- 48
utils/lxc/patches/300-fix-lxc-destroy.patch View File

@@ -1,48 +0,0 @@
1
-From bdeafb7bc4857e80dbca5192a751eedcf7b69abd Mon Sep 17 00:00:00 2001
2
-From: Luka Perkov <luka@openwrt.org>
3
-Date: Mon, 27 Oct 2014 21:49:46 +0100
4
-Subject: [PATCH] utils: remove unnecessary check of mystat.st_dev
5
-
6
-The check is not needed and it breaks lxc-destroy when container is installed
7
-on top of overlayfs. More information why this is a problem on overlayfs can be
8
-found here:
9
-
10
-https://kernel.googlesource.com/pub/scm/linux/kernel/git/mszeredi/vfs/+/overlayfs.current/Documentation/filesystems/overlayfs.txt
11
-
12
-Signed-off-by: Luka Perkov <luka@openwrt.org>
13
----
14
- src/lxc/utils.c | 10 ++++------
15
- 1 file changed, 4 insertions(+), 6 deletions(-)
16
-
17
---- a/src/lxc/utils.c
18
-+++ b/src/lxc/utils.c
19
-@@ -47,7 +47,7 @@
20
- 
21
- lxc_log_define(lxc_utils, lxc);
22
- 
23
--static int _recursive_rmdir_onedev(char *dirname, dev_t pdev,
24
-+static int _recursive_rmdir_onedev(char *dirname,
25
- 				   const char *exclude, int level)
26
- {
27
- 	struct dirent dirent, *direntp;
28
-@@ -108,10 +108,8 @@ static int _recursive_rmdir_onedev(char
29
- 			failed=1;
30
- 			continue;
31
- 		}
32
--		if (mystat.st_dev != pdev)
33
--			continue;
34
- 		if (S_ISDIR(mystat.st_mode)) {
35
--			if (_recursive_rmdir_onedev(pathname, pdev, exclude, level+1) < 0)
36
-+			if (_recursive_rmdir_onedev(pathname, exclude, level+1) < 0)
37
- 				failed=1;
38
- 		} else {
39
- 			if (unlink(pathname) < 0) {
40
-@@ -147,7 +145,7 @@ extern int lxc_rmdir_onedev(char *path,
41
- 		return -1;
42
- 	}
43
- 
44
--	return _recursive_rmdir_onedev(path, mystat.st_dev, exclude, 0);
45
-+	return _recursive_rmdir_onedev(path, exclude, 0);
46
- }
47
- 
48
- static int mount_fs(const char *source, const char *target, const char *type)

+ 113
- 0
utils/lxc/patches/300-lxc-destroy.patch View File

@@ -0,0 +1,113 @@
1
+One of the 'features' of overlayfs is that depending on whether a file
2
+is on the upper or lower dir you get back a different device from stat.
3
+That breaks our lxc_rmdir_onedev.
4
+
5
+So at lxc_rmdir_ondev check the device of the directory being deleted.
6
+If it is overlayfs, then skip the device check.
7
+
8
+Note this is unrelated to overlayfs snapshots - in those cases when you
9
+delete a container, /var/lib/lxc/$container/ does not actually have an
10
+overlayfs under it.  Rather, to reproduce this you would
11
+
12
+sudo mkdir /opt/{lower,upper,workdir}
13
+sudo mount -t overlayfs -o lower=/opt/lower,upper=/opt/upper,workdir=/opt/workdir \
14
+	lxc /var/lib/lxc
15
+sudo lxc-create -t download -n c1 -- -d ubuntu -r trusty -a amd64
16
+sudo lxc-destroy -n c1
17
+
18
+Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
19
+---
20
+ src/lxc/utils.c | 39 ++++++++++++++++++++++++++++++++-------
21
+ 1 file changed, 32 insertions(+), 7 deletions(-)
22
+
23
+--- a/src/lxc/utils.c
24
++++ b/src/lxc/utils.c
25
+@@ -29,6 +29,7 @@
26
+ #include <stddef.h>
27
+ #include <string.h>
28
+ #include <sys/types.h>
29
++#include <sys/vfs.h>
30
+ #include <sys/stat.h>
31
+ #include <sys/mman.h>
32
+ #include <sys/param.h>
33
+@@ -68,8 +69,8 @@
34
+ 
35
+ lxc_log_define(lxc_utils, lxc);
36
+ 
37
+-static int _recursive_rmdir_onedev(char *dirname, dev_t pdev,
38
+-				   const char *exclude, int level)
39
++static int _recursive_rmdir(char *dirname, dev_t pdev,
40
++			    const char *exclude, int level, bool onedev)
41
+ {
42
+ 	struct dirent dirent, *direntp;
43
+ 	DIR *dir;
44
+@@ -106,7 +107,7 @@ static int _recursive_rmdir_onedev(char
45
+ 			if (ret < 0) {
46
+ 				switch(errno) {
47
+ 				case ENOTEMPTY:
48
+-					INFO("Not deleting snapshots");
49
++					INFO("Not deleting snapshot %s", pathname);
50
+ 					hadexclude = true;
51
+ 					break;
52
+ 				case ENOTDIR:
53
+@@ -129,14 +130,14 @@ static int _recursive_rmdir_onedev(char
54
+ 			failed=1;
55
+ 			continue;
56
+ 		}
57
+-		if (mystat.st_dev != pdev)
58
++		if (onedev && mystat.st_dev != pdev)
59
+ 			continue;
60
+ 		if (S_ISDIR(mystat.st_mode)) {
61
+-			if (_recursive_rmdir_onedev(pathname, pdev, exclude, level+1) < 0)
62
++			if (_recursive_rmdir(pathname, pdev, exclude, level+1, onedev) < 0)
63
+ 				failed=1;
64
+ 		} else {
65
+ 			if (unlink(pathname) < 0) {
66
+-				ERROR("%s: failed to delete %s", __func__, pathname);
67
++				SYSERROR("%s: failed to delete %s", __func__, pathname);
68
+ 				failed=1;
69
+ 			}
70
+ 		}
71
+@@ -158,17 +159,41 @@ static int _recursive_rmdir_onedev(char
72
+ 	return failed ? -1 : 0;
73
+ }
74
+ 
75
++/* we have two different magic values for overlayfs, yay */
76
++#define OVERLAYFS_SUPER_MAGIC 0x794c764f
77
++#define OVERLAY_SUPER_MAGIC 0x794c7630
78
++/*
79
++ * In overlayfs, st_dev is unreliable.  so on overlayfs we don't do
80
++ * the lxc_rmdir_onedev()
81
++ */
82
++static bool is_native_overlayfs(const char *path)
83
++{
84
++	struct statfs sb;
85
++
86
++	if (statfs(path, &sb) < 0)
87
++		return false;
88
++	if (sb.f_type == OVERLAYFS_SUPER_MAGIC ||
89
++			sb.f_type == OVERLAY_SUPER_MAGIC)
90
++		return true;
91
++	return false;
92
++}
93
++
94
+ /* returns 0 on success, -1 if there were any failures */
95
+ extern int lxc_rmdir_onedev(char *path, const char *exclude)
96
+ {
97
+ 	struct stat mystat;
98
++	bool onedev = true;
99
++
100
++	if (is_native_overlayfs(path)) {
101
++		onedev = false;
102
++	}
103
+ 
104
+ 	if (lstat(path, &mystat) < 0) {
105
+ 		ERROR("%s: failed to stat %s", __func__, path);
106
+ 		return -1;
107
+ 	}
108
+ 
109
+-	return _recursive_rmdir_onedev(path, mystat.st_dev, exclude, 0);
110
++	return _recursive_rmdir(path, mystat.st_dev, exclude, 0, onedev);
111
+ }
112
+ 
113
+ static int mount_fs(const char *source, const char *target, const char *type)