Skip to contentSkip to conversation

meta-virtualization][PATCH 0/3] lxc: uprev to v3.0.0

PATCH New Mark Asselstine 2 participants 5 messages May 31, 2018 – Jun 4, 2018

lore
Share & tools
lore
#0 lore raw

The following brings us up to date with the latest upstream release of lxc. Actually we get 3 things in this series.
1. an uprev to v3.0.0
2. working 'busybox' template (though I recommend you don't use it, it is used for ptest but it is pretty useless otherwise).
3. updated ptest approach

This will break meta-overc so I will follow up with one or more commits there which should be merged at the same time as this to avoid breaking OverC builds.

Mark

#1 lore raw

PATCH 1/3 lxc: uprev to v3.0.0

Update to the latest lxc release. This requires some minor patch updates (fuzz and offset, not content) along with dropping a no longer needed fix for gcc7 (gcc 7.3 is everywhere and is patched).

The ptests were already busted before the uprev so I was not able to run them but I will follow up with a fix for this. I did run against our usual usecases 'lxc-create', 'lxc-console', 'lxc-ls', 'lxc-destroy', 'lxc-start', 'lxc-execute', 'lxc-attach'... and there were no issues (outcomes matched v2.0.8).

---
 .../files/cgroups-work-around-issue-in-gcc-7.patch | 34 ----------------------
 ...ally-use-base-filenames-to-report-src-fil.patch |  8 ++---
 ...1.0.0-disable-udhcp-from-busybox-template.patch |  6 ++--
 .../lxc/{lxc_2.0.8.bb => lxc_3.0.0.bb}             |  5 ++--
 4 files changed, 9 insertions(+), 44 deletions(-)
 delete mode 100644 recipes-containers/lxc/files/cgroups-work-around-issue-in-gcc-7.patch
 rename recipes-containers/lxc/{lxc_2.0.8.bb => lxc_3.0.0.bb} (97%)
recipes-containers/lxc/files/cgroups-work-around-issue-in-gcc-7.patch deleted +0 -34
deleted file mode 100644
index 90740fb..0000000
@@ -1,34 +0,0 @@
-From 58a2d817a82100d287c60c63315d81445cdba3f9 Mon Sep 17 00:00:00 2001
-From: Mark Asselstine <[email protected]>
-Date: Thu, 15 Jun 2017 15:12:08 -0400
-Subject: [PATCH] cgroups: work around issue in gcc 7
-
-This works around
-https://bugzilla.yoctoproject.org/show_bug.cgi?id=11672
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78969
-
-By removing a single cgroup entry. For the majority of usecases this
-loss of a single entry should not be an issue and once gcc 7 is fixed
-we can revert this.
-
-Signed-off-by: Mark Asselstine <[email protected]>
----
- src/lxc/cgroups/cgfsng.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
-index ebd548b..c520abd 100644
---- a/src/lxc/cgroups/cgfsng.c
-+++ b/src/lxc/cgroups/cgfsng.c
-@@ -1373,7 +1373,7 @@ static inline bool cgfsng_create(void *hdata)
- 	offset = cgname + len - 5;
- 
- again:
--	if (idx == 1000) {
-+	if (idx == 999) {
- 		ERROR("Too many conflicting cgroup names");
- 		goto out_free;
- 	}
--- 
-2.7.4
-
recipes-containers/lxc/files/logs-optionally-use-base-filenames-to-report-src-fil.patch +4 -4
index 583b6f1..f430601 100644
@@ -31,9 +31,9 @@ diff --git a/configure.ac b/configure.ac
 index deba90b..c1ed67b 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -357,6 +357,15 @@ AM_COND_IF([ENABLE_PYTHON],
- 	PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
- 	AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
+@@ -356,6 +356,15 @@ AM_COND_IF([ENABLE_PYTHON],
+ 	[], [enable_examples=yes])
+ AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
  
 +# Enable basenames in the logs for source files
 +AC_ARG_ENABLE([log-src-basename],
@@ -51,7 +51,7 @@ diff --git a/src/lxc/log.h b/src/lxc/log.h
 index 76bd4df..4365977 100644
 --- a/src/lxc/log.h
 +++ b/src/lxc/log.h
-@@ -74,8 +74,13 @@ struct lxc_log_locinfo {
+@@ -77,8 +77,13 @@ struct lxc_log_locinfo {
  	int		line;
  };
  
recipes-containers/lxc/files/lxc-1.0.0-disable-udhcp-from-busybox-template.patch +3 -3
index 723be27..07a12ff 100644
@@ -11,14 +11,14 @@ diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
 index cb425ec..bb8c951 100644
 --- a/templates/lxc-busybox.in
 +++ b/templates/lxc-busybox.in
-@@ -84,7 +84,6 @@ EOF
+@@ -111,7 +111,6 @@ EOF
  #!/bin/sh
  /bin/syslogd
  /bin/mount -a
 -/bin/udhcpc
  EOF
  
-     # executable
--- 
+   # executable
+---
 1.7.11.7
 
recipes-containers/lxc/lxc_3.0.0.bb renamed from recipes-containers/lxc/lxc_2.0.8.bb +2 -3
similarity index 97%
rename from recipes-containers/lxc/lxc_2.0.8.bb
rename to recipes-containers/lxc/lxc_3.0.0.bb
index 46fa9a7..7158d0a 100644
@@ -40,13 +40,12 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
 	file://lxc-fix-B-S.patch \
 	file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
 	file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
-	file://cgroups-work-around-issue-in-gcc-7.patch \
 	file://dnsmasq.conf \
 	file://lxc-net \
 	"
 
-SRC_URI[md5sum] = "7bfd95280522d7936c0979dfea92cdb5"
-SRC_URI[sha256sum] = "0d8e34b302cfe4c40c6c9ae5097096aa5cc2c1dfceea3f0f22e3e16c4a4e8494"
+SRC_URI[md5sum] = "ca1db4f9dc35df9203a58ab606cdfb7a"
+SRC_URI[sha256sum] = "6230224c27f050201b372b18a9f39cd220ed584899c5f0cf73c6b313dabc8d8a"
 
 S = "${WORKDIR}/${BPN}-${PV}"
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 lxc: fixup 'download' template use

In reply to Mark Asselstine

We have a new dependency on 'mountpoint' which is now called in the download template script. We also hit an upstream bug due to improper use of 'mktemp', so we apply a patch to fix this and sent the fix upstream as well.

---
 ...s-actually-create-DOWNLOAD_TEMP-directory.patch | 39 ++++++++++++++++++++++
 recipes-containers/lxc/lxc_3.0.0.bb                |  2 ++
 2 files changed, 41 insertions(+)
 create mode 100644 recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch
recipes-containers/lxc/files/templates-actually-create-DOWNLOAD_TEMP-directory.patch new file +39 -0
new file mode 100644
index 0000000..359f662
@@ -0,0 +1,39 @@
+From 1d83b86a9bf017257c068c662ec3bf52ec0cfe90 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <[email protected]>
+Date: Thu, 31 May 2018 16:21:45 -0400
+Subject: [PATCH] templates: actually create DOWNLOAD_TEMP directory
+
+The way 'mktemp' is currently used you will get a temp directory in
+$TMPDIR or '/tmp' and DOWNLOAD_TEMP will not be pointing to an actual
+directory. This will result in the wget operations failing and the
+container will fail to create:
+
+    ERROR: Failed to download http://....
+
+Instead we want to use the '-p' option for mktemp to set the base path
+and this will ensure that the temp directory is created in the correct
+location and DOWNLOAD_TEMP will be consistent with this location.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Asselstine <[email protected]>
+---
+ templates/lxc-download.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/templates/lxc-download.in b/templates/lxc-download.in
+index f875183..5f1138c 100644
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -320,7 +320,7 @@ fi
+ if ! command -V mktemp >/dev/null 2>&1; then
+   DOWNLOAD_TEMP="${DOWNLOAD_TEMP}/tmp/lxc-download.$$"
+ else
+-  DOWNLOAD_TEMP="${DOWNLOAD_TEMP}$(mktemp -d)"
++  DOWNLOAD_TEMP="$(mktemp -p ${DOWNLOAD_TEMP} -d)"
+ fi
+ 
+ # Simply list images
+-- 
+2.7.4
+
recipes-containers/lxc/lxc_3.0.0.bb +2 -0
index 7158d0a..762a312 100644
@@ -24,6 +24,7 @@ RDEPENDS_${PN} = " \
 		libidn \
 		gnutls \
 		nettle \
+		util-linux-mountpoint \
 "
 
 RDEPENDS_${PN}_append_libc-glibc = " glibc-utils"
@@ -40,6 +41,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
 	file://lxc-fix-B-S.patch \
 	file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
 	file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
+	file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \
 	file://dnsmasq.conf \
 	file://lxc-net \
 	"
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 lxc: use compiled tests instead of copying source building on target

In reply to Mark Asselstine

The tests are already built when we do_compile so we only need to copy them to the ptest path and create a wrapper script to run them. This has the added benefit of reducing the size of the lxc package.

We have to manipulate the test sources some to remove gpg validation and a few other minor changes, none of which actually change what is being tested (notes are provided in the associated commit logs).

The following are the ptest results currently acheived:

### Starting LXC ptest ###
./tests/lxc-test-api-reboot FAIL
./tests/lxc-test-apparmor SKIPPED
./tests/lxc-test-attach PASS
./tests/lxc-test-automount PASS
./tests/lxc-test-autostart PASS
./tests/lxc-test-cgpath PASS
./tests/lxc-test-cloneconfig PASS
./tests/lxc-test-clonetest PASS
./tests/lxc-test-concurrent PASS
./tests/lxc-test-config-jump-table PASS
./tests/lxc-test-console PASS
./tests/lxc-test-console-log PASS
./tests/lxc-test-containertests PASS
./tests/lxc-test-createconfig PASS
./tests/lxc-test-createtest PASS
./tests/lxc-test-criu-check-feature PASS
./tests/lxc-test-destroytest PASS
./tests/lxc-test-device-add-remove PASS
./tests/lxc-test-get_item PASS
./tests/lxc-test-getkeys PASS
./tests/lxc-test-list PASS
./tests/lxc-test-locktests PASS
./tests/lxc-test-lxcpath PASS
./tests/lxc-test-may-control PASS
./tests/lxc-test-no-new-privs PASS
./tests/lxc-test-parse-config-file PASS
./tests/lxc-test-raw-clone PASS
./tests/lxc-test-reboot PASS
./tests/lxc-test-rootfs PASS
./tests/lxc-test-saveconfig PASS
./tests/lxc-test-share-ns PASS
./tests/lxc-test-shortlived PASS
./tests/lxc-test-shutdowntest SKIPPED
./tests/lxc-test-snapshot PASS
./tests/lxc-test-startone PASS
./tests/lxc-test-state-server SKIPPED
./tests/lxc-test-utils PASS

Results:
PASSED = 33
FAILED = 1
SKIPPED = 3
(for details check individual test log in ./logs directory)

### LXC ptest complete ###

---
 .../automake-ensure-VPATH-builds-correctly.patch   | 26 -------
 recipes-containers/lxc/files/run-ptest             | 57 +++++++++++++-
 recipes-containers/lxc/files/runtest.patch         | 32 --------
 ...ke-busybox-template-compatible-with-core-.patch | 59 +++++++++++++++
 ...-no-validate-when-using-download-template.patch | 87 ++++++++++++++++++++++
 .../lxc/files/tests-our-init-is-not-busybox.patch  | 31 ++++++++
 recipes-containers/lxc/lxc_3.0.0.bb                | 13 ++--
 7 files changed, 239 insertions(+), 66 deletions(-)
 delete mode 100644 recipes-containers/lxc/files/automake-ensure-VPATH-builds-correctly.patch
 delete mode 100644 recipes-containers/lxc/files/runtest.patch
 create mode 100644 recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch
 create mode 100644 recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch
 create mode 100644 recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch
recipes-containers/lxc/files/automake-ensure-VPATH-builds-correctly.patch deleted +0 -26
deleted file mode 100644
index 61c0e29..0000000
@@ -1,26 +0,0 @@
-From fe23085d9a40d6d78387d9ce8ddb65785fe8d6e5 Mon Sep 17 00:00:00 2001
-From: Bogdan Purcareata <[email protected]>
-Date: Thu, 2 Oct 2014 18:31:50 -0400
-Subject: [PATCH] automake: ensure VPATH builds correctly
-
-Signed-off-by: Bogdan Purcareata <[email protected]>
----
- src/tests/Makefile.am |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
-index d74c10d..6225f78 100644
---- a/src/tests/Makefile.am
-+++ b/src/tests/Makefile.am
-@@ -66,7 +66,7 @@ buildtest-TESTS: $(TESTS)
- install-ptest:
- 	install -d $(TEST_DIR)
- 	install -D ../lxc/.libs/liblxc.so $(TEST_DIR)/../lxc/liblxc.so
--	install -D ../../config/test-driver $(TEST_DIR)/../../config/test-driver
-+	install -D $(top_srcdir)/config/test-driver $(TEST_DIR)/../../config/test-driver
- 	cp Makefile $(TEST_DIR)
- 	@(for file in $(TESTS); do install $$file $(TEST_DIR);  done;)
- 	sed -i 's|^Makefile:|_Makefile:|' $(TEST_DIR)/Makefile
--- 
-1.7.10.4
-
recipes-containers/lxc/files/run-ptest +55 -2

59 lines not on this page · raw message

recipes-containers/lxc/files/runtest.patch deleted +0 -32
deleted file mode 100644
index 6572265..0000000
@@ -1,32 +0,0 @@
-Add install-ptest rule.
-
-Signed-off-by: Mihaela Sendrea <[email protected]>
-Upstream-status: Pending
-
-diff -uNr a/src/tests/Makefile.am b/src/tests/Makefile.am
---- a/src/tests/Makefile.am	2014-04-07 16:25:59.246238815 +0300
-+++ b/src/tests/Makefile.am	2014-04-10 18:09:43.195772467 +0300
-@@ -54,6 +54,23 @@
- 
- endif
- 
-+TESTS = lxc-test-containertests lxc-test-locktests \
-+        lxc-test-getkeys lxc-test-lxcpath lxc-test-cgpath lxc-test-console \
-+        lxc-test-snapshot lxc-test-concurrent lxc-test-may-control \
-+        lxc-test-reboot lxc-test-list lxc-test-attach lxc-test-device-add-remove
-+
-+buildtest-TESTS: $(TESTS)
-+
-+install-ptest:
-+	install -d $(TEST_DIR)
-+	install -D ../lxc/.libs/liblxc.so $(TEST_DIR)/../lxc/liblxc.so
-+	install -D ../../config/test-driver $(TEST_DIR)/../../config/test-driver
-+	cp Makefile $(TEST_DIR)
-+	@(for file in $(TESTS); do install $$file $(TEST_DIR);  done;)
-+	sed -i 's|^Makefile:|_Makefile:|' $(TEST_DIR)/Makefile
-+	sed -i 's|^all-am:|_all-am:|' $(TEST_DIR)/Makefile
-+	sed -i -e 's|^\(.*\.log:\) \(.*EXEEXT.*\)|\1|g' $(TEST_DIR)/Makefile
-+
- EXTRA_DIST = \
- 	cgpath.c \
- 	clonetest.c \
recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch new file +59 -0

59 lines not on this page · raw message

recipes-containers/lxc/files/tests-add-no-validate-when-using-download-template.patch new file +87 -0

87 lines not on this page · raw message

recipes-containers/lxc/files/tests-our-init-is-not-busybox.patch new file +31 -0
new file mode 100644
index 0000000..4c9bf65
@@ -0,0 +1,31 @@
+From b53169dc4c53f9ef64f8cb06dd9af97182577698 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <[email protected]>
+Date: Thu, 31 May 2018 15:00:34 -0400
+Subject: [PATCH] tests: our init is not busybox
+
+Since we are using 'bash' as the init (see our updates to the busybox
+template) we can't compare '/sbin/init' and 'busybox'. Actually we are
+really only interested in the fact 'cmp' is being run and not the
+result, so simplify by comparing '/sbin/init' to itself.
+
+Signed-off-by: Mark Asselstine <[email protected]>
+---
+ src/tests/attach.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tests/attach.c b/src/tests/attach.c
+index 2c77127..1c182d6 100644
+--- a/src/tests/attach.c
++++ b/src/tests/attach.c
+@@ -251,7 +251,7 @@ static int test_attach_cmd(struct lxc_container *ct)
+ {
+ 	int ret;
+ 	pid_t pid;
+-	char *argv[] = {"cmp", "-s", "/sbin/init", "/bin/busybox", NULL};
++	char *argv[] = {"cmp", "-s", "/sbin/init", "/sbin/init", NULL};
+ 	lxc_attach_command_t command = {"cmp", argv};
+ 	lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
+ 
+-- 
+2.7.4
+
recipes-containers/lxc/lxc_3.0.0.bb +7 -6
index 762a312..4f7526b 100644
@@ -29,19 +29,20 @@ RDEPENDS_${PN} = " \
 
 RDEPENDS_${PN}_append_libc-glibc = " glibc-utils"
 
-RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash"
+RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash libgcc"
 
 RDEPENDS_${PN}-networking += "iptables"
 
 SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
 	file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \
-	file://runtest.patch \
 	file://run-ptest \
-	file://automake-ensure-VPATH-builds-correctly.patch \
 	file://lxc-fix-B-S.patch \
 	file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
 	file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
 	file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \
+	file://template-make-busybox-template-compatible-with-core-.patch \
+	file://tests-our-init-is-not-busybox.patch \
+	file://tests-add-no-validate-when-using-download-template.patch \
 	file://dnsmasq.conf \
 	file://lxc-net \
 	"
@@ -116,8 +117,6 @@ FILES_${PN}-networking += " \
     ${sysconfdir}/default/lxc-net \
 "
 
-PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1"
-
 CACHED_CONFIGUREVARS += " \
     ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \
     am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \
@@ -159,7 +158,9 @@ do_install_append() {
 EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests"
 
 do_install_ptest() {
-	oe_runmake -C src/tests install-ptest
+	# Move tests to the "ptest directory"
+	install -d ${D}/${PTEST_PATH}/tests
+	mv ${D}/usr/bin/lxc-test-* ${D}/${PTEST_PATH}/tests/.
 }
 
 pkg_postinst_${PN}() {
Signature · 1 line
2.7.4
#4 lore raw
In reply to Mark Asselstine

merged

Bruce

Quoted 19 lines · Mark Asselstine

The following brings us up to date with the latest upstream release of lxc. Actually we get 3 things in this series.
1. an uprev to v3.0.0
2. working 'busybox' template (though I recommend you don't use it, it is used for ptest but it is pretty useless otherwise).
3. updated ptest approach

This will break meta-overc so I will follow up with one or more commits there which should be merged at the same time as this to avoid breaking OverC builds.

Mark
--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"