Merge lp:~smoser/curtin/trunk.lp1680591 into lp:~curtin-dev/curtin/trunk

Proposed by Scott Moser
Status: Merged
Merged at revision: 483
Proposed branch: lp:~smoser/curtin/trunk.lp1680591
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 67 lines (+22/-1)
3 files modified
curtin/commands/block_meta.py (+9/-1)
curtin/udev.py (+9/-0)
tests/vmtests/test_bcache_basic.py (+4/-0)
To merge this branch: bzr merge lp:~smoser/curtin/trunk.lp1680591
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper (community) Approve
Review via email: mp+322151@code.launchpad.net

Commit message

Make systems with root on bcache use root=UUID=.

Systems with root on bcache would end up booting with root=/dev/bcache0
(or bcache1). Bcache device names are not guaranteed, so this could
cause issues.

The fix is to invoke 'udevadm trigger' after creating a filesystem on
a bcache device. That will populate /dev/disk/by-uuid, which will
cause grub to properly decide to boot by root=UUID=.

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

This is good. I think we should also document why the udevadm trigger is required. Grub relies upon udevadm information to confirm UUID presense prior to rebooting into a system which may not see the UUID. Separately, udev does not currently *inotify watch* bcache devices like it does other block devs and therefor we do not get an automatic udevadm trigger when mkfs closes a bcache device (like we do with say a partition).

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
lp:~smoser/curtin/trunk.lp1680591 updated
483. By Scott Moser

mention bug

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'curtin/commands/block_meta.py'
--- curtin/commands/block_meta.py 2017-03-22 21:03:58 +0000
+++ curtin/commands/block_meta.py 2017-04-06 20:38:25 +0000
@@ -22,7 +22,7 @@
22from curtin.reporter import events22from curtin.reporter import events
2323
24from . import populate_one_subcmd24from . import populate_one_subcmd
25from curtin.udev import compose_udev_equality, udevadm_settle25from curtin.udev import compose_udev_equality, udevadm_settle, udevadm_trigger
2626
27import glob27import glob
28import os28import os
@@ -604,6 +604,14 @@
604 LOG.debug("mkfs {} info: {}".format(volume_path, info))604 LOG.debug("mkfs {} info: {}".format(volume_path, info))
605 mkfs.mkfs_from_config(volume_path, info)605 mkfs.mkfs_from_config(volume_path, info)
606606
607 device_type = storage_config.get(volume).get('type')
608 LOG.debug('Formated device type: %s', device_type)
609 if device_type == 'bcache':
610 # other devs have a udev watch on them. Not bcache (LP: #1680597).
611 LOG.debug('Detected bcache device format, calling udevadm trigger to '
612 'generate by-uuid symlinks on "%s"', volume_path)
613 udevadm_trigger([volume_path])
614
607615
608def mount_handler(info, storage_config):616def mount_handler(info, storage_config):
609 state = util.load_command_environment()617 state = util.load_command_environment()
610618
=== modified file 'curtin/udev.py'
--- curtin/udev.py 2016-04-22 19:15:22 +0000
+++ curtin/udev.py 2017-04-06 20:38:25 +0000
@@ -66,4 +66,13 @@
66 settle_cmd.extend(['--timeout=%s' % timeout])66 settle_cmd.extend(['--timeout=%s' % timeout])
6767
68 util.subp(settle_cmd)68 util.subp(settle_cmd)
69
70
71def udevadm_trigger(devices):
72 if devices is None:
73 devices = []
74 util.subp(['udevadm', 'trigger'] + list(devices))
75 udevadm_settle()
76
77
69# vi: ts=4 expandtab syntax=python78# vi: ts=4 expandtab syntax=python
7079
=== modified file 'tests/vmtests/test_bcache_basic.py'
--- tests/vmtests/test_bcache_basic.py 2017-02-07 16:52:56 +0000
+++ tests/vmtests/test_bcache_basic.py 2017-04-06 20:38:25 +0000
@@ -18,6 +18,7 @@
18 cat /proc/mounts > proc_mounts18 cat /proc/mounts > proc_mounts
19 cat /proc/partitions > proc_partitions19 cat /proc/partitions > proc_partitions
20 find /etc/network/interfaces.d > find_interfacesd20 find /etc/network/interfaces.d > find_interfacesd
21 cat /proc/cmdline > cmdline
21 """)]22 """)]
2223
23 def test_bcache_output_files_exist(self):24 def test_bcache_output_files_exist(self):
@@ -36,6 +37,9 @@
36 def test_bcache_cachemode(self):37 def test_bcache_cachemode(self):
37 self.check_file_regex("bcache_cache_mode", r"\[writeback\]")38 self.check_file_regex("bcache_cache_mode", r"\[writeback\]")
3839
40 def test_proc_cmdline_root_by_uuid(self):
41 self.check_file_regex("cmdline", r"root=UUID=")
42
3943
40class PreciseHWETBcacheBasic(relbase.precise_hwe_t, TestBcacheBasic):44class PreciseHWETBcacheBasic(relbase.precise_hwe_t, TestBcacheBasic):
41 __test__ = True45 __test__ = True

Subscribers

People subscribed via source and target branches