Merge ~mwhudson/curtin:v2-partprobe-argh into curtin:master

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: 213ebb2820508bc33ea833118880e1463e15e649
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mwhudson/curtin:v2-partprobe-argh
Merge into: curtin:master
Diff against target: 31 lines (+13/-9)
1 file modified
curtin/commands/block_meta_v2.py (+13/-9)
Reviewer Review Type Date Requested Status
Dan Bungert Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+415998@code.launchpad.net

Commit message

block_meta_v2: change how we invoke sfdisk again, restore partprobe call

It's a bit disappointingly empirical but some multipath vmtests fail
with the current sfdisk arguments with "device busy" type errors. I
think this points to a bug somewhere else but the current partition code
works in this situation so massage things so that the new code does too.

Now we pass --no-tell-kernel to sfdisk, we do need to tell the kernel
about the changes so put back a call to partprobe to do this. This is
actually needed independent of the above change, because it seems sfdisk
with default arguments does not cause the kernel to remove the device
node for a deleted partition!

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Bungert (dbungert) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
2index c29f98d..7fd2e25 100644
3--- a/curtin/commands/block_meta_v2.py
4+++ b/curtin/commands/block_meta_v2.py
5@@ -70,15 +70,19 @@ class SFDiskPartTable:
6 def apply(self, device):
7 sfdisk_script = self.render()
8 LOG.debug("sfdisk input:\n---\n%s\n---\n", sfdisk_script)
9- util.subp(['sfdisk', device], data=sfdisk_script.encode('ascii'))
10- # sfdisk (as invoked here) uses ioctls to inform the kernel that the
11- # partition table has changed so it can add and remove device nodes for
12- # the partitions as needed. Unfortunately this is asynchronous: sfdisk
13- # can exit before the nodes are present in /dev (or /sys for that
14- # matter). Calling "udevadm settle" is slightly incoherent as udev has
15- # nothing to do with creating these nodes, but at the same time, udev
16- # won't finish processing the events triggered by the sfdisk until
17- # after the nodes for the partitions have been updated by the kernel.
18+ util.subp(
19+ ['sfdisk', '--no-tell-kernel', '--no-reread', device],
20+ data=sfdisk_script.encode('ascii'))
21+ util.subp(['partprobe', device])
22+ # sfdisk and partprobe (as invoked here) use ioctls to inform the
23+ # kernel that the partition table has changed so it can add and remove
24+ # device nodes for the partitions as needed. Unfortunately this is
25+ # asynchronous: we can return before the nodes are present in /dev (or
26+ # /sys for that matter). Calling "udevadm settle" is slightly
27+ # incoherent as udev has nothing to do with creating these nodes, but
28+ # at the same time, udev won't finish processing the events triggered
29+ # by the sfdisk until after the nodes for the partitions have been
30+ # updated by the kernel.
31 udevadm_settle()
32
33

Subscribers

People subscribed via source and target branches