commit 5d5fa06e5c53ca8dc857d1700b57c2336ac62db1
Author: Ian Wienand <email address hidden>
Date: Mon Jun 19 10:29:53 2017 +1000
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.
Reviewed: https:/ /review. openstack. org/475203 /git.openstack. org/cgit/ openstack/ diskimage- builder/ commit/ ?id=5d5fa06e5c5 3ca8dc857d1700b 57c2336ac62db1
Committed: https:/
Submitter: Jenkins
Branch: master
commit 5d5fa06e5c53ca8 dc857d1700b57c2 336ac62db1
Author: Ian Wienand <email address hidden>
Date: Mon Jun 19 10:29:53 2017 +1000
Sync after writing partition table
We introduced the "settle" in 7edebbac7a641e8 980cb282d37561b thinking that maybe kpartx
I90103b5935
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: Ia77a0ffe4c7685 4b326ed76490479 d9c691b49aa
Partial-Bug: #1698337