Merge lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203170940 into lp:ubuntu/precise/lxc

Proposed by Ubuntu Package Importer
Status: Rejected
Rejected by: James Westby
Proposed branch: lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203170940
Merge into: lp:ubuntu/precise/lxc
Diff against target: 442 lines (+418/-0) (has conflicts)
4 files modified
.pc/.quilt_patches (+1/-0)
.pc/.quilt_series (+1/-0)
.pc/0059-reenable-daily-cloudimg/templates/lxc-ubuntu-cloud.in (+351/-0)
debian/patches/0059-reenable-daily-cloudimg (+65/-0)
Conflict adding file .pc/0059-reenable-daily-cloudimg.  Moved existing file to .pc/0059-reenable-daily-cloudimg.moved.
Conflict adding file debian/patches/0059-reenable-daily-cloudimg.  Moved existing file to debian/patches/0059-reenable-daily-cloudimg.moved.
To merge this branch: bzr merge lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203170940
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+98046@code.launchpad.net

Description of the change

The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/precise/lxc reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203170940. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
  1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
  2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
  3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.

If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https://bugs.launchpad.net/udd linking to this merge proposal.

(this is an automatically generated message)

To post a comment you must log in.

Unmerged revisions

80. By Stéphane Graber

Re-enable apparmor profile now that the userspace was fixed.
Some part of the profile are still disabled because of missing kernel
or userspace features, see the FIXMEs for these, hopefully fixed soon.

79. By Serge Hallyn

0059-reenable-daily-cloudimg: let user specify daily cloud images.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.pc/.quilt_patches'
--- .pc/.quilt_patches 1970-01-01 00:00:00 +0000
+++ .pc/.quilt_patches 2012-03-17 09:44:19 +0000
@@ -0,0 +1,1 @@
1debian/patches
02
=== added file '.pc/.quilt_series'
--- .pc/.quilt_series 1970-01-01 00:00:00 +0000
+++ .pc/.quilt_series 2012-03-17 09:44:19 +0000
@@ -0,0 +1,1 @@
1series
02
=== added directory '.pc/0059-reenable-daily-cloudimg'
=== renamed directory '.pc/0059-reenable-daily-cloudimg' => '.pc/0059-reenable-daily-cloudimg.moved'
=== added directory '.pc/0059-reenable-daily-cloudimg/templates'
=== added file '.pc/0059-reenable-daily-cloudimg/templates/lxc-ubuntu-cloud.in'
--- .pc/0059-reenable-daily-cloudimg/templates/lxc-ubuntu-cloud.in 1970-01-01 00:00:00 +0000
+++ .pc/0059-reenable-daily-cloudimg/templates/lxc-ubuntu-cloud.in 2012-03-17 09:44:19 +0000
@@ -0,0 +1,351 @@
1#!/bin/bash
2
3# template script for generating ubuntu container for LXC based on released cloud
4# images
5#
6# Copyright © 2012 Serge Hallyn <serge.hallyn@canonical.com>
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License version 2, as
10# published by the Free Software Foundation.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21
22set -e
23
24if [ -r /etc/default/lxc ]; then
25 . /etc/default/lxc
26fi
27
28copy_configuration()
29{
30 path=$1
31 rootfs=$2
32 name=$3
33 arch=$4
34
35 if [ $arch = "i386" ]; then
36 arch="i686"
37 fi
38
39 # if there is exactly one veth network entry, make sure it has an
40 # associated hwaddr.
41 nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l`
42 if [ $nics -eq 1 ]; then
43 grep -q "^lxc.network.hwaddr" $path/config || cat <<EOF >> $path/config
44lxc.network.hwaddr= 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')
45EOF
46 fi
47
48 cat <<EOF >> $path/config
49lxc.utsname = $name
50
51lxc.tty = 4
52lxc.pts = 1024
53lxc.rootfs = $rootfs
54lxc.mount = $path/fstab
55lxc.arch = $arch
56lxc.cap.drop = sys_module mac_admin
57
58lxc.cgroup.devices.deny = a
59# Allow any mknod (but not using the node)
60lxc.cgroup.devices.allow = c *:* m
61lxc.cgroup.devices.allow = b *:* m
62# /dev/null and zero
63lxc.cgroup.devices.allow = c 1:3 rwm
64lxc.cgroup.devices.allow = c 1:5 rwm
65# consoles
66lxc.cgroup.devices.allow = c 5:1 rwm
67lxc.cgroup.devices.allow = c 5:0 rwm
68#lxc.cgroup.devices.allow = c 4:0 rwm
69#lxc.cgroup.devices.allow = c 4:1 rwm
70# /dev/{,u}random
71lxc.cgroup.devices.allow = c 1:9 rwm
72lxc.cgroup.devices.allow = c 1:8 rwm
73lxc.cgroup.devices.allow = c 136:* rwm
74lxc.cgroup.devices.allow = c 5:2 rwm
75# rtc
76lxc.cgroup.devices.allow = c 254:0 rwm
77#fuse
78lxc.cgroup.devices.allow = c 10:229 rwm
79#tun
80lxc.cgroup.devices.allow = c 10:200 rwm
81#full
82lxc.cgroup.devices.allow = c 1:7 rwm
83#hpet
84lxc.cgroup.devices.allow = c 10:228 rwm
85#kvm
86lxc.cgroup.devices.allow = c 10:232 rwm
87EOF
88
89 cat <<EOF > $path/fstab
90proc $rootfs/proc proc nodev,noexec,nosuid 0 0
91sysfs $rootfs/sys sysfs defaults 0 0
92EOF
93
94 return 0
95}
96
97usage()
98{
99 cat <<EOF
100LXC Container configuration for Ubuntu Cloud images.
101
102Generic Options
103[ -r | --release <release> ]: Release name of container, defaults to host
104[ -a | --arch ]: Arhcitecture of container, defaults to host arcitecture
105[ -C | --cloud ]: Configure container for use with meta-data service, defaults to no
106[ -T | --tarball ]: Location of tarball
107[ -d | --debug ]: Run with 'set -x' to debug errors
108
109Options, mutually exclusive of "-C" and "--cloud":
110 [ -i | --hostid ]: HostID for cloud-init, defaults to random string
111 [ -u | --userdata ]: Cloud-init user-data file to configure container on start
112 [ -S | --auth-key ]: SSH Public key file to inject into container
113 [ -L | --nolocales ]: Do not copy host's locales into container
114
115EOF
116 return 0
117}
118
119options=$(getopt -o a:hp:r:n:Fi:CLS:T:d -l arch:,help,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug -- "$@")
120if [ $? -ne 0 ]; then
121 usage $(basename $0)
122 exit 1
123fi
124eval set -- "$options"
125
126release=lucid
127if [ -f /etc/lsb-release ]; then
128 . /etc/lsb-release
129 case "$DISTRIB_CODENAME" in
130 lucid|maverick|natty|oneiric|precise)
131 release=$DISTRIB_CODENAME
132 ;;
133 esac
134fi
135
136arch=$(arch)
137
138# Code taken from debootstrap
139if [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then
140 arch=`/usr/bin/dpkg --print-architecture`
141elif type udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then
142 arch=`/usr/bin/udpkg --print-architecture`
143else
144 arch=$(arch)
145 if [ "$arch" = "i686" ]; then
146 arch="i386"
147 elif [ "$arch" = "x86_64" ]; then
148 arch="amd64"
149 elif [ "$arch" = "armv7l" ]; then
150 # note: arm images don't exist before oneiric; are called armhf in
151 # precise; and are not supported by the query, so we don't actually
152 # support them yet (see check later on). When Query2 is available,
153 # we'll use that to enable arm images.
154 arch="armel"
155 fi
156fi
157
158debug=0
159hostarch=$arch
160cloud=0
161locales=1
162flushcache=0
163while true
164do
165 case "$1" in
166 -h|--help) usage $0 && exit 0;;
167 -p|--path) path=$2; shift 2;;
168 -n|--name) name=$2; shift 2;;
169 -F|--flush-cache) flushcache=1; shift 1;;
170 -r|--release) release=$2; shift 2;;
171 -a|--arch) arch=$2; shift 2;;
172 -i|--hostid) host_id=$2; shift 2;;
173 -u|--userdata) userdata=$2; shift 2;;
174 -C|--cloud) cloud=1; shift 1;;
175 -S|--auth-key) auth_key=$2; shift 2;;
176 -L|--no_locales) locales=0; shift 2;;
177 -T|--tarball) tarball=$2; shift 2;;
178 -d|--debug) debug=1; shift 1;;
179 --) shift 1; break ;;
180 *) break ;;
181 esac
182done
183
184if [ $debug -eq 1 ]; then
185 set -x
186fi
187
188if [ "$arch" == "i686" ]; then
189 arch=i386
190fi
191
192if [ $hostarch = "i386" -a $arch = "amd64" ]; then
193 echo "can't create amd64 container on i386"
194 exit 1
195fi
196
197if [ $arch != "i386" -a $arch != "amd64" ]; then
198 echo "Only i386 and amd64 are supported by the ubuntu cloud template."
199 exit 1
200fi
201
202if [ -z "$path" ]; then
203 echo "'path' parameter is required"
204 exit 1
205fi
206
207if [ "$(id -u)" != "0" ]; then
208 echo "This script should be run as 'root'"
209 exit 1
210fi
211
212rootfs=$path/rootfs
213
214type ubuntu-cloudimg-query
215type wget
216
217# determine the url, tarball, and directory names
218# download if needed
219cache="/var/cache/lxc/cloud-$release"
220
221mkdir -p $cache
222
223if [ -n "$tarball" ]; then
224 url2="$tarball"
225else
226 url1=`ubuntu-cloudimg-query $release released $arch --format "%{url}\n"`
227 url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/'`
228fi
229
230filename=`basename $url2`
231
232buildcleanup()
233{
234 cd $rootfs
235 umount -l $cache/$xdir || true
236 rm -rf $cache
237}
238
239# if the release doesn't have a *-rootfs.tar.gz, then create one from the
240# cloudimg.tar.gz by extracting the .img, mounting it loopback, and creating
241# a tarball from the mounted image.
242build_root_tgz()
243{
244 url=$1
245 filename=$2
246
247 xdir=`mktemp -d -p .`
248 tarname=`basename $url`
249 imgname="`basename $tarname .tar.gz`.img"
250 trap buildcleanup EXIT
251 if [ $flushcache -eq 1 -o ! -f $cache/$tarname ]; then
252 rm -f $tarname
253 echo "Downloading cloud image from $url"
254 wget $url || { echo "Couldn't find cloud image $url."; exit 1; }
255 fi
256 echo "Creating new cached cloud image rootfs"
257 tar zxf $tarname $imgname
258 mount -o loop $imgname $xdir
259 (cd $xdir; tar zcf ../$filename .)
260 umount $xdir
261 rm -f $tarname $imgname
262 rmdir $xdir
263 echo "New cloud image cache created"
264 trap EXIT
265}
266
267mkdir -p /var/lock/subsys/
268(
269 flock -n -x 200
270
271 cd $cache
272 if [ $flushcache -eq 1 ]; then
273 echo "Clearing the cached images"
274 rm -f $filename
275 fi
276
277 if [ ! -f $filename ]; then
278 wget $url2 || build_root_tgz $url1 $filename
279 fi
280
281 echo "Extracting container rootfs"
282 mkdir -p $rootfs
283 cd $rootfs
284 tar -zxf $cache/$filename
285
286
287 if [ $cloud -eq 0 ]; then
288 echo "Configuring for running outside of a cloud environment"
289 echo "If you want to configure for a cloud evironment, please use '-- -C' to create the container"
290
291 seed_d=$rootfs/var/lib/cloud/seed/nocloud-net
292 rhostid=$(uuidgen | cut -c -8)
293 host_id=${hostid:-$rhostid}
294 mkdir -p $seed_d
295
296 cat > "$seed_d/meta-data" <<EOF
297instance_id: lxc-$host_id
298EOF
299
300 rm $rootfs/etc/hostname
301
302 if [ $locales -eq 1 ]; then
303 cp /usr/lib/locale/locale-archive $rootfs/usr/lib/locale/locale-archive
304 fi
305
306
307 if [ -n "$auth_key" -a -f "$auth_key" ]; then
308 u_path="/home/ubuntu/.ssh"
309 root_u_path="$rootfs/$u_path"
310 mkdir -p $root_u_path
311 cp $auth_key "$root_u_path/authorized_keys"
312 chroot $rootfs chown -R ubuntu: "$u_path"
313
314 echo "Inserted SSH public key from $auth_key into /home/ubuntu/.ssh/authorized_keys"
315 fi
316
317 if [ ! -f $userdata ]; then
318 cp $userdata $data_d/user-data
319 else
320
321 if [ -z "$MIRROR" ]; then
322 MIRROR="http://archive.ubuntu.com/ubuntu"
323 fi
324
325 cat > "$seed_d/user-data" <<EOF
326#cloud-config
327output: {all: '| tee -a /var/log/cloud-init-output.log'}
328apt-mirror: $MIRROR
329manage_etc_hosts: localhost
330locale: $(/usr/bin/locale | awk -F= '/LANG=/ {print$NF}')
331EOF
332
333 fi
334
335 chroot $rootfs /usr/sbin/usermod -U ubuntu
336 echo "ubuntu:ubuntu" | chroot $rootfs chpasswd
337 echo "Please login as user ubuntu with password ubuntu."
338
339 else
340
341 echo "Configured for running in a cloud environment."
342 echo "If you do not have a meta-data service, this container will likely be useless."
343
344 fi
345
346) 200>/var/lock/subsys/lxc-ubucloud
347
348copy_configuration $path $rootfs $name $arch
349
350echo "Container $name created."
351exit 0
0352
=== added file 'debian/patches/0059-reenable-daily-cloudimg'
--- debian/patches/0059-reenable-daily-cloudimg 1970-01-01 00:00:00 +0000
+++ debian/patches/0059-reenable-daily-cloudimg 2012-03-17 09:44:19 +0000
@@ -0,0 +1,65 @@
1Description: re-enable use of daily cloud images
2 There are two types of cloud images - released and daily ones. We were
3 always using daily ones, instead of using released by default with an
4 option for daily. Fix that.
5Author: Serge Hallyn <serge.hallyn@ubuntu.com>
6Forwarded: yes
7
8Index: lxc/templates/lxc-ubuntu-cloud.in
9===================================================================
10--- lxc.orig/templates/lxc-ubuntu-cloud.in 2012-03-16 09:40:19.027008000 -0500
11+++ lxc/templates/lxc-ubuntu-cloud.in 2012-03-16 09:49:47.882037866 -0500
12@@ -105,6 +105,7 @@
13 [ -C | --cloud ]: Configure container for use with meta-data service, defaults to no
14 [ -T | --tarball ]: Location of tarball
15 [ -d | --debug ]: Run with 'set -x' to debug errors
16+[ -s | --stream]: Use specified stream rather than 'released'
17
18 Options, mutually exclusive of "-C" and "--cloud":
19 [ -i | --hostid ]: HostID for cloud-init, defaults to random string
20@@ -116,7 +117,7 @@
21 return 0
22 }
23
24-options=$(getopt -o a:hp:r:n:Fi:CLS:T:d -l arch:,help,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug -- "$@")
25+options=$(getopt -o a:hp:r:n:Fi:CLS:T:ds: -l arch:,help,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug,stream: -- "$@")
26 if [ $? -ne 0 ]; then
27 usage $(basename $0)
28 exit 1
29@@ -160,6 +161,7 @@
30 cloud=0
31 locales=1
32 flushcache=0
33+stream="released"
34 while true
35 do
36 case "$1" in
37@@ -176,6 +178,7 @@
38 -L|--no_locales) locales=0; shift 2;;
39 -T|--tarball) tarball=$2; shift 2;;
40 -d|--debug) debug=1; shift 1;;
41+ -s|--stream) stream=$2; shift 2;;
42 --) shift 1; break ;;
43 *) break ;;
44 esac
45@@ -199,6 +202,11 @@
46 exit 1
47 fi
48
49+if [ "$stream" != "daily" -a "$stream" != "released" ]; then
50+ echo "Only 'daily' and 'released' streams are supported"
51+ exit 1
52+fi
53+
54 if [ -z "$path" ]; then
55 echo "'path' parameter is required"
56 exit 1
57@@ -223,7 +231,7 @@
58 if [ -n "$tarball" ]; then
59 url2="$tarball"
60 else
61- url1=`ubuntu-cloudimg-query $release released $arch --format "%{url}\n"`
62+ url1=`ubuntu-cloudimg-query $release $stream $arch --format "%{url}\n"`
63 url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/'`
64 fi
65
066
=== renamed file 'debian/patches/0059-reenable-daily-cloudimg' => 'debian/patches/0059-reenable-daily-cloudimg.moved'

Subscribers

People subscribed via source and target branches

to all changes: