Merge lp:~jtv/maas/multi-arch-imports into lp:~maas-maintainers/maas/new-import-script-integration

Proposed by Jeroen T. Vermeulen
Status: Merged
Merged at revision: 2170
Proposed branch: lp:~jtv/maas/multi-arch-imports
Merge into: lp:~maas-maintainers/maas/new-import-script-integration
Diff against target: 93 lines (+28/-8)
4 files modified
etc/maas/pserv.yaml (+24/-4)
src/provisioningserver/config.py (+1/-1)
src/provisioningserver/import_images/boot_resources.py (+2/-2)
src/provisioningserver/tests/test_config.py (+1/-1)
To merge this branch: bzr merge lp:~jtv/maas/multi-arch-imports
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+212392@code.launchpad.net

Commit message

Support multiple architectures in one simplestreams source.

Description of the change

This can be used for good or for evil. Good: specify a single source for completely identical, run-of-the-mill downloads — think “amd64 and oh, all the same stuff for i386 as well please.” Evil: “I want i386/generic plus amd64/hwe-t, but let's just specify them as one source and watch my company's bandwidth crumble under the load of 4 instead of 2 sets of images.”

There's a comment to warn people of the potential for evil. If you specify something like "i386 and armhf, generic and highbank" you probably get just what you'd expect: i386/generic, armhf/generic, armhf/highbank (with the third item actually being just an alias for the second, so bad example). But I'm not too interested in the minutiae right now; when in doubt, specify multiple sources. I think this even comes out clearer than before.

Jeroen

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good!

[0]

26 + #
27 + # Be careful: these constraints tend to multiply. For example if you

I'd use another verb here: 'tend' implies that this happens frequently but opens the door for "not always".

[1]

[...] If you only want some of
31 + # those combinations, keep them as separate sources.

Maybe mention that you can also use separate 'selections'.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/maas/pserv.yaml'
2--- etc/maas/pserv.yaml 2014-03-21 13:31:55 +0000
3+++ etc/maas/pserv.yaml 2014-03-25 02:05:44 +0000
4@@ -40,17 +40,37 @@
5
6 ## Boot configuration.
7 boot:
8+ ## Storage location for boot images.
9+ #
10+ # These images can get quite large: some files are hundreds of megabytes,
11+ # and you may need multiple copies for different architectures, OS releases,
12+ # etc.
13 storage: "/var/lib/maas/boot-resources/"
14+
15+ ## Sources of downloadable boot images.
16+ #
17+ # Each source downloads from one simplestreams URL, though it is possible to
18+ # have multiple sources using the same URL. For example, if you want to
19+ # download "release" images for one OS release and just the "beta-2" images
20+ # for another, specify two separate sources. Otherwise, the importer would
21+ # have to download both kinds of images for both releases.
22 sources:
23 - path: "http://maas.ubuntu.com/images/ephemeral/releases/"
24 keyring: "/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg"
25+ ## Filters for this source's imports.
26+ #
27+ # Be careful: these items tend to multiply. For example if you specify
28+ # architectures "i386" and "amd64", and subarchitectures "generic",
29+ # "hwe-s", and "hwe-t", the import script will need to import 6 images,
30+ # for each possible combination. If you only want some of those
31+ # combinations, keep them as separate sources.
32 selections:
33 - release: "*"
34- arch: "*"
35+ arches: ["*"]
36 subarches: ["*"]
37 ## other source example:
38 # - path: "http://hyperscale.ubuntu.com/images/"
39 # selections:
40-# - release: *
41-# arch: *
42-# subarches: ['*']
43+# - release: "*"
44+# arches: ["*"]
45+# subarches: ["*"]
46
47=== modified file 'src/provisioningserver/config.py'
48--- src/provisioningserver/config.py 2014-03-22 17:26:36 +0000
49+++ src/provisioningserver/config.py 2014-03-25 02:05:44 +0000
50@@ -137,7 +137,7 @@
51 if_key_missing = None
52
53 release = String(if_missing="*")
54- arch = String(if_missing="*")
55+ arches = Set(if_missing=["*"])
56 subarches = Set(if_missing=['*'])
57
58
59
60=== modified file 'src/provisioningserver/import_images/boot_resources.py'
61--- src/provisioningserver/import_images/boot_resources.py 2014-03-24 14:16:59 +0000
62+++ src/provisioningserver/import_images/boot_resources.py 2014-03-25 02:05:44 +0000
63@@ -131,7 +131,7 @@
64 for filter_dict in filters:
65 item_matches = (
66 value_passes_filter(filter_dict['release'], release) and
67- value_passes_filter(filter_dict['arch'], arch) and
68+ value_passes_filter_list(filter_dict['arches'], arch) and
69 value_passes_filter_list(filter_dict['subarches'], subarch)
70 )
71 if item_matches:
72@@ -151,7 +151,7 @@
73 :param filters: list of dicts each of which contains 'arch', 'subarch',
74 'release' keys; function takes d[arch][subarch][release] chain to the
75 first dict only if filters contain at least one dict with
76- d['arch'] == arch, subarch in d['subarch'], d['release'] == release;
77+ arch in d['arches'], subarch in d['subarch'], d['release'] == release;
78 dict may have '*' as a value for 'arch' and 'release' keys and as a
79 member of 'subarch' list -- in that case key-specific check always
80 passes.
81
82=== modified file 'src/provisioningserver/tests/test_config.py'
83--- src/provisioningserver/tests/test_config.py 2014-03-22 17:26:36 +0000
84+++ src/provisioningserver/tests/test_config.py 2014-03-25 02:05:44 +0000
85@@ -144,7 +144,7 @@
86 '/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg'),
87 'selections': [
88 {
89- 'arch': '*',
90+ 'arches': ['*'],
91 'release': '*',
92 'subarches': ['*'],
93 },

Subscribers

People subscribed via source and target branches