Merge lp:~ltrager/maas-images/v3_squashfs_only into lp:maas-images

Proposed by Lee Trager
Status: Merged
Merged at revision: 376
Proposed branch: lp:~ltrager/maas-images/v3_squashfs_only
Merge into: lp:maas-images
Prerequisite: lp:~smoser/maas-images/lp1689557-build-squashfs-trusty
Diff against target: 48 lines (+18/-2)
1 file modified
meph2/stream.py (+18/-2)
To merge this branch: bzr merge lp:~ltrager/maas-images/v3_squashfs_only
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Andres Rodriguez (community) Needs Information
Review via email: mp+326129@code.launchpad.net

Commit message

If the squashfs config option is set produce streams only with SquashFS images.

Any image which is only available as a root-image will be automatically
converted.

Description of the change

Sample stream is up at http://162.213.35.187/squashfs/ it does not contain Precise as maas-images currently ignores unsupported releases and we do not plan to support in in MAAS 2.3+.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Why squashfs *only*? We should continue to produce the root tarballs for trusty. There are still a lot of users on older versions of MAAS that would potentially be broken if we make the switch.

review: Needs Information
Revision history for this message
Scott Moser (smoser) wrote :

I agree with Andres. You'll need to make both image types available.

Revision history for this message
Lee Trager (ltrager) wrote :

Any version of MAAS which can use the V3 stream can deploy SquashFS images. In the current V3 stream if a release has a SquashFS image we only publish the SquashFS image. The only reason Trusty and Precise have yet to goto a SquashFS image is because they aren't available on http://cloud-images.ubuntu.com. If MAAS detects a release in the stream contains both a root-image and a SquashFS image the SquashFS image will be downloaded and the root-image will be ignored[1]. If a SquashFS image is added to an existing release version the root-image will be deleted and the SquashFS image will be downloaded[2]. So once the Trusty SquashFS image is released to the V3 stream no version of MAAS will use the root-image, even if its available.

[1] https://git.launchpad.net/maas/tree/src/maasserver/bootresources.py#n1084
[2] https://git.launchpad.net/maas/tree/src/maasserver/bootresources.py#n652

375. By Lee Trager

Merge trunk

376. By Lee Trager

If upstream contains a root-image publish it along side the SquashFS image.

Revision history for this message
Lee Trager (ltrager) wrote :

I've updated the MP to publish both the root-image.gz and SquashFS image for Trusty. As previously mentioned any version of MAAS which can use the V3 stream will ignore the root-image.gz. The only effect this should have is increasing the stream size.

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good. Thanks for the fixes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'meph2/stream.py'
2--- meph2/stream.py 2016-12-16 23:52:01 +0000
3+++ meph2/stream.py 2017-06-23 02:07:18 +0000
4@@ -155,10 +155,17 @@
5 krd_packs = []
6 squashfs = cfgdata.get('squashfs', False)
7 base_boot_keys = ['boot-kernel', 'boot-initrd']
8- if squashfs and img_url.endswith('.squashfs'):
9+ if squashfs:
10+ # Only publish SquashFS root images when the squashfs option is set. If
11+ # the image is a tar.gz it will be converted below.
12 base_ikeys = base_boot_keys + ['squashfs', 'squashfs.manifest']
13 manifest_path = PATH_FORMATS['squashfs.manifest'] % subs
14 newpaths = set((PATH_FORMATS['squashfs'] % subs, manifest_path))
15+ # If upstream is only providing a root-image include it in addition to
16+ # the SquashFS image
17+ if not img_url.endswith('.squashfs'):
18+ base_ikeys += ['root-image.gz']
19+ newpaths.update([rootimg_path])
20 else:
21 base_ikeys = base_boot_keys + ['root-image.gz', 'root-image.manifest']
22 manifest_path = PATH_FORMATS['root-image.manifest'] % subs
23@@ -300,8 +307,8 @@
24 subprocess.check_call(gencmd)
25 LOG.info("finished: %s" % gencmd)
26
27+ base_dir = os.path.join(out_d, release, arch, version_name)
28 if img_url.endswith('squashfs'):
29- base_dir = os.path.join(out_d, release, arch, version_name)
30 src_squash = os.path.join(base_dir, os.path.basename(img_url))
31 if squashfs:
32 # If we're publishing a SquashFS file rename it to its
33@@ -318,6 +325,15 @@
34 # If we're not publishing the SquashFS image but used it to
35 # generate the root-img clean it up.
36 os.remove(src_squash)
37+ elif squashfs and img_url.endswith('tar.gz'):
38+ # If the stream is publishing SquashFS images convert any
39+ # non-SquashFS image into a SquashFS image.
40+ subprocess.check_call([
41+ 'sudo', 'env', 'PATH=%s' % os.environ.get('PATH'),
42+ os.environ.get('IMG2SQUASHFS', 'img2squashfs'),
43+ os.path.join(base_dir, 'root-image.gz'),
44+ os.path.join(base_dir, 'squashfs'),
45+ ])
46
47 # get checksum and size of new files created
48 file_info = {}

Subscribers

People subscribed via source and target branches