diskimage-builder/diskimage_builder/block_device/level1
Ian Wienand 5d5fa06e5c Sync after writing partition table
We introduced the "settle" in
I90103b59357edebbac7a641e8980cb282d37561b thinking that maybe kpartx
had not finished writing the partition.  This probably wasn't a bad
first assumption, since we used to have this -- but is seems
insufficient.

The other failiure here seems to be if kpartx hasn't actually seen the
updated partition table in the image, so it has correctly (in it's
mind) not mounted the partition.

Looking at strace of fdisk run manually on a loopback, it will do a
fsync on the raw device after writing and then a global sync as it
exits.

This replicates this; we flush and fsync in mbr.py in the exit handler
after writing the partition, before closing the file (i've updated one
of the unit tests to double-check the call).  In the partitioning.py
caller we execute a sync call too.

Since it does seem unlikely the "-s" option of kpartx is not working,
I've removed the udev settle work-around too.

Change-Id: Ia77a0ffe4c76854b326ed76490479d9c691b49aa
Partial-Bug: #1698337
2017-06-19 17:13:36 +10:00
..
__init__.py Create and use plugin/node abstract classes 2017-05-26 11:48:11 +10:00
mbr.py Sync after writing partition table 2017-06-19 17:13:36 +10:00
partition.py Pass all blockdevices to bootloader 2017-06-08 17:14:22 +10:00
partitioning.py Sync after writing partition table 2017-06-19 17:13:36 +10:00