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 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
1=== modified file 'curtin/commands/block_meta.py'
2--- curtin/commands/block_meta.py 2017-03-22 21:03:58 +0000
3+++ curtin/commands/block_meta.py 2017-04-06 20:38:25 +0000
4@@ -22,7 +22,7 @@
5 from curtin.reporter import events
6
7 from . import populate_one_subcmd
8-from curtin.udev import compose_udev_equality, udevadm_settle
9+from curtin.udev import compose_udev_equality, udevadm_settle, udevadm_trigger
10
11 import glob
12 import os
13@@ -604,6 +604,14 @@
14 LOG.debug("mkfs {} info: {}".format(volume_path, info))
15 mkfs.mkfs_from_config(volume_path, info)
16
17+ device_type = storage_config.get(volume).get('type')
18+ LOG.debug('Formated device type: %s', device_type)
19+ if device_type == 'bcache':
20+ # other devs have a udev watch on them. Not bcache (LP: #1680597).
21+ LOG.debug('Detected bcache device format, calling udevadm trigger to '
22+ 'generate by-uuid symlinks on "%s"', volume_path)
23+ udevadm_trigger([volume_path])
24+
25
26 def mount_handler(info, storage_config):
27 state = util.load_command_environment()
28
29=== modified file 'curtin/udev.py'
30--- curtin/udev.py 2016-04-22 19:15:22 +0000
31+++ curtin/udev.py 2017-04-06 20:38:25 +0000
32@@ -66,4 +66,13 @@
33 settle_cmd.extend(['--timeout=%s' % timeout])
34
35 util.subp(settle_cmd)
36+
37+
38+def udevadm_trigger(devices):
39+ if devices is None:
40+ devices = []
41+ util.subp(['udevadm', 'trigger'] + list(devices))
42+ udevadm_settle()
43+
44+
45 # vi: ts=4 expandtab syntax=python
46
47=== modified file 'tests/vmtests/test_bcache_basic.py'
48--- tests/vmtests/test_bcache_basic.py 2017-02-07 16:52:56 +0000
49+++ tests/vmtests/test_bcache_basic.py 2017-04-06 20:38:25 +0000
50@@ -18,6 +18,7 @@
51 cat /proc/mounts > proc_mounts
52 cat /proc/partitions > proc_partitions
53 find /etc/network/interfaces.d > find_interfacesd
54+ cat /proc/cmdline > cmdline
55 """)]
56
57 def test_bcache_output_files_exist(self):
58@@ -36,6 +37,9 @@
59 def test_bcache_cachemode(self):
60 self.check_file_regex("bcache_cache_mode", r"\[writeback\]")
61
62+ def test_proc_cmdline_root_by_uuid(self):
63+ self.check_file_regex("cmdline", r"root=UUID=")
64+
65
66 class PreciseHWETBcacheBasic(relbase.precise_hwe_t, TestBcacheBasic):
67 __test__ = True

Subscribers

People subscribed via source and target branches