Merge lp:~ursinha/uci-engine/add-run-lock-to-imagebuild-chroot into lp:uci-engine

Proposed by Ursula Junque
Status: Merged
Approved by: Ursula Junque
Approved revision: 648
Merged at revision: 649
Proposed branch: lp:~ursinha/uci-engine/add-run-lock-to-imagebuild-chroot
Merge into: lp:uci-engine
Diff against target: 32 lines (+12/-0)
1 file modified
image-builder/imagebuilder/cloud_image.py (+12/-0)
To merge this branch: bzr merge lp:~ursinha/uci-engine/add-run-lock-to-imagebuild-chroot
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Celso Providelo (community) Approve
Review via email: mp+225718@code.launchpad.net

Commit message

Initial fix for bug 1337877. It adds /run/lock to the image chroot, mounting it properly.

Description of the change

Initial fix for bug 1337877. It adds /run/lock to the image chroot, mounting it properly.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Thanks for working on this.

I presume this is the change that successfully worked for the click-ticket. If I understand correctly, it gives a specific tmpfs '/run/lock' for the baked chroot lifetime. It seems correct to me.

As far as the image-builder is concerned, it's great and should be landed. Since the test-runner initiating this image as a new node, I assume it will also have a proper '/run/lock' and we will be fine.

Great work finding and fixing the problem.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:648
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1016/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1016/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'image-builder/imagebuilder/cloud_image.py'
2--- image-builder/imagebuilder/cloud_image.py 2014-06-27 16:35:16 +0000
3+++ image-builder/imagebuilder/cloud_image.py 2014-07-04 21:17:38 +0000
4@@ -227,9 +227,17 @@
5 self.nbd_dev)
6 runcmd('udevadm settle')
7 runcmd('mount /dev/%sp1 %s' % (self.nbd_dev, mountpoint))
8+
9 # Mount /proc /sys and /dev in the image
10 for bmount in ['/proc', '/sys', '/dev']:
11 runcmd('mount --bind %s %s/%s' % (bmount, mountpoint, bmount))
12+
13+ # Creating /run/lock
14+ run_lock = os.path.join(mountpoint, 'run', 'lock')
15+ os.mkdir(run_lock)
16+ runcmd(
17+ 'mount -t tmpfs -o nodev,noexec,nosuid,size=5242880 none '
18+ '{}'.format(run_lock))
19 # Backup resolv.conf and copy in the one from the local system
20 if os.path.lexists('%s/etc/resolv.conf' % mountpoint):
21 shutil.move('%s/etc/resolv.conf' % mountpoint,
22@@ -254,6 +262,10 @@
23 def _umount_image(self):
24 for bmount in ['/proc', '/sys', '/dev']:
25 runcmd('umount %s/%s' % (self.mountpoint, bmount))
26+ # Removing /run/lock
27+ run_lock = os.path.join(self.mountpoint, 'run', 'lock')
28+ runcmd('umount {}'.format(run_lock))
29+ shutil.rmtree(run_lock)
30 if os.path.lexists('%s/etc/resolv.conf.orig' % self.mountpoint):
31 shutil.move('%s/etc/resolv.conf.orig' % self.mountpoint,
32 '%s/etc/resolv.conf' % self.mountpoint)

Subscribers

People subscribed via source and target branches