summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2018-05-28 09:14:49 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-05-29 10:27:53 -0400
commit52f807ef78e402504f7a0fe764da12ac7462ac84 (patch)
treeaf3ba6fbc09e30997fb4b9ae43124c58ed0bfb51
parent2a30867cff33e715a0aa03cf22e1a755cd44ca33 (diff)
downloadmeta-virtualization-52f807ef78e402504f7a0fe764da12ac7462ac84.tar.gz
lxc: cleanup the lxc-networking package
Adding missing RDEPENDS on iptables, the lxc-net service will fail without this. Use the new 'pkg_postinst_ontarget_' instead of failing out to signal runtime postinst scripts, this conforms with the latest expectation for bitbake. The interfaces file is specific to sysvinit and unneeded for systemd so block the creation of these files only when building for sysvinit. Lastly add a default 'lxc-net' file. Since we have a separate lxc-networking package we can complete it with this configuration which is sourced by '/etc/default/lxc' (which is part of the core lxc package). In doing this we are like Debian when the lxc-networking package is not installed in the image, and like Ubuntu when it is. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-containers/lxc/files/lxc-net9
-rw-r--r--recipes-containers/lxc/lxc_2.0.8.bb24
2 files changed, 24 insertions, 9 deletions
diff --git a/recipes-containers/lxc/files/lxc-net b/recipes-containers/lxc/files/lxc-net
new file mode 100644
index 00000000..1c59b705
--- /dev/null
+++ b/recipes-containers/lxc/files/lxc-net
@@ -0,0 +1,9 @@
1USE_LXC_BRIDGE="true"
2LXC_BRIDGE="lxcbr0"
3LXC_ADDR="10.0.3.1"
4LXC_NETMASK="255.255.255.0"
5LXC_NETWORK="10.0.3.0/24"
6LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
7LXC_DHCP_MAX="253"
8LXC_DHCP_CONFILE=""
9LXC_DOMAIN=""
diff --git a/recipes-containers/lxc/lxc_2.0.8.bb b/recipes-containers/lxc/lxc_2.0.8.bb
index 4473fdd3..46fa9a75 100644
--- a/recipes-containers/lxc/lxc_2.0.8.bb
+++ b/recipes-containers/lxc/lxc_2.0.8.bb
@@ -30,6 +30,8 @@ RDEPENDS_${PN}_append_libc-glibc = " glibc-utils"
30 30
31RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash" 31RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash"
32 32
33RDEPENDS_${PN}-networking += "iptables"
34
33SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ 35SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
34 file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ 36 file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \
35 file://runtest.patch \ 37 file://runtest.patch \
@@ -40,6 +42,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
40 file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ 42 file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
41 file://cgroups-work-around-issue-in-gcc-7.patch \ 43 file://cgroups-work-around-issue-in-gcc-7.patch \
42 file://dnsmasq.conf \ 44 file://dnsmasq.conf \
45 file://lxc-net \
43 " 46 "
44 47
45SRC_URI[md5sum] = "7bfd95280522d7936c0979dfea92cdb5" 48SRC_URI[md5sum] = "7bfd95280522d7936c0979dfea92cdb5"
@@ -107,7 +110,10 @@ FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug"
107FILES_${PN}-templates += "${datadir}/lxc/templates" 110FILES_${PN}-templates += "${datadir}/lxc/templates"
108RDEPENDS_${PN}-templates += "bash" 111RDEPENDS_${PN}-templates += "bash"
109 112
110FILES_${PN}-networking += "${sysconfdir}/init.d/lxc-net" 113FILES_${PN}-networking += " \
114 ${sysconfdir}/init.d/lxc-net \
115 ${sysconfdir}/default/lxc-net \
116"
111 117
112PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1" 118PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1"
113 119
@@ -138,6 +144,11 @@ do_install_append() {
138 rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib 144 rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib
139 fi 145 fi
140 146
147 # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking
148 # is not installed this results in no lxcbr0, but when lxc-networking is installed
149 # lxcbr0 will be fully configured.
150 install -m 644 ${WORKDIR}/lxc-net ${D}${sysconfdir}/default/
151
141 # Force the main dnsmasq instance to bind only to specified interfaces and 152 # Force the main dnsmasq instance to bind only to specified interfaces and
142 # to not bind to virbr0. Libvirt will run its own instance on this interface. 153 # to not bind to virbr0. Libvirt will run its own instance on this interface.
143 install -d ${D}/${sysconfdir}/dnsmasq.d 154 install -d ${D}/${sysconfdir}/dnsmasq.d
@@ -156,14 +167,8 @@ pkg_postinst_${PN}() {
156 fi 167 fi
157} 168}
158 169
159pkg_postinst_${PN}-networking() { 170pkg_postinst_ontarget_${PN}-networking() {
160 if [ "x$D" != "x" ]; then 171if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
161 exit 1
162 fi
163
164 # setup for our bridge
165 echo "lxc.network.link=lxcbr0" >> ${sysconfdir}/lxc/default.conf
166
167cat >> /etc/network/interfaces << EOF 172cat >> /etc/network/interfaces << EOF
168 173
169auto lxcbr0 174auto lxcbr0
@@ -187,4 +192,5 @@ if test "x\$IFACE" = xlxcbr0 ; then
187fi 192fi
188EOF 193EOF
189chmod 755 /etc/network/if-pre-up.d/lxcbr0 194chmod 755 /etc/network/if-pre-up.d/lxcbr0
195fi
190} 196}