launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12691
[Merge] lp:~andreserl/maas/use_squashfs_filesystem into lp:maas
Andres Rodriguez has proposed merging lp:~andreserl/maas/use_squashfs_filesystem into lp:maas with lp:~andreserl/maas/maas_import_squashfs as a prerequisite.
Commit message:
Make use of the squashfs image
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~andreserl/maas/use_squashfs_filesystem/+merge/127092
This branch makes use of the squashfs root filesystem for installation. In order to do so, we make available the image tftp directory through HTTP. This is then nobtained by the preseed file, if and only if the images exists for a certain distro_series. If the images are not present installation will resume with normal operation.
--
https://code.launchpad.net/~andreserl/maas/use_squashfs_filesystem/+merge/127092
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/use_squashfs_filesystem into lp:maas.
=== modified file 'contrib/maas-http.conf'
--- contrib/maas-http.conf 2012-09-25 09:48:17 +0000
+++ contrib/maas-http.conf 2012-09-29 03:38:21 +0000
@@ -45,6 +45,12 @@
SetHandler None
</Directory>
+# Serve squashfs images
+Alias /MAAS/static/images/ /var/lib/maas/tftp/
+<Directory /var/lib/maas/tftp/>
+ SetHandler None
+</Directory>
+
# Serve files from staticfiles.
Alias /MAAS/static/ /usr/share/maas/web/static/
<Directory /usr/share/maas/web/static/>
=== modified file 'contrib/preseeds_v2/generic'
--- contrib/preseeds_v2/generic 2012-09-21 16:42:19 +0000
+++ contrib/preseeds_v2/generic 2012-09-29 03:38:21 +0000
@@ -1,4 +1,14 @@
{{inherit "preseed_master"}}
+
+{{def squashfs_image}}
+{{if node.distro_series in {'quantal'} and node.architecture in {'i386', 'amd64'} and use_squashfs is True }}
+d-i preseed/early_command string anna-install live-installer
+d-i live-installer/enable boolean true
+d-i live-installer/mode select normal
+d-i live-installer/net-image string http://{{server_host}}/MAAS/static/images/{{node.architecture}}/generic/{{node.distro_series}}/filesystem/filesystem.squashfs
+{{endif}}
+{{enddef}}
+
{{def proxy}}
d-i mirror/country string manual
{{if node.architecture in {'i386', 'amd64'} }}
=== modified file 'contrib/preseeds_v2/preseed_master'
--- contrib/preseeds_v2/preseed_master 2012-08-03 16:33:05 +0000
+++ contrib/preseeds_v2/preseed_master 2012-09-29 03:38:21 +0000
@@ -3,6 +3,9 @@
# * Cloud-init for bare-metal
# * Cloud-init preseed data
+# Squashfs Installation
+{{self.squashfs_image}}
+
# Locale
d-i debian-installer/locale string en_US.UTF-8
=== modified file 'scripts/maas-import-pxe-files'
--- scripts/maas-import-pxe-files 2012-09-29 03:38:21 +0000
+++ scripts/maas-import-pxe-files 2012-09-29 03:38:21 +0000
@@ -45,6 +45,10 @@
# Default is yes.
IMPORT_SQUASHFS=${IMPORT_SQUASHFS:-1}
+# Whether to download squashfs images as well: "1" for yes, "0" for no.
+# Default is yes.
+IMPORT_SQUASHFS=${IMPORT_SQUASHFS:-1}
+
# Whether to download ephemeral images as well: "1" for yes, "0" for no.
# Default is yes.
IMPORT_EPHEMERALS=${IMPORT_EPHEMERALS:-1}
@@ -191,6 +195,15 @@
}
+# Download and install the squashfs root images.
+import_squashfs_images() {
+ if test "$IMPORT_SQUASHFS" != "0"
+ then
+ maas-import-squashfs
+ fi
+}
+
+
# Download and install the ephemeral images.
import_ephemeral_images() {
if test "$IMPORT_EPHEMERALS" != "0"
=== modified file 'src/maasserver/preseed.py'
--- src/maasserver/preseed.py 2012-09-27 15:39:38 +0000
+++ src/maasserver/preseed.py 2012-09-29 03:38:21 +0000
@@ -31,7 +31,9 @@
from maasserver.models import Config
from maasserver.server_address import get_maas_facing_server_host
from maasserver.utils import absolute_reverse
+from provisioningserver.config import Config as PConfig
import tempita
+import os
GENERIC_FILENAME = 'generic'
@@ -228,11 +230,16 @@
'preseed_data': compose_preseed(node),
'node_disable_pxe_url': node_disable_pxe_url,
'node_disable_pxe_data': node_disable_pxe_data,
+ 'use_squashfs': is_squashfs_image_present(node),
}
context.update(node_context)
return context
+def is_squashfs_image_present(node):
+ tftproot = PConfig.load_from_cache()['tftp']['root']
+ return os.path.exists("%s/%s/generic/%s/filesystem/filesystem.squashfs" % (tftproot,
+ node.architecture, node.distro_series))
def render_preseed(node, prefix, release=''):
"""Find and load a `PreseedTemplate` for the given node.
=== modified file 'src/maasserver/tests/test_preseed.py'
--- src/maasserver/tests/test_preseed.py 2012-09-27 15:39:39 +0000
+++ src/maasserver/tests/test_preseed.py 2012-09-29 03:38:21 +0000
@@ -30,6 +30,7 @@
get_preseed_context,
get_preseed_filenames,
get_preseed_template,
+ is_squashfs_image_present,
load_preseed_template,
PreseedTemplate,
render_preseed,
@@ -295,7 +296,8 @@
self.assertItemsEqual(
['node', 'release', 'metadata_enlist_url',
'server_host', 'server_url', 'preseed_data',
- 'node_disable_pxe_url', 'node_disable_pxe_data'],
+ 'node_disable_pxe_url', 'node_disable_pxe_data',
+ 'use_squashfs'],
context)
def test_get_preseed_context_if_node_None(self):
@@ -309,6 +311,14 @@
context)
+class TestSquashfsAvailable(TestCase):
+
+ def test_is_squashfs_image_present_false(self):
+ node = factory.make_node()
+ exists = is_squashfs_image_present(node)
+ self.assertFalse(exists)
+
+
class TestPreseedTemplate(TestCase):
"""Tests for class:`PreseedTemplate`."""
Follow ups