Merge lp:~cprov/core-image-publisher/fake-home into lp:core-image-publisher

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 22
Merged at revision: 21
Proposed branch: lp:~cprov/core-image-publisher/fake-home
Merge into: lp:core-image-publisher
Diff against target: 38 lines (+10/-4)
2 files modified
core-service.conf (+3/-3)
core_image_publisher/worker.py (+7/-1)
To merge this branch: bzr merge lp:~cprov/core-image-publisher/fake-home
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+254865@code.launchpad.net

Commit message

Define a fake/temporary $HOME for our system user (core-worker) for calling u-d-f for downloading images.

Description of the change

Define a fake/temporary $HOME for our system user (core-worker) for calling u-d-f for downloading images. u-d-f fills '~/.cache/ubuntuimages/' with:

{{{
571848 tmpg3m9bclk/core-355-cloud.img
640252 tmpg3m9bclk/core-355.img
4 tmpg3m9bclk/.cache/ubuntuimages/ubuntu-core/devel-proposed/generic_amd64/version-355.tar.xz.asc
4 tmpg3m9bclk/.cache/ubuntuimages/ubuntu-core/devel-proposed/generic_amd64/version-355.tar.xz
12 tmpg3m9bclk/.cache/ubuntuimages/ubuntu-core/devel-proposed/generic_amd64
16 tmpg3m9bclk/.cache/ubuntuimages/ubuntu-core/devel-proposed
20 tmpg3m9bclk/.cache/ubuntuimages/ubuntu-core
4 tmpg3m9bclk/.cache/ubuntuimages/gpg/image-signing.tar.xz
4 tmpg3m9bclk/.cache/ubuntuimages/gpg/image-signing.tar.xz.asc
4 tmpg3m9bclk/.cache/ubuntuimages/gpg/image-master.tar.xz
4 tmpg3m9bclk/.cache/ubuntuimages/gpg/image-master.tar.xz.asc
20 tmpg3m9bclk/.cache/ubuntuimages/gpg
43640 tmpg3m9bclk/.cache/ubuntuimages/pool/ubuntu-cc040b86eeac036f2e4d2762ed4dc39e37806befc0d625ce6209c46cbb373b80.tar.xz
4 tmpg3m9bclk/.cache/ubuntuimages/pool/ubuntu-cc040b86eeac036f2e4d2762ed4dc39e37806befc0d625ce6209c46cbb373b80.tar.xz.asc
4 tmpg3m9bclk/.cache/ubuntuimages/pool/device-b7114519bc4b23bd78c051957d382014f7938a906c38a96d3c1b12b3470ea6e2.tar.xz.asc
76792 tmpg3m9bclk/.cache/ubuntuimages/pool/device-b7114519bc4b23bd78c051957d382014f7938a906c38a96d3c1b12b3470ea6e2.tar.xz
120444 tmpg3m9bclk/.cache/ubuntuimages/pool
120488 tmpg3m9bclk/.cache/ubuntuimages
120492 tmpg3m9bclk/.cache
1332596 tmpg3m9bclk/
}}}

For now we can throw it away since bandwidth is cheap inside the DC, but maybe we can explore this already present caching mechanism for operation with hot-cache workers on other image tests.

Since we do have short-living workers, development would have to slow down a lot before we can see any benefit. Also if we don't have any policy for periodically recycling workers, we might have to cleanup its $HOME. Anyway, let's not prematurely optimise

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core-service.conf'
2--- core-service.conf 2015-03-30 06:10:53 +0000
3+++ core-service.conf 2015-04-01 03:43:41 +0000
4@@ -3,7 +3,7 @@
5 uris = amqp://guest:guest@localhost:5672//
6
7 [nova]
8-os_username = thomi
9-os_password = kNRCNawCAT5k
10-os_tenant_name = thomi_project
11+os_username = foo
12+os_password = <redacted>
13+os_tenant_name = foo_project
14 os_auth_url = http://172.20.161.138:5000/v2.0/
15
16=== modified file 'core_image_publisher/worker.py'
17--- core_image_publisher/worker.py 2015-03-31 20:21:41 +0000
18+++ core_image_publisher/worker.py 2015-04-01 03:43:41 +0000
19@@ -108,6 +108,12 @@
20 def download_image(name, channel, device, tmpdir):
21 """Download the ubuntu code image, return a path to it on disk."""
22 image_path = os.path.join(tmpdir, 'core-{}.img'.format(name))
23+ udf_env = {
24+ # u-d-f fills '~/.cache/ubuntuimages/' on downloads,
25+ # not particulary useful to us, unless we only have one
26+ # worker and perform testing retries.
27+ 'HOME': tmpdir,
28+ }
29 cmd = ['sudo',
30 'ubuntu-device-flash',
31 '--revision', name,
32@@ -118,7 +124,7 @@
33 '-o', image_path,
34 '--developer-mode',
35 '--cloud']
36- check_call(cmd)
37+ check_call(cmd, env=udf_env)
38 return image_path
39
40

Subscribers

People subscribed via source and target branches