This repo contains some work that has been done with the goal of combining the maas ephemeral image and the lxd image as seen on http://cloud-images.ubuntu.com. The result would be less data to download for the end user.
To accomplish this, the following work items would need to be done:
- cloud-images build to produce a squashfs image as lxd-root.squash
- maas-images code changed to re-distribute the lxd-root.squash image along side the kernel and initramfs. Alternatively, the cloud-image build process could produce these artifacts and maas-images simply mirror them also.
- maas code change to consume lxd-root.squash
- maas code change to either:
- instruct curtin to install via 'cp:///' rather than 'http:///'
- convert lxd-root.squash into .tar.gz for installation (some of this code is started as squash2tar.py below).
- cloud-initramfs-dynconf change to not assume /etc/resolvconf -> /run/network/dyn-netconf
- lxd support of squashfs as import type
- removal of the maas specific 'maas ephemeral image'
- any maas installation already has the lxd image and lxd installations have part of the maas needs (missing kernel/initramfs)
- squashfs compression means less network read over iscsi in boot, reducing a bottleneck on iscsi server.
- squashfs image cannot be quickly and easily modified/patched. This is admittedly primarily dev use only.
- lxd-squash would not contain a kernel installed, which means all installations would need dpkg installation of kernel, where currently only hwe kernels on LTS releases do.
This describes how to test the boot of a squashfs root image, including build of image and boot in kvm.
This file is part of a gist at https://gist.github.com/smoser/a8d69727ceca99f81f4b
run prepare-images to get images downloaded.
./prepare-images wily
./prepare-images trusty vivid # to use hwe-v kernel
to boot an image in qemu-system-x86_64 , do:
./boot-test <image> <kernel> <initrd> 2>&1 | tee my.log
That does a boot of using external kernel and initrd
and via cloud-localds seed will do a 'cp / /mnt
'.
Essentially this does a boot and then a full read of the filesystem.
- need /lib/modules in lxd image bug 1501843
- need squashfs modules in 'most' bug 1501834
- why apparmor=0 cmdline
$ ls -l root.img root.img.gz root-squash-gzip root-squash-xz
-r--r--r-- 1 ubuntu ubuntu 1.0G Sep 28 19:34 root.img
-rw-rw-r-- 1 ubuntu ubuntu 182M Sep 28 20:57 root.img.gz
-rw-r--r-- 1 ubuntu ubuntu 178M Sep 28 19:37 root-squash-gzip
-rw-r--r-- 1 ubuntu ubuntu 144M Sep 28 19:36 root-squash-xz
Do note that above the '1.0G' is just the size I made it. The filesystem shows approximately 590M taken on a wily image. the root.img.gz is a simple gzip of that image.
$ for i in root.img root-squash-gzip root-squash-xz; do
../boot-test $i boot-kernel.trusty fixed-initrd > $i.log 2>&1 ; done
$ for i in *.log; do echo $i; egrep "^(real|user|sys).*s" $i; done
root.img.log
real 0m53.957s
user 0m30.956s
sys 0m10.744s
root-squash-gzip.log
real 0m56.221s
user 0m34.112s
sys 0m11.500s
root-squash-xz.log
real 1m9.813s
user 0m51.384s
sys 0m10.612s