summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-27 11:17:08 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-02-27 11:17:08 +0000
commitbc3e042560424b433a408f01725f36cc2d47859c (patch)
treea47691034421e5c22e34690bf39ed9549ed187ca
parentf5163dd418e342fe6e5fb18625828076130a5e57 (diff)
parent296bec411f9fb25491e081dba3e7ff801e5fd40e (diff)
downloadmorph-bc3e042560424b433a408f01725f36cc2d47859c.tar.gz
Merge remote-tracking branch 'origin/sam/disable-new-btrfs-features'
Reviewed-By: Pedro Alvarez <pedro.alvarez@codethink.co.uk> Reviewed-By: Zara Zaimeche <zara.zaimeche@codethink.co.uk>
-rw-r--r--morphlib/writeexts.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index 6ab2dd55..ad4fabe9 100644
--- a/morphlib/writeexts.py
+++ b/morphlib/writeexts.py
@@ -237,8 +237,32 @@ class WriteExtension(cliapp.Application):
def mkfs_btrfs(self, location):
'''Create a btrfs filesystem on the disk.'''
+
self.status(msg='Creating btrfs filesystem')
- cliapp.runcmd(['mkfs.btrfs', '-f', '-L', 'baserock', location])
+ try:
+ # The following command disables some new filesystem features. We
+ # need to do this because at the time of writing, SYSLINUX has not
+ # been updated to understand these new features and will fail to
+ # boot if the kernel is on a filesystem where they are enabled.
+ cliapp.runcmd(
+ ['mkfs.btrfs','-f', '-L', 'baserock',
+ '--features', '^extref',
+ '--features', '^skinny-metadata',
+ '--features', '^mixed-bg',
+ '--nodesize', '4096',
+ location])
+ except cliapp.AppException as e:
+ if 'unrecognized option \'--features\'' in e.msg:
+ # Old versions of mkfs.btrfs (including v0.20, present in many
+ # Baserock releases) don't support the --features option, but
+ # also don't enable the new features by default. So we can
+ # still create a bootable system in this situation.
+ logging.debug(
+ 'Assuming mkfs.btrfs failure was because the tool is too '
+ 'old to have --features flag.')
+ cliapp.runcmd(['mkfs.btrfs','-f', '-L', 'baserock', location])
+ else:
+ raise
def get_uuid(self, location):
'''Get the UUID of a block device's file system.'''