Merge lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203160052 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-201203160052
Merge into: lp:ubuntu/precise/lxc
Diff against target: 432 lines (+417/-0) (has conflicts)
2 files modified
.pc/0058-fixup-ubuntu-cloud/templates/lxc-ubuntu-cloud.in (+311/-0)
debian/patches/0058-fixup-ubuntu-cloud (+106/-0)
Conflict adding file .pc/0058-fixup-ubuntu-cloud.  Moved existing file to .pc/0058-fixup-ubuntu-cloud.moved.
Conflict adding file debian/patches/0058-fixup-ubuntu-cloud.  Moved existing file to debian/patches/0058-fixup-ubuntu-cloud.moved.
To merge this branch: bzr merge lp:~ubuntu-branches/ubuntu/precise/lxc/precise-201203160052
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+97780@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-201203160052. 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

82. By Serge Hallyn

add comment about arm images to ubuntu-cloud template

81. By Serge Hallyn

Switch from daily to released stream (per smoser's suggestion).

80. By Serge Hallyn

  - fix typo in check for $debug (LP: #955935)
  - Download specified release, not always precise
  - If cloudimg rootfs.tar.gz does not exist, create one from the base
    cloudimg tar.gz. (LP: #955938)
  - Explicitly set ubuntu user's password.

79. By Serge Hallyn

show error message if cloud image was not found (LP: #955938)

78. By Serge Hallyn

* 0058-fixup-ubuntu-cloud:
  - update 0054-ubuntu-debug to fix a typo (LP: #955935)
  - download specified release, not always precise

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: