Comment 9 for bug 1698337

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to diskimage-builder (master)

Reviewed: https://review.openstack.org/475203
Committed: https://git.openstack.org/cgit/openstack/diskimage-builder/commit/?id=5d5fa06e5c53ca8dc857d1700b57c2336ac62db1
Submitter: Jenkins
Branch: master

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.

    Change-Id: Ia77a0ffe4c76854b326ed76490479d9c691b49aa
    Partial-Bug: #1698337